]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/stream.h
Renameing funktions to prevent name clashes
[wxWidgets.git] / include / wx / stream.h
index a7b6783663d140951a12c6a19ccecab9c4c35743..efef1ec113bfa67380b93ba8659b10ef9af0e248 100644 (file)
@@ -38,10 +38,10 @@ WXDLLEXPORT wxOutputStream& wxEndL(wxOutputStream& o_stream);
 // wxStream: base classes
 // ---------------------------------------------------------------------------
 
 // wxStream: base classes
 // ---------------------------------------------------------------------------
 
-#define wxStream_NOERROR    wxSTR_NOERROR
-#define wxStream_EOF        wxSTR_EOF
-#define wxStream_WRITE_ERR  wxSTR_WRITE_ERROR
-#define wxStream_READ_ERR   wxSTR_READ_ERROR
+#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 {
   wxStream_NOERROR = 0,
   
 typedef enum {
   wxStream_NOERROR = 0,
@@ -55,9 +55,10 @@ class WXDLLEXPORT wxStreamBase {
   wxStreamBase();
   virtual ~wxStreamBase();
 
   wxStreamBase();
   virtual ~wxStreamBase();
 
-  bool operator!() const { return (LastError() != wxSTR_NOERROR); }
+  bool operator!() const { return (LastError() != wxSTREAM_NOERROR); }
   wxStreamError LastError() const { return m_lasterror; }
   virtual size_t GetSize() const { return ~((size_t)0); }
   wxStreamError LastError() const { return m_lasterror; }
   virtual size_t GetSize() const { return ~((size_t)0); }
+  size_t StreamSize() const { return GetSize(); }
 
  protected:
 
 
  protected:
 
@@ -92,7 +93,7 @@ class WXDLLEXPORT wxInputStream: public wxStreamBase {
   virtual size_t LastRead() { return wxStreamBase::m_lastcount; }
 
   // Ungetch
   virtual size_t LastRead() { return wxStreamBase::m_lastcount; }
 
   // Ungetch
-  size_t Ungetch(void *buffer, size_t size);
+  size_t Ungetch(const void *buffer, size_t size);
   bool Ungetch(char c);
 
   // Operators
   bool Ungetch(char c);
 
   // Operators
@@ -135,6 +136,28 @@ class WXDLLEXPORT wxOutputStream: public wxStreamBase {
   wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); }
 };
 
   wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); }
 };
 
+// ---------------------------------------------------------------------------
+// A stream for measuring streamed output
+// ---------------------------------------------------------------------------
+
+class wxCountingOutputStream: public wxOutputStream {
+ public:
+  wxCountingOutputStream();
+
+  size_t GetSize() const;
+  bool Ok() const { return TRUE; }
+
+ protected:
+
+  size_t OnSysWrite(const void *buffer, size_t size);
+  off_t OnSysSeek(off_t pos, wxSeekMode mode);
+  off_t OnSysTell() const;
+
+ protected:
+  size_t m_currentPos;
+};
+
+
 // ---------------------------------------------------------------------------
 // "Filter" streams
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // "Filter" streams
 // ---------------------------------------------------------------------------
@@ -147,7 +170,6 @@ class WXDLLEXPORT wxFilterInputStream: public wxInputStream {
 
   char Peek() { return m_parent_i_stream->Peek(); }
 
 
   char Peek() { return m_parent_i_stream->Peek(); }
 
-  wxStreamError LastError() const { return m_parent_i_stream->LastError(); }
   size_t GetSize() const { return m_parent_i_stream->GetSize(); }
 
  protected:
   size_t GetSize() const { return m_parent_i_stream->GetSize(); }
 
  protected:
@@ -160,7 +182,6 @@ class WXDLLEXPORT wxFilterOutputStream: public wxOutputStream {
   wxFilterOutputStream(wxOutputStream& stream);
   ~wxFilterOutputStream();
 
   wxFilterOutputStream(wxOutputStream& stream);
   ~wxFilterOutputStream();
 
-  wxStreamError LastError() const { return m_parent_o_stream->LastError(); }
   size_t GetSize() const { return m_parent_o_stream->GetSize(); }
 
  protected:
   size_t GetSize() const { return m_parent_o_stream->GetSize(); }
 
  protected:
@@ -193,6 +214,7 @@ class WXDLLEXPORT wxStreamBuffer {
   size_t Write(const void *buffer, size_t size);
   size_t Write(wxStreamBuffer *buf);
 
   size_t Write(const void *buffer, size_t size);
   size_t Write(wxStreamBuffer *buf);
 
+  char Peek();
   char GetChar();
   void PutChar(char c);
   off_t Tell() const;
   char GetChar();
   void PutChar(char c);
   off_t Tell() const;
@@ -250,6 +272,7 @@ class wxBufferedInputStream: public wxFilterInputStream {
   wxBufferedInputStream(wxInputStream& stream);
   ~wxBufferedInputStream();
 
   wxBufferedInputStream(wxInputStream& stream);
   ~wxBufferedInputStream();
 
+  char Peek();
   wxInputStream& Read(void *buffer, size_t size);
   
   // Position functions
   wxInputStream& Read(void *buffer, size_t size);
   
   // Position functions