--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/msw/private/pipestream.h
+// Purpose: MSW wxPipeInputStream and wxPipeOutputStream declarations
+// Author: Vadim Zeitlin
+// Created: 2013-06-08 (extracted from src/msw/utilsexc.cpp)
+// RCS-ID: $Id$
+// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MSW_PRIVATE_PIPESTREAM_H_
+#define _WX_MSW_PRIVATE_PIPESTREAM_H_
+
+class wxPipeInputStream : public wxInputStream
+{
+public:
+ wxEXPLICIT wxPipeInputStream(HANDLE hInput);
+ virtual ~wxPipeInputStream();
+
+ // returns true if the pipe is still opened
+ bool IsOpened() const { return m_hInput != INVALID_HANDLE_VALUE; }
+
+ // returns true if there is any data to be read from the pipe
+ virtual bool CanRead() const;
+
+protected:
+ virtual size_t OnSysRead(void *buffer, size_t len);
+
+protected:
+ HANDLE m_hInput;
+
+ wxDECLARE_NO_COPY_CLASS(wxPipeInputStream);
+};
+
+class wxPipeOutputStream: public wxOutputStream
+{
+public:
+ wxEXPLICIT wxPipeOutputStream(HANDLE hOutput);
+ virtual ~wxPipeOutputStream() { Close(); }
+ bool Close();
+
+protected:
+ size_t OnSysWrite(const void *buffer, size_t len);
+
+protected:
+ HANDLE m_hOutput;
+
+ wxDECLARE_NO_COPY_CLASS(wxPipeOutputStream);
+};
+
+#endif // _WX_MSW_PRIVATE_PIPESTREAM_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/private/pipestream.h
+// Purpose: Declares wxPipeInputStream and wxPipeOutputStream.
+// Author: Vadim Zeitlin
+// Modified by: Rob Bresalier
+// Created: 2013-04-27
+// RCS-ID: $Id$
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// (c) 2013 Rob Bresalier
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PRIVATE_PIPESTREAM_H_
+#define _WX_PRIVATE_PIPESTREAM_H_
+
+#include "wx/platform.h"
+
+// wxPipeInputStream is a platform-dependent input stream class (i.e. deriving,
+// possible indirectly, from wxInputStream) for reading from a pipe, i.e. a
+// pipe FD under Unix or a pipe HANDLE under MSW. It provides a single extra
+// IsOpened() method.
+//
+// wxPipeOutputStream is similar but has no additional methods at all.
+#ifdef __UNIX__
+ #include "wx/unix/private/pipestream.h"
+#elif defined(__WINDOWS__) && !defined(__WXWINCE__)
+ #include "wx/msw/private/pipestream.h"
+#endif
+
+#endif // _WX_PRIVATE_PIPESTREAM_H_
int m_fds[2];
};
-#if wxUSE_STREAMS && wxUSE_FILE
-
-#include "wx/wfstream.h"
-
-// ----------------------------------------------------------------------------
-// wxPipeInputStream: stream for reading from a pipe
-// ----------------------------------------------------------------------------
-
-class wxPipeInputStream : public wxFileInputStream
-{
-public:
- wxPipeInputStream(int fd) : wxFileInputStream(fd) { }
-
- // return TRUE if the pipe is still opened
- bool IsOpened() const { return !Eof(); }
-
- // return TRUE if we have anything to read, don't block
- virtual bool CanRead() const;
-};
-
-// ----------------------------------------------------------------------------
-// wxPipeOutputStream: stream for writing to a pipe
-// ----------------------------------------------------------------------------
-
-class wxPipeOutputStream : public wxFileOutputStream
-{
-public:
- wxPipeOutputStream(int fd) : wxFileOutputStream(fd) { }
-
- // Override the base class version to ignore "pipe full" errors: this is
- // not an error for this class.
- size_t OnSysWrite(const void *buffer, size_t size);
-};
-
-#endif // wxUSE_STREAMS && wxUSE_FILE
-
#endif // _WX_UNIX_PIPE_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/private/pipestream.h
+// Purpose: Unix wxPipeInputStream and wxPipeOutputStream declarations
+// Author: Vadim Zeitlin
+// Created: 2013-06-08 (extracted from wx/unix/pipe.h)
+// RCS-ID: $Id$
+// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_PRIVATE_PIPESTREAM_H_
+#define _WX_UNIX_PRIVATE_PIPESTREAM_H_
+
+#include "wx/wfstream.h"
+
+class wxPipeInputStream : public wxFileInputStream
+{
+public:
+ wxEXPLICIT wxPipeInputStream(int fd) : wxFileInputStream(fd) { }
+
+ // return true if the pipe is still opened
+ bool IsOpened() const { return !Eof(); }
+
+ // return true if we have anything to read, don't block
+ virtual bool CanRead() const;
+};
+
+class wxPipeOutputStream : public wxFileOutputStream
+{
+public:
+ wxPipeOutputStream(int fd) : wxFileOutputStream(fd) { }
+
+ // Override the base class version to ignore "pipe full" errors: this is
+ // not an error for this class.
+ size_t OnSysWrite(const void *buffer, size_t size);
+};
+
+#endif // _WX_UNIX_PRIVATE_PIPESTREAM_H_
#if wxUSE_STREAMS && !defined(__WXWINCE__)
-// ----------------------------------------------------------------------------
-// wxPipeStreams
-// ----------------------------------------------------------------------------
-
-class wxPipeInputStream: public wxInputStream
-{
-public:
- wxPipeInputStream(HANDLE hInput);
- virtual ~wxPipeInputStream();
-
- // returns true if the pipe is still opened
- bool IsOpened() const { return m_hInput != INVALID_HANDLE_VALUE; }
-
- // returns true if there is any data to be read from the pipe
- virtual bool CanRead() const;
-
-protected:
- size_t OnSysRead(void *buffer, size_t len);
-
-protected:
- HANDLE m_hInput;
-
- wxDECLARE_NO_COPY_CLASS(wxPipeInputStream);
-};
-
-class wxPipeOutputStream: public wxOutputStream
-{
-public:
- wxPipeOutputStream(HANDLE hOutput);
- virtual ~wxPipeOutputStream() { Close(); }
- bool Close();
-
-protected:
- size_t OnSysWrite(const void *buffer, size_t len);
-
-protected:
- HANDLE m_hOutput;
-
- wxDECLARE_NO_COPY_CLASS(wxPipeOutputStream);
-};
+#include "wx/private/pipestream.h"
// define this to let wxexec.cpp know that we know what we're doing
#define _WX_USED_BY_WXEXECUTE_
#if HAS_PIPE_STREAMS
+#include "wx/private/pipestream.h"
+
// define this to let wxexec.cpp know that we know what we're doing
#define _WX_USED_BY_WXEXECUTE_
#include "../common/execcmn.cpp"