wxInputStream/wxOutputStream to C++ i/ostream delegation

T.J. VanSlyke tvanslyke at psdconsulting.com
Wed Sep 5 07:48:01 PDT 2007


Greetings,

I am trying to write a wrapper around wxProcess to implement an existing 
interface in my codebase which looks like the following:

class IProcess
{
   public:
      virtual void setWaitTimeout(int milliseconds) = 0;
      virtual void start(const string& exe, const vector<string>& args) = 0;
      virtual ostream& in() = 0;
      virtual istream& out() = 0;
      virtual int getExitCode() = 0;
      virtual void close() = 0;
};

The methods

      virtual ostream& in() = 0;
      virtual istream& out() = 0;

pose a problem as I am not sure whether it is possible to delegate the 
wxInput/OutputStream classes to istream and ostream, respectively.  
Essentially, I need to return a std::ostream and a std::istream which 
forward their stream I/O requests to their wx counterparts.  I have read 
the wx documentation for the streams and it appears that the streams 
were created due to compatibility issues across multiple implementations 
of the C++ standard library.  This is not a problem for our project, so 
I'm not concerned about that.  Any help with this would be greatly 
appreciated.

Regards,
T.J. VanSlyke





More information about the wx-users mailing list