]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/stream.h
added (MSW/GTK) and documented new frame and dialog flags
[wxWidgets.git] / include / wx / stream.h
index 4bfdf72aa500ff6f6746c0a99f2ceee85c2b276b..2e57b4ce7b3e3c651b89b87ba90965ad3ff7a821 100644 (file)
@@ -38,34 +38,40 @@ WXDLLEXPORT wxOutputStream& wxEndL(wxOutputStream& o_stream);
 // wxStream: base classes
 // ---------------------------------------------------------------------------
 
-#define wxStream_NOERROR    wxSTREAM_NOERROR
-#define wxStream_EOF        wxSTREAM_EOF
-#define wxStream_WRITE_ERR  wxSTREAM_WRITE_ERROR
-#define wxStream_READ_ERR   wxSTREAM_READ_ERROR
-  
-typedef enum {
+typedef enum
+{
   wxSTREAM_NO_ERROR = 0,
   wxSTREAM_NO_ERR = wxSTREAM_NO_ERROR,
   wxSTREAM_NOERROR = wxSTREAM_NO_ERROR,
-  
+
   wxSTREAM_EOF,
-  
+
   wxSTREAM_WRITE_ERROR,
   wxSTREAM_WRITE_ERR = wxSTREAM_WRITE_ERROR,
-  
+
   wxSTREAM_READ_ERROR,
-  wxSTREAM_READ_ERR = wxSTREAM_READ_ERROR,
-  
+  wxSTREAM_READ_ERR = wxSTREAM_READ_ERROR
+
 } wxStreamError;
 
-class WXDLLEXPORT wxStreamBase 
+// compatibility
+#define wxStream_NOERROR    wxSTREAM_NOERROR
+#define wxStream_EOF        wxSTREAM_EOF
+#define wxStream_WRITE_ERR  wxSTREAM_WRITE_ERROR
+#define wxStream_READ_ERR   wxSTREAM_READ_ERROR
+
+class WXDLLEXPORT wxStreamBase
 {
 public:
     wxStreamBase();
     virtual ~wxStreamBase();
 
-    bool operator!() const { return (LastError() != wxSTREAM_NOERROR); }
+    // error testing
     wxStreamError LastError() const { return m_lasterror; }
+    wxStreamError GetLastError() const { return m_lasterror; }
+    bool IsOk() const { return LastError() == wxSTREAM_NOERROR; }
+    bool operator!() const { return LastError() != wxSTREAM_NOERROR; }
+
     virtual size_t GetSize() const { return ~((size_t)0); }
     size_t StreamSize() const { return GetSize(); }
 
@@ -81,12 +87,15 @@ protected:
     wxStreamError m_lasterror;
 };
 
-class WXDLLEXPORT wxInputStream: public wxStreamBase 
+class WXDLLEXPORT wxInputStream: public wxStreamBase
 {
 public:
     wxInputStream();
     virtual ~wxInputStream();
 
+    // is the stream at EOF?
+    virtual bool Eof() const;
+
     // IO functions
     virtual char Peek();
     char GetC();
@@ -121,7 +130,7 @@ protected:
     size_t GetWBack(char *buf, size_t bsize);
 };
 
-class WXDLLEXPORT wxOutputStream: public wxStreamBase 
+class WXDLLEXPORT wxOutputStream: public wxStreamBase
 {
 public:
     wxOutputStream();
@@ -149,7 +158,7 @@ public:
 // A stream for measuring streamed output
 // ---------------------------------------------------------------------------
 
-class wxCountingOutputStream: public wxOutputStream 
+class WXDLLEXPORT wxCountingOutputStream: public wxOutputStream
 {
 public:
     wxCountingOutputStream();
@@ -165,12 +174,11 @@ protected:
     size_t m_currentPos;
 };
 
-
 // ---------------------------------------------------------------------------
 // "Filter" streams
 // ---------------------------------------------------------------------------
 
-class WXDLLEXPORT wxFilterInputStream: public wxInputStream 
+class WXDLLEXPORT wxFilterInputStream: public wxInputStream
 {
 public:
     wxFilterInputStream();
@@ -185,7 +193,7 @@ protected:
     wxInputStream *m_parent_i_stream;
 };
 
-class WXDLLEXPORT wxFilterOutputStream: public wxOutputStream 
+class WXDLLEXPORT wxFilterOutputStream: public wxOutputStream
 {
 public:
     wxFilterOutputStream();
@@ -202,7 +210,7 @@ protected:
 // Stream buffer
 // ---------------------------------------------------------------------------
 
-class WXDLLEXPORT wxStreamBuffer 
+class WXDLLEXPORT wxStreamBuffer
 {
 public:
     typedef enum {
@@ -265,7 +273,7 @@ protected:
 // wxBufferedStreams
 // ---------------------------------------------------------------------------
 
-class wxBufferedInputStream: public wxFilterInputStream 
+class WXDLLEXPORT wxBufferedInputStream: public wxFilterInputStream
 {
 public:
     wxBufferedInputStream(wxInputStream& stream);
@@ -273,7 +281,7 @@ public:
 
     char Peek();
     wxInputStream& Read(void *buffer, size_t size);
-  
+
     // Position functions
     off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
     off_t TellI() const;
@@ -283,19 +291,19 @@ public:
 protected:
     size_t OnSysRead(void *buffer, size_t bufsize);
     off_t OnSysSeek(off_t seek, wxSeekMode mode);
-    off_t OnSysTell() const;  
+    off_t OnSysTell() const;
 
     wxStreamBuffer *m_i_streambuf;
 };
 
-class wxBufferedOutputStream: public wxFilterOutputStream 
+class WXDLLEXPORT wxBufferedOutputStream: public wxFilterOutputStream
 {
 public:
     wxBufferedOutputStream(wxOutputStream& stream);
     ~wxBufferedOutputStream();
 
     wxOutputStream& Write(const void *buffer, size_t size);
-  
+
     // Position functions
     off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
     off_t TellO() const;
@@ -303,13 +311,13 @@ public:
     void Sync();
 
     size_t GetSize() const;
-  
+
     wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
 
 protected:
     size_t OnSysWrite(const void *buffer, size_t bufsize);
     off_t OnSysSeek(off_t seek, wxSeekMode mode);
-    off_t OnSysTell() const;  
+    off_t OnSysTell() const;
 
     wxStreamBuffer *m_o_streambuf;
 };