A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.
Does anyone here know that such an adapter exists? I already have all the code that deals with std::iostream. Now I need to find a simple way for the code to work with IStream interface (the COM interface on Windows). If such an adapter exists that will save us much work.
Friday, March 07, 2008
I would implement like this:
1. first rely on win32 API SHCreateMemStream or SHCreateStreamOnFile to create Istream implemantation.
2. then copy std::iostream buffers to the IStream buffer.
it should not involve many lines of code.
SHCreateMemStream/SHCreateStreamOnFile can be found in shlwapi.h.
I had one lo-these-many-years-ago, but it was pre-standard library. And I lost the code anyway.
The trick is to implement a std::streambuf class that wraps the IStream, delegating reads and writes to the underlying IStream. You don't need to touch any of the istream or ostream classes; they all work with streambufs.
Friday, March 14, 2008
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz