Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-100556

qOffsetStringArray(): allow char8_t, char16_t, std::byte payloads

    XMLWordPrintable

Details

    Description

      It is sometimes useful to have the data in UTF-16, either because it cannot be represented in 8-bit or because a common use case is to return QStrings from them, which can then be fromRawData()'ed instead of requiring a heap allocation.

      Acceptance criterion:

      1. all existing tests still pass
      2. the following new tests don't fail:
      {
          constexpr auto table = qOffsetStringArray(u8"Foo", u8"Bar");
          QVERIFY(table.viewAt(0) == u8"Foo"); // returns QUtf8StringView
          QVERIFY(table.viewAt(1) == u8"Foo");
      }
      {
          constexpr auto table = qOffsetStringArray(u"Foo", u"Bar");
          QVERIFY(table.viewAt(0) == u"Foo"); // returns QStringView
          QVERIFY(table.viewAt(1) == u"Bar");
      }
      

      std::byte version's name to be bikeshedded.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              thiago Thiago Macieira
              mmutz Marc Mutz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes