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