Elm
1.0
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 elm::io::OutStream | |
virtual | ~OutStream (void) |
virtual CString | lastErrorMessage (void) |
Additional Inherited Members | |
Static Public Attributes inherited from elm::io::OutStream | |
static OutStream & | null = _null |
This class provides an out stream stocking output bytes in memory in a continuous blocks.
elm::io::BlockOutStream::BlockOutStream | ( | int | size = 4096 , |
int | inc = 256 |
||
) |
Build a new block output stream.
size | Initial size of the block. |
inc | Value of the increment for enlarging the block. |
char * elm::io::BlockOutStream::block | ( | void | ) | const |
Get a pointer on the start of the storage block. This pointer remains only valid until an output is performed on the stream.
References elm::block::DynBlock::base().
Referenced by elm::StringBuffer::copyString().
void elm::io::BlockOutStream::clear | ( | void | ) |
Clear the block receiving bytes from output.
References elm::block::DynBlock::reset().
char * elm::io::BlockOutStream::detach | ( | void | ) |
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 elm::block::DynBlock::detach().
Referenced by toCString(), and elm::StringBuffer::toString().
|
virtual |
Cause the current stream to dump its buffer to the medium.
Implements elm::io::OutStream.
void elm::io::BlockOutStream::setSize | ( | int | size | ) |
Change the size of the current block.
size | New size occupied by the block. |
References elm::block::DynBlock::setSize().
Referenced by elm::StringBuffer::reset().
int elm::io::BlockOutStream::size | ( | void | ) | const |
Get the current size of stored bytes in this stream.
References elm::block::DynBlock::size().
Referenced by elm::StringBuffer::copyString(), and elm::StringBuffer::length().
CString elm::io::BlockOutStream::toCString | ( | void | ) |
String elm::io::BlockOutStream::toString | ( | void | ) |
Convert the buffer to a String object.
References elm::block::DynBlock::base(), and elm::block::DynBlock::size().
|
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 elm::io::OutStream.
References elm::block::DynBlock::put().
Referenced by elm::StringBuffer::StringBuffer(), toCString(), and elm::StringBuffer::toString().
|
virtual |
Write a byte to the stream.
byte | Byte to write. |
Reimplemented from elm::io::OutStream.
References elm::block::DynBlock::put().