]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/stream.h
fix an important bug: ifacecheck was parsing only <sectiondef> with kind==public...
[wxWidgets.git] / interface / wx / stream.h
index 2b96f1a96a2b457388e8878fdf6f75147187e650..0d7511ce4439cfcfbf951cf53400f5c3c3a925c7 100644 (file)
@@ -60,12 +60,34 @@ class wxBufferedInputStream : public wxFilterInputStream
 {
 public:
     /**
 {
 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);
 
     */
     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.
     */
     /**
         Destructor.
     */
@@ -77,12 +99,16 @@ public:
 /**
     @class wxStreamBuffer
 
 /**
     @class wxStreamBuffer
 
-    @todo WRITE A DESCRIPTION
+    wxStreamBuffer is a cache manager for wxStreamBase: it manages a stream buffer
+    linked to a stream.
+
+    Each stream always has one autoinitialized stream buffer, but you may
+    attach more of them to the same stream.
 
     @library{wxbase}
     @category{streams}
 
 
     @library{wxbase}
     @category{streams}
 
-    @see wxStreamBase
+    @see wxStreamBase, @ref overview_stream
 */
 class wxStreamBuffer
 {
 */
 class wxStreamBuffer
 {
@@ -105,13 +131,35 @@ public:
 
         @code
         streambuffer.Read(...);
 
         @code
         streambuffer.Read(...);
-        streambuffer2.Read(...); // This call erases previous error messages set by 'streambuffer'
+        streambuffer2.Read(...);
+            // This call erases previous error messages set by 'streambuffer'
+            // assuming that both instances are stream buffers for the same stream
         @endcode
 
         @see SetBufferIO()
     */
     wxStreamBuffer(wxStreamBase& stream, BufMode mode);
 
         @endcode
 
         @see SetBufferIO()
     */
     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).
     /**
         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).
@@ -130,7 +178,7 @@ public:
     wxStreamBuffer(BufMode mode);
 
     /**
     wxStreamBuffer(BufMode mode);
 
     /**
-        Constructor.
+        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
 
         This method initializes the stream buffer with the data of the specified
         stream buffer. The new stream buffer has the same attributes, size, position
@@ -248,7 +296,7 @@ public:
 
         @see Write()
     */
 
         @see Write()
     */
-    Return value size_t Read(wxStreamBuffer* buffer);
+    size_t Read(wxStreamBuffer* buffer);
 
     /**
         Resets to the initial state variables concerning the buffer.
 
     /**
         Resets to the initial state variables concerning the buffer.
@@ -284,7 +332,7 @@ public:
 
         @see wxStreamBuffer(), Fixed(), Flushable()
     */
 
         @see wxStreamBuffer(), Fixed(), Flushable()
     */
-    void SetBufferIO(char* buffer_start, char* buffer_end);
+    void SetBufferIO(void* start, void* end, bool takeOwnership = false);
 
     /**
         Destroys or invalidates the previous IO buffer and allocates a new one of the
 
     /**
         Destroys or invalidates the previous IO buffer and allocates a new one of the
@@ -311,6 +359,7 @@ public:
 
     /**
         Returns the parent stream of the stream buffer.
 
     /**
         Returns the parent stream of the stream buffer.
+        @deprecated use GetStream() instead
     */
     wxStreamBase* Stream();
 
     */
     wxStreamBase* Stream();
 
@@ -420,14 +469,14 @@ public:
         This function returns a reference on the current object, so the user can
         test any states of the stream right away.
     */
         This function returns a reference on the current object, so the user can
         test any states of the stream right away.
     */
-    wxOutputStream Write(const void* buffer, size_t size);
+    virtual wxOutputStream& Write(const void* buffer, size_t size);
 
     /**
         Reads data from the specified input stream and stores them
         in the current stream. The data is read until an error is raised
         by one of the two streams.
     */
 
     /**
         Reads data from the specified input stream and stores them
         in the current stream. The data is read until an error is raised
         by one of the two streams.
     */
-    wxOutputStream Write(wxInputStream& stream_in);
+    wxOutputStream& Write(wxInputStream& stream_in);
 };
 
 
 };
 
 
@@ -670,10 +719,34 @@ class wxBufferedOutputStream : public wxFilterOutputStream
 {
 public:
     /**
 {
 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);
     */
     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.
     */
     /**
         Destructor. Calls Sync() and destroys the internal buffer.
     */
@@ -682,7 +755,7 @@ public:
     /**
         Calls Sync() and changes the stream position.
     */
     /**
         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.
 
     /**
         Flushes the buffer and calls Sync() on the parent stream.
@@ -728,6 +801,8 @@ public:
     /**
         Returns the first character in the input queue and removes it,
         blocking until it appears if necessary.
     /**
         Returns the first character in the input queue and removes it,
         blocking until it appears if necessary.
+
+        On success returns a value between 0 - 255; on end of file returns @c wxEOF.
     */
     int GetC();
 
     */
     int GetC();
 
@@ -750,7 +825,7 @@ public:
         @return This function returns a reference on the current object, so the
                 user can test any states of the stream right away.
     */
         @return This function returns a reference on the current object, so the
                 user can test any states of the stream right away.
     */
-    wxInputStream Read(void* buffer, size_t size);
+    virtual wxInputStream& Read(void* buffer, size_t size);
 
     /**
         Reads data from the input queue and stores it in the specified output stream.
 
     /**
         Reads data from the input queue and stores it in the specified output stream.
@@ -794,13 +869,13 @@ public:
 
         @return Returns the amount of bytes saved in the Write-Back buffer.
     */
 
         @return Returns the amount of bytes saved in the Write-Back buffer.
     */
-    size_t Ungetch(const char* buffer, size_t size);
+    size_t Ungetch(const void* buffer, size_t size);
 
     /**
         This function acts like the previous one except that it takes only one
         character: it is sometimes shorter to use than the generic function.
     */
 
     /**
         This function acts like the previous one except that it takes only one
         character: it is sometimes shorter to use than the generic function.
     */
-    Return value bool Ungetch(char c);
+    bool Ungetch(char c);
 };
 
 
 };