]> git.saurik.com Git - wxWidgets.git/blob - include/wx/unix/private/pipestream.h
e57b4d360e7ed16f122afe4f85e81fb2a6351360
[wxWidgets.git] / include / wx / unix / private / pipestream.h
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 // RCS-ID: $Id$
7 // Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_UNIX_PRIVATE_PIPESTREAM_H_
12 #define _WX_UNIX_PRIVATE_PIPESTREAM_H_
13
14 #include "wx/wfstream.h"
15
16 class wxPipeInputStream : public wxFileInputStream
17 {
18 public:
19 wxEXPLICIT wxPipeInputStream(int fd) : wxFileInputStream(fd) { }
20
21 // return true if the pipe is still opened
22 bool IsOpened() const { return !Eof(); }
23
24 // return true if we have anything to read, don't block
25 virtual bool CanRead() const;
26 };
27
28 class wxPipeOutputStream : public wxFileOutputStream
29 {
30 public:
31 wxPipeOutputStream(int fd) : wxFileOutputStream(fd) { }
32
33 // Override the base class version to ignore "pipe full" errors: this is
34 // not an error for this class.
35 size_t OnSysWrite(const void *buffer, size_t size);
36 };
37
38 #endif // _WX_UNIX_PRIVATE_PIPESTREAM_H_