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

    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

        Issue Links

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

          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:

                Gerrit Reviews

                  There are no open Gerrit changes