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

Allow streaming QAnyStringView into QTextStream

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Core: Serialization
    • None
    • 8
    • 233109e93 (6.4), ca5b8565f (6.4), f234a3903 (6.4), e13eb4835 (tqtc/lts-6.2), 86619c616 (tqtc/lts-6.2), d6898b59f (tqtc/lts-6.2), f192ddad8 (dev), f046589e1 (dev), 2ffdb3bcd (dev), d2e1d73bf (dev), bc9e1c5c2 (dev), 8c0ed7422 (dev), 4e5f87406 (dev)

    Description

      QTextStream is basically a fancy way to append to a string, not saving any one of them individually, so this API is a perfect candidate for supporting QAnyStringViews.

      In general, the QTextStream API (QDebug, QDataStream, iostreams all have the same problem to varying extent) is flawed in that it allows implicit conversions.

      It would be better if stream operators were hidden friends of the streamed data types and, for built-in types, were constrained to disallow implicit conversion.

      That, or we just always provide the most-encompassing type (intmax_t, uintmax_t, long double, QAnyStringView) in the traditional way. But what about bool, e.g.?

      I'm mentioning that here because it means we should start to add QAnyStringView and QUtf8StringView streaming as hidden friends of the views, not, as it was done before, as a member function of the stream.

      Acceptance criteria:

      • can stream QAnyStringView and QUtf8StringView into QTextStream
      • decided which path to take w.r.t. overloading stream operators

      Attachments

        Activity

          People

            cnn Qt Core & Network
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: