]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/stream.h
blind fix for yet another VC6 compilation error
[wxWidgets.git] / interface / wx / stream.h
index f263607e4e6b68ed8185c84c2b7488db3aa96c88..b2a8c9cb9028adeefc68750db07d746e3d7aa651 100644 (file)
@@ -60,12 +60,34 @@ class wxBufferedInputStream : public wxFilterInputStream
 {
 public:
     /**
-        Constructor.
-        If a non @NULL buffer is given to the stream, it will be deleted by it.
+        Constructor using the provided buffer or default.
+
+        @param stream
+            The associated low-level stream.
+        @param buffer
+            The buffer to use if non-@NULL. Notice that the ownership of this
+            buffer is taken by the stream, i.e. it will delete it. If this
+            parameter is @NULL a default 1KB buffer is used.
     */
     wxBufferedInputStream(wxInputStream& stream,
                           wxStreamBuffer *buffer = NULL);
 
+    /**
+        Constructor allowing to specify the size of the buffer.
+
+        This is just a more convenient alternative to creating a wxStreamBuffer
+        of the given size and using the other overloaded constructor of this
+        class.
+
+        @param stream
+            The associated low-level stream.
+        @param bufsize
+            The size of the buffer, in bytes.
+
+        @since 2.9.0
+     */
+    wxBufferedInputStream(wxInputStream& stream, size_t bufsize);
+
     /**
         Destructor.
     */
@@ -112,9 +134,30 @@ public:
     */
     wxStreamBuffer(wxStreamBase& stream, BufMode mode);
 
+    /**
+        Constructor for an input buffer of the specified size.
+
+        Using it is equivalent to using the constructor above with read mode
+        and calling SetBufferIO() but is more convenient.
+
+        @since 2.9.0
+     */
+    wxStreamBuffer(wxInputStream& stream, size_t bufsize);
+
+    /**
+        Constructor for an output buffer of the specified size.
+
+        Using it is equivalent to using the constructor above with write mode
+        and calling SetBufferIO() but is more convenient.
+
+        @since 2.9.0
+     */
+    wxStreamBuffer(wxOutputStream& stream, size_t bufsize);
+
     /**
         Constructor; creates a new empty stream buffer which won't flush any data
         to a stream. mode specifies the type of the buffer (read, write, read_write).
+
         This stream buffer has the advantage to be stream independent and to work
         only on memory buffers but it is still compatible with the rest of the
         wxStream classes. You can write, read to this special stream and it will
@@ -129,7 +172,9 @@ public:
     wxStreamBuffer(BufMode mode);
 
     /**
-        Constructor. It initializes the stream buffer with the data of the specified
+        Copy constructor.
+
+        This method initializes the stream buffer with the data of the specified
         stream buffer. The new stream buffer has the same attributes, size, position
         and they share the same buffer. This will cause problems if the stream to
         which the stream buffer belong is destroyed and the newly cloned stream
@@ -209,7 +254,7 @@ public:
     /**
         Returns the current position (counted in bytes) in the stream buffer.
     */
-    wxFileOffset GetIntPosition() const;
+    size_t GetIntPosition() const;
 
     /**
         Returns the amount of bytes read during the last IO call to the parent stream.
@@ -450,7 +495,7 @@ enum wxStreamProtocolType
     handle it and create a stream to decompress it:
 
     @code
-    factory = wxFilterClassFactory::Find(filename, wxSTREAM_FILEEXT);
+        factory = wxFilterClassFactory::Find(filename, wxSTREAM_FILEEXT);
         if (factory)
             stream = factory-NewStream(new wxFFileInputStream(filename));
     @endcode
@@ -534,7 +579,7 @@ public:
             list << *p << _T("\n");
         @endcode
     */
-    const wxChar* const* GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const;
+    virtual const wxChar * const* GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const = 0;
 
     //@{
     /**
@@ -667,10 +712,34 @@ class wxBufferedOutputStream : public wxFilterOutputStream
 {
 public:
     /**
-        @todo WRITE DESCRIPTION
+        Constructor using the provided buffer or default.
+
+        @param stream
+            The associated low-level stream.
+        @param buffer
+            The buffer to use if non-@NULL. Notice that the ownership of this
+            buffer is taken by the stream, i.e. it will delete it. If this
+            parameter is @NULL a default 1KB buffer is used.
     */
     wxBufferedOutputStream(wxOutputStream& stream,
                            wxStreamBuffer *buffer = NULL);
+
+    /**
+        Constructor allowing to specify the size of the buffer.
+
+        This is just a more convenient alternative to creating a wxStreamBuffer
+        of the given size and using the other overloaded constructor of this
+        class.
+
+        @param stream
+            The associated low-level stream.
+        @param bufsize
+            The size of the buffer, in bytes.
+
+        @since 2.9.0
+     */
+    wxBufferedOutputStream(wxOutputStream& stream, size_t bufsize);
+
     /**
         Destructor. Calls Sync() and destroys the internal buffer.
     */
@@ -679,7 +748,7 @@ public:
     /**
         Calls Sync() and changes the stream position.
     */
-    virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart)
+    virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart);
 
     /**
         Flushes the buffer and calls Sync() on the parent stream.
@@ -726,7 +795,7 @@ public:
         Returns the first character in the input queue and removes it,
         blocking until it appears if necessary.
     */
-    char GetC();
+    int GetC();
 
     /**
         Returns the last number of bytes read.
@@ -881,20 +950,23 @@ public:
     size_t OnSysRead(void* buffer, size_t bufsize);
 
     /**
-        Internal function.
-        It is called when the stream needs to change the current position.
+        See OnSysRead().
     */
-    wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+    size_t OnSysWrite(const void* buffer, size_t bufsize);
+
+
+protected:
 
     /**
         Internal function.
-        It is called when the stream needs to know the real position.
+        It is called when the stream needs to change the current position.
     */
-    wxFileOffset OnSysTell() const;
+    virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
 
     /**
-        See OnSysRead().
+        Internal function.
+        It is called when the stream needs to know the real position.
     */
-    size_t OnSysWrite(const void* buffer, size_t bufsize);
+    virtual wxFileOffset OnSysTell() const;
 };