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

Add support for std::ifstream and std::ofstream in QFileDevice

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core: I/O
    • Labels:
      None

      Description

      Hi,

      Currently it's quite an exercise to use a third party library that uses the std::ifstream/std::ofstream (for respectively reading and writing) as Qt doesn't have any mappings to them from QFileDevice.

      Or perhaps even from QIODevice, though that might be a stretch.

      An example library that comes to mind is the splendid nlohmann json library. The library itself is quite easy to use, but hooking it into Qt (for instance in QSettings) is... challenging.

      Note: ignore the fact that Qt has it's own JSON parsing classes. That is not the point of this request nor the example.

      There are ways to get to an std::streambuf object, but that requires quite a bit of boilerplate code.

      Having this would just make it one more step easier to use external libraries in Qt.

       

      Cheers,
      Mark

        Attachments

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

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              markg85 Mark
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes