Opened 5 years ago

Last modified 5 years ago

#15640 confirmed defect

wxTransferFileToStream with wx streams unavailable

Reported by: hakanw Owned by:
Priority: low Milestone:
Component: base Version: 3.0.0-rc2
Keywords: docview streams Cc:
Blocked By: Blocking:
Patch: yes


I want to be able to use

  • wxTransferFileToStream(const wxString& filename, wxOutputStream& stream)
  • wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)

(in docview.cpp/.h)

but since I have defined wxUSE_STD_IOSTREAM, I only have access to

  • wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream);
  • wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename);

The submitted patch includes the first two methods if wxUSE_STREAMS is defined

Attachments (1)

docview_streams.patch download (1.3 KB) - added by hakanw 5 years ago.
Patch of changes in docview.cpp/.h. Hope it is correctly formatted.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by hakanw

Patch of changes in docview.cpp/.h. Hope it is correctly formatted.

comment:1 Changed 5 years ago by hakanw

The reason why I want to use the wxInput/OutputStream arguments is that they are used in wxZipInput/OutputStream which I use ocassionally.

comment:2 Changed 5 years ago by vadz

  • Milestone 3.0 deleted
  • Priority changed from normal to low
  • Status changed from new to confirmed

IMHO these functions should be avoided/deprecated completely, what is the point of having them? Copying the stream contents to a file doesn't seem like something you'd often need to do. And if you do need it, you can always just use wxInputStream::Read(wxOutputStream&) to copy the entire stream contents to arbitrary output stream.

IMHO the main problem with the streams and docview classes is the difference in {Save,Load}Object() signature in wxUSE_STL case, but this is not as simple to fix, unfortunately.

Note: See TracTickets for help on using tickets.