pipestream.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #ifndef _WX_MSW_PRIVATE_PIPESTREAM_H_
  10. #define _WX_MSW_PRIVATE_PIPESTREAM_H_
  11. class wxPipeInputStream : public wxInputStream
  12. {
  13. public:
  14. wxEXPLICIT wxPipeInputStream(HANDLE hInput);
  15. virtual ~wxPipeInputStream();
  16. // returns true if the pipe is still opened
  17. bool IsOpened() const { return m_hInput != INVALID_HANDLE_VALUE; }
  18. // returns true if there is any data to be read from the pipe
  19. virtual bool CanRead() const;
  20. protected:
  21. virtual size_t OnSysRead(void *buffer, size_t len);
  22. protected:
  23. HANDLE m_hInput;
  24. wxDECLARE_NO_COPY_CLASS(wxPipeInputStream);
  25. };
  26. class wxPipeOutputStream: public wxOutputStream
  27. {
  28. public:
  29. wxEXPLICIT wxPipeOutputStream(HANDLE hOutput);
  30. virtual ~wxPipeOutputStream() { Close(); }
  31. bool Close();
  32. protected:
  33. size_t OnSysWrite(const void *buffer, size_t len);
  34. protected:
  35. HANDLE m_hOutput;
  36. wxDECLARE_NO_COPY_CLASS(wxPipeOutputStream);
  37. };
  38. #endif // _WX_MSW_PRIVATE_PIPESTREAM_H_