pipestream.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/unix/private/pipestream.h
  3. // Purpose: Unix wxPipeInputStream and wxPipeOutputStream declarations
  4. // Author: Vadim Zeitlin
  5. // Created: 2013-06-08 (extracted from wx/unix/pipe.h)
  6. // Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_UNIX_PRIVATE_PIPESTREAM_H_
  10. #define _WX_UNIX_PRIVATE_PIPESTREAM_H_
  11. #include "wx/wfstream.h"
  12. class wxPipeInputStream : public wxFileInputStream
  13. {
  14. public:
  15. wxEXPLICIT wxPipeInputStream(int fd) : wxFileInputStream(fd) { }
  16. // return true if the pipe is still opened
  17. bool IsOpened() const { return !Eof(); }
  18. // return true if we have anything to read, don't block
  19. virtual bool CanRead() const;
  20. };
  21. class wxPipeOutputStream : public wxFileOutputStream
  22. {
  23. public:
  24. wxPipeOutputStream(int fd) : wxFileOutputStream(fd) { }
  25. // Override the base class version to ignore "pipe full" errors: this is
  26. // not an error for this class.
  27. size_t OnSysWrite(const void *buffer, size_t size);
  28. };
  29. #endif // _WX_UNIX_PRIVATE_PIPESTREAM_H_