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

QIODevice::readLineInto() should have a QSpan overload

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Core: I/O
    • None
    • 3
    • Foundation Sprint 69, Foundation Sprint 70, Foundation Sprint 71, Foundation Sprint 110, Foundation Sprint 111, Foundation Sprint 112, Foundation Sprint 113, Foundation Sprint 114, Foundation Sprint 115, Foundation Sprint 116, Foundation Sprint 117, Foundation Sprint 118, Foundation Sprint 119

    Description

      QIODevice now has readLineInto(QByteArray *, qint64), but that is still dependent on a QByteArray and therefore needs at least one (initial) allocation.

      In many cases, a static or automatic buffer would be sufficient, such as a C array or a QVLA. For these callers, we should also have an overload of the QCryptographicHash::hashInto form:

      QByteArrayView QIODevice::readLineInto(QSpan<std::bytes> buffer); // + char and uchar overloads delegating to this
      

      cf. https://doc-snapshots.qt.io/qt6-dev/qcryptographichash.html#hashInto-3

      Doesn't need the maxSize parameter, as that would be the same as buffer.size().

      Could even have readInto() (non-Line) in the same style.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-126574
          # Subject Branch Project Status CR V

          Activity

            People

              rybouabi Rym Bouabid
              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 is 1 open Gerrit change