Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/io/BlockOutStream.h>
Public Member Functions | |
BlockOutStream (int size=4096, int inc=256) | |
const char * | block (void) const |
int | size (void) const |
char * | detach (void) |
void | clear (void) |
void | setSize (int size) |
CString | toCString (void) |
String | toString (void) |
virtual int | write (const char *buffer, int size) |
virtual int | write (char byte) |
virtual int | flush (void) |
Public Member Functions inherited from OutStream | |
virtual | ~OutStream (void) |
virtual CString | lastErrorMessage (void) |
virtual bool | supportsANSI () const |
Additional Inherited Members | |
Static Public Attributes inherited from OutStream | |
static OutStream & | null = _null |
This class provides an out stream stocking output bytes in memory in a continuous blocks.
|
inline |
Build a new block output stream.
size | Initial size of the block. |
inc | Value of the increment for enlarging the block. |
|
inline |
Get a pointer on the start of the storage block. This pointer remains only valid until an output is performed on the stream.
References DynBlock::base().
Referenced by StringBuffer::copyString(), and StringBuffer::toCString().
Clear the block receiving bytes from output.
References DynBlock::reset().
Referenced by StringBuffer::reset().
|
inline |
Detach the block from the stream. After this call, the stream will perform no management on the memory block and the caller is responsible for deleting it. It is an error to perform more output after this call unless restart() is called.
References DynBlock::detach().
Referenced by BlockOutStream::toCString(), and StringBuffer::toString().
|
virtual |
Cause the current stream to dump its buffer to the medium.
Implements OutStream.
|
inline |
Change the size of the current block.
size | New size occupied by the block. |
References DynBlock::setSize(), and BlockOutStream::size().
|
inline |
Get the current size of stored bytes in this stream.
References DynBlock::size().
Referenced by StringBuffer::copyString(), StringBuffer::length(), BlockOutStream::setSize(), and BlockOutStream::write().
Convert the buffer to a CString object. (this object must not be used after this call and the caller is responsible for freeing the C string buffer).
References BlockOutStream::detach(), and BlockOutStream::write().
Convert the buffer to a String object.
References DynBlock::base(), and DynBlock::size().
|
virtual |
Write a byte to the stream.
byte | Byte to write. |
Reimplemented from OutStream.
References DynBlock::put().
|
virtual |
This is the main method of an output stream: the given buffer is put on the stream.
buffer | Byte buffer to write. |
size | Size of the byte buffer. |
Implements OutStream.
References DynBlock::put(), and BlockOutStream::size().
Referenced by BlockOutStream::toCString(), StringBuffer::toCString(), and StringBuffer::toString().