[Development] QAnyStringView
Marc Mutz
marc.mutz at kdab.com
Thu Jun 25 08:24:58 CEST 2020
On 2020-06-24 16:59, Thiago Macieira wrote:
> On Wednesday, 24 June 2020 00:32:04 PDT Marc Mutz via Development
> wrote:
>> - QAnyStringView is the interface type (and only that)
>> - Q(Utf8)StringView are the parse types (via QAnyStringView::visit())
>
> BTW, any chance we can bait-and-switch, renaming QStringView to
> QUtf16StringView and rename QAnyStringView into the newly liberated
> name?
Short answer:
Any chance we can rename QString -> QUtf16String?
Longer answer:
As I said earlier, IMNSHO, we also need an owning container per view
type:
- QLatin1String QLatin1StringView
- QUtf8String QUtf8StringView
- QString QStringView # UTF-16
- QAnyString QAnyStringView # variant type
I'm not pursuing this atm, since QLatin1String is going to go away at
some point (when someone can tell me how to regain the size()
optimisation in op== we then lose between 8-bit and 16-bit strings), and
because it's more important to get the view types into 6.0; the owning
ones can be added at any time later.
So, to answer your question: The picture would then look like this:
- QLatin1String QLatin1StringView
- QUtf8String QUtf8StringView
- QUtf16String QUtf16StringView
- QString QStringView # variant type
This is certainly how one would go about designing it when starting from
scratch. So, realistically, no.
That doesn't mean we can't do the rename and add aliases QString =
QUtf16String and QStringView = QUtf16StringView for Qt 6 and see whether
that gains traction until Qt 7. But it means that QAnyStringView can't
possibly be spelled QStringView in Qt 6.0.
Thanks,
Marc
More information about the Development
mailing list