1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: wx/msw/private/pipestream.h 3 // Purpose: MSW wxPipeInputStream and wxPipeOutputStream declarations 4 // Author: Vadim Zeitlin 5 // Created: 2013-06-08 (extracted from src/msw/utilsexc.cpp) 6 // Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org> 7 // Licence: wxWindows licence 8 /////////////////////////////////////////////////////////////////////////////// 9 10 #ifndef _WX_MSW_PRIVATE_PIPESTREAM_H_ 11 #define _WX_MSW_PRIVATE_PIPESTREAM_H_ 12 13 class wxPipeInputStream : public wxInputStream 14 { 15 public: 16 wxEXPLICIT wxPipeInputStream(HANDLE hInput); 17 virtual ~wxPipeInputStream(); 18 19 // returns true if the pipe is still opened IsOpened()20 bool IsOpened() const { return m_hInput != INVALID_HANDLE_VALUE; } 21 22 // returns true if there is any data to be read from the pipe 23 virtual bool CanRead() const; 24 25 protected: 26 virtual size_t OnSysRead(void *buffer, size_t len); 27 28 protected: 29 HANDLE m_hInput; 30 31 wxDECLARE_NO_COPY_CLASS(wxPipeInputStream); 32 }; 33 34 class wxPipeOutputStream: public wxOutputStream 35 { 36 public: 37 wxEXPLICIT wxPipeOutputStream(HANDLE hOutput); ~wxPipeOutputStream()38 virtual ~wxPipeOutputStream() { Close(); } 39 bool Close(); 40 41 protected: 42 size_t OnSysWrite(const void *buffer, size_t len); 43 44 protected: 45 HANDLE m_hOutput; 46 47 wxDECLARE_NO_COPY_CLASS(wxPipeOutputStream); 48 }; 49 50 #endif // _WX_MSW_PRIVATE_PIPESTREAM_H_ 51