X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4cc4bfafe5a31cb96f35b3ec9b19fa2b0b3a4eef..27608f1130d577131674dc546b62ef11f75226d1:/interface/stream.h diff --git a/interface/stream.h b/interface/stream.h index d6fdad29d9..532ac2d28d 100644 --- a/interface/stream.h +++ b/interface/stream.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: stream.h -// Purpose: documentation for wxCountingOutputStream class +// Purpose: interface of wxCountingOutputStream // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license @@ -45,10 +45,11 @@ public: /** Returns the current size of the stream. */ - size_t GetSize(); + size_t GetSize() const; }; + /** @class wxBufferedInputStream @wxheader{stream.h} @@ -62,8 +63,7 @@ public: @library{wxbase} @category{streams} - @seealso - wxStreamBuffer, wxInputStream, wxBufferedOutputStream + @see wxStreamBuffer, wxInputStream, wxBufferedOutputStream */ class wxBufferedInputStream : public wxFilterInputStream { @@ -72,6 +72,7 @@ public: }; + /** @class wxStreamBuffer @wxheader{stream.h} @@ -80,8 +81,7 @@ public: @library{wxbase} @category{streams} - @seealso - wxStreamBase + @see wxStreamBase */ class wxStreamBuffer { @@ -95,7 +95,7 @@ public: buffer continues to be used, trying to call functions in the (destroyed) stream. It is advised to use this feature only in very local area of the program. - + @see @ref setbufferio() wxStreamBuffer:SetBufferIO */ wxStreamBuffer(wxStreamBase& stream, BufMode mode); @@ -119,7 +119,7 @@ public: @e flushable. This flag allows (when it has the @false value) or forbids (when it has the @true value) the stream buffer to resize dynamically the IO buffer. - + @see SetBufferIO() */ void Fixed(bool fixed); @@ -138,26 +138,26 @@ public: /** Returns a pointer on the end of the stream buffer. */ - void* GetBufferEnd(); + void* GetBufferEnd() const; /** Returns a pointer on the current position of the stream buffer. */ - void* GetBufferPos(); + void* GetBufferPos() const; /** Returns the size of the buffer. */ - size_t GetBufferSize(); + size_t GetBufferSize() const; /** Returns a pointer on the start of the stream buffer. */ - void* GetBufferStart(); + void* GetBufferStart() const; /** Gets a single char from the stream buffer. It acts like the Read call. - + @see Read() */ char GetChar(); @@ -170,16 +170,16 @@ public: /** Returns the current position (counted in bytes) in the stream buffer. */ - off_t GetIntPosition(); + off_t GetIntPosition() const; /** Returns the amount of bytes read during the last IO call to the parent stream. */ - size_t GetLastAccess(); + size_t GetLastAccess() const; /** Puts a single char to the stream buffer. - + @see Read() */ void PutChar(char c); @@ -189,7 +189,7 @@ public: Copies data to @e buffer. The function returns when @a buffer is full or when there isn't any more data in the current buffer. - + @see Write() */ size_t Read(void* buffer, size_t size); @@ -204,20 +204,20 @@ public: /** Changes the current position. @a mode may be one of the following: - + @b wxFromStart - + The position is counted from the start of the stream. - + @b wxFromCurrent - + The position is counted from the current position of the stream. - + @b wxFromEnd - + The position is counted from the end of the stream. - - @returns Upon successful completion, it returns the new offset as + + @return Upon successful completion, it returns the new offset as measured in bytes from the beginning of the stream. Otherwise, it returns wxInvalidOffset. */ @@ -227,7 +227,7 @@ public: /** Destroys or invalidates the previous IO buffer and allocates a new one of the specified size. - + @see Fixed(), Flushable() */ void SetBufferIO(char* buffer_start, char* buffer_end); @@ -255,11 +255,11 @@ public: the @e real position in the stream and from the internal buffer position: so it gives you the position in the @e real stream counted from the start of the stream. - - @returns Returns the current position in the stream if possible, + + @return Returns the current position in the stream if possible, wxInvalidOffset in the other case. */ - off_t Tell(); + off_t Tell() const; /** Truncates the buffer to the current position. @@ -278,6 +278,7 @@ public: }; + /** @class wxOutputStream @wxheader{stream.h} @@ -315,7 +316,7 @@ public: Write(). It may return 0 even if there is no error on the stream if it is only temporarily impossible to write to it. */ - size_t LastWrite(); + size_t LastWrite() const; /** Puts the specified character in the output queue and increments the @@ -325,20 +326,20 @@ public: /** Changes the stream current position. - + @param pos Offset to seek to. @param mode One of wxFromStart, wxFromEnd, wxFromCurrent. - - @returns The new stream position or wxInvalidOffset on error. + + @return The new stream position or wxInvalidOffset on error. */ off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart); /** Returns the current stream position. */ - off_t TellO(); + off_t TellO() const; //@{ /** @@ -352,6 +353,7 @@ public: }; + /** @class wxFilterClassFactory @wxheader{stream.h} @@ -376,8 +378,7 @@ public: @library{wxbase} @category{FIXME} - @seealso - wxFilterInputStream, wxFilterOutputStream, wxArchiveClassFactory, @ref + @see wxFilterInputStream, wxFilterOutputStream, wxArchiveClassFactory, @ref overview_wxarc "Archive formats such as zip" */ class wxFilterClassFactory : public wxObject @@ -390,7 +391,7 @@ public: can be a complete filename rather than just an extension. */ bool CanHandle(const wxString& protocol, - wxStreamProtocolType type = wxSTREAM_PROTOCOL); + wxStreamProtocolType type = wxSTREAM_PROTOCOL) const; /** A static member that finds a factory that can handle a given protocol, MIME @@ -407,19 +408,19 @@ public: /** GetFirst and GetNext can be used to enumerate the available factories. For example, to list them: - + GetFirst()/GetNext() return a pointer to a factory or @NULL if no more are available. They do not give away ownership of the factory. */ - static const wxFilterClassFactory* GetFirst(); - const wxFilterClassFactory* GetNext(); + static const wxFilterClassFactory* GetFirst() const; + const wxFilterClassFactory* GetNext() const; //@} /** Returns the wxFileSystem protocol supported by this factory. Equivalent to wxString(*GetProtcols()). */ - wxString GetProtocol(); + wxString GetProtocol() const; /** Returns the protocols, MIME types, HTTP encodings or file extensions @@ -427,7 +428,7 @@ public: not give away ownership of the array or strings. For example, to list the file extensions a factory supports: */ - const wxChar* const* GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL); + const wxChar* const* GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const; //@{ /** @@ -435,17 +436,17 @@ public: If the parent stream is passed as a pointer then the new filter stream takes ownership of it. If it is passed by reference then it does not. */ - wxFilterInputStream* NewStream(wxInputStream& stream); - wxFilterOutputStream* NewStream(wxOutputStream& stream); - wxFilterInputStream* NewStream(wxInputStream* stream); - wxFilterOutputStream* NewStream(wxOutputStream* stream); + wxFilterInputStream* NewStream(wxInputStream& stream) const; + const wxFilterOutputStream* NewStream(wxOutputStream& stream) const; + const wxFilterInputStream* NewStream(wxInputStream* stream) const; + const wxFilterOutputStream* NewStream(wxOutputStream* stream) const; //@} /** Remove the file extension of @a location if it is one of the file extensions handled by this factory. */ - wxString PopExtension(const wxString& location); + wxString PopExtension(const wxString& location) const; /** Adds this class factory to the list returned @@ -471,6 +472,7 @@ public: }; + /** @class wxFilterOutputStream @wxheader{stream.h} @@ -483,8 +485,7 @@ public: @library{wxbase} @category{streams} - @seealso - wxFilterClassFactory, wxFilterInputStream + @see wxFilterClassFactory, wxFilterInputStream */ class wxFilterOutputStream : public wxOutputStream { @@ -501,6 +502,7 @@ public: }; + /** @class wxFilterInputStream @wxheader{stream.h} @@ -514,8 +516,7 @@ public: @library{wxbase} @category{streams} - @seealso - wxFilterClassFactory, wxFilterOutputStream + @see wxFilterClassFactory, wxFilterOutputStream */ class wxFilterInputStream : public wxInputStream { @@ -532,6 +533,7 @@ public: }; + /** @class wxBufferedOutputStream @wxheader{stream.h} @@ -547,8 +549,7 @@ public: @library{wxbase} @category{streams} - @seealso - wxStreamBuffer, wxOutputStream + @see wxStreamBuffer, wxOutputStream */ class wxBufferedOutputStream : public wxFilterOutputStream { @@ -577,6 +578,7 @@ public: }; + /** @class wxInputStream @wxheader{stream.h} @@ -603,13 +605,13 @@ public: Returns @true if some data is available in the stream right now, so that calling Read() wouldn't block. */ - bool CanRead(); + bool CanRead() const; /** Returns @true after an attempt has been made to read past the end of the stream. */ - bool Eof(); + bool Eof() const; /** Returns the first character in the input queue and removes it, @@ -620,7 +622,7 @@ public: /** Returns the last number of bytes read. */ - size_t LastRead(); + size_t LastRead() const; /** Returns the first character in the input queue without removing it. @@ -631,8 +633,8 @@ public: /** Reads data from the input queue and stores it in the specified output stream. The data is read until an error is raised by one of the two streams. - - @returns This function returns a reference on the current object, so the + + @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); @@ -644,20 +646,20 @@ public: /** Changes the stream current position. - + @param pos Offset to seek to. @param mode One of wxFromStart, wxFromEnd, wxFromCurrent. - - @returns The new stream position or wxInvalidOffset on error. + + @return The new stream position or wxInvalidOffset on error. */ off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart); /** Returns the current stream position. */ - off_t TellI(); + off_t TellI() const; //@{ /** @@ -670,6 +672,7 @@ public: }; + /** @class wxStreamBase @wxheader{stream.h} @@ -681,8 +684,7 @@ public: @library{wxbase} @category{streams} - @seealso - wxStreamBuffer + @see wxStreamBuffer */ class wxStreamBase { @@ -699,51 +701,52 @@ public: /** This function returns the last error. - + @b wxSTREAM_NO_ERROR - + No error occurred. - + @b wxSTREAM_EOF - + An End-Of-File occurred. - + @b wxSTREAM_WRITE_ERROR - + A generic error occurred on the last write call. - + @b wxSTREAM_READ_ERROR - + A generic error occurred on the last read call. */ - wxStreamError GetLastError(); + wxStreamError GetLastError() const; /** Returns the length of the stream in bytes. If the length cannot be determined (this is always the case for socket streams for example), returns @c wxInvalidOffset. - This function is new since wxWidgets version 2.5.4 + + @since 2.5.4 */ - wxFileOffset GetLength(); + wxFileOffset GetLength() const; /** GetLength() This function returns the size of the stream. For example, for a file it is the size of the file. */ - size_t GetSize(); + size_t GetSize() const; /** Returns @true if no error occurred on the stream. - + @see GetLastError() */ - virtual bool IsOk(); + virtual bool IsOk() const; /** Returns @true if the streams supports seeking to arbitrary offsets. */ - bool IsSeekable(); + bool IsSeekable() const; /** Internal function. It is called when the stream wants to read data of the @@ -761,10 +764,11 @@ public: Internal function. Is is called when the stream needs to know the real position. */ - off_t OnSysTell(); + off_t OnSysTell() const; /** See OnSysRead(). */ size_t OnSysWrite(const void* buffer, size_t bufsize); }; +