#include </home/zeitlin/src/wx/github/interface/wx/stream.h>
wxOutputStream is an abstract base class which may not be used directly.
It is the base class of all streams which provide a Write() function, i.e. which can be used to output data (e.g. to a file, to a socket, etc).
If you want to create your own output stream, you'll need to derive from this class and implement the protected OnSysWrite() function only.
Public Member Functions | |
wxOutputStream () | |
Creates a dummy wxOutputStream object. | |
virtual | ~wxOutputStream () |
Destructor. | |
virtual bool | Close () |
Closes the stream, returning false if an error occurs. | |
virtual size_t | LastWrite () const |
Returns the number of bytes written during the last Write(). | |
void | PutC (char c) |
Puts the specified character in the output queue and increments the stream position. | |
virtual wxFileOffset | SeekO (wxFileOffset pos, wxSeekMode mode=wxFromStart) |
Changes the stream current position. | |
virtual wxFileOffset | TellO () const |
Returns the current stream position. | |
virtual wxOutputStream & | Write (const void *buffer, size_t size) |
Writes up to the specified amount of bytes using the data of buffer. | |
wxOutputStream & | Write (wxInputStream &stream_in) |
Reads data from the specified input stream and stores them in the current stream. | |
Protected Member Functions | |
size_t | OnSysWrite (const void *buffer, size_t bufsize) |
Internal function. |
wxOutputStream::wxOutputStream | ( | ) |
Creates a dummy wxOutputStream object.
virtual wxOutputStream::~wxOutputStream | ( | ) | [virtual] |
Destructor.
virtual bool wxOutputStream::Close | ( | ) | [virtual] |
Closes the stream, returning false if an error occurs.
The stream is closed implicitly in the destructor if Close() is not called explicitly.
If this stream wraps another stream or some other resource such as a file, then the underlying resource is closed too if it is owned by this stream, or left open otherwise.
Reimplemented in wxArchiveOutputStream, wxTarOutputStream, and wxZipOutputStream.
virtual size_t wxOutputStream::LastWrite | ( | ) | const [virtual] |
Returns the number of bytes written during the last 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 wxOutputStream::OnSysWrite | ( | const void * | buffer, |
size_t | bufsize | ||
) | [protected] |
Internal function.
It is called when the stream wants to write data of the specified size bufsize into the given buffer.
It should return the size that was actually wrote (which maybe zero if bufsize is zero or if an error occurred; in this last case the internal variable m_lasterror
should be appropriately set).
void wxOutputStream::PutC | ( | char | c | ) |
Puts the specified character in the output queue and increments the stream position.
virtual wxFileOffset wxOutputStream::SeekO | ( | wxFileOffset | pos, |
wxSeekMode | mode = wxFromStart |
||
) | [virtual] |
Changes the stream current position.
pos | Offset to seek to. |
mode | One of wxFromStart, wxFromEnd, wxFromCurrent. |
Reimplemented in wxBufferedOutputStream.
virtual wxFileOffset wxOutputStream::TellO | ( | ) | const [virtual] |
Returns the current stream position.
virtual wxOutputStream& wxOutputStream::Write | ( | const void * | buffer, |
size_t | size | ||
) | [virtual] |
Writes up to the specified amount of bytes using the data of buffer.
Note that not all data can always be written so you must check the number of bytes really written to the stream using LastWrite() when this function returns.
In some cases (for example a write end of a pipe which is currently full) it is even possible that there is no errors and zero bytes have been written. This function returns a reference on the current object, so the user can test any states of the stream right away.
wxOutputStream& wxOutputStream::Write | ( | wxInputStream & | stream_in | ) |
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.