#include <stringstream.h>
Public Member Functions | |
uint32 | allocated () const |
virtual FalconData * | clone () const |
Clones the stream. | |
virtual bool | close () |
Close target stream. | |
byte * | closeToBuffer () |
Gets the phisical memory created by this object. | |
CoreString * | closeToCoreString () |
Gets the phisical memory created by this object and turns it into a newly created garbage collected string. | |
bool | closeToString (String &target) |
Gets the phisical memory created by this object and turns it into a string. | |
String * | closeToString () |
Gets the phisical memory created by this object and turns it into a string. | |
byte * | data () const |
virtual bool | errorDescription (::Falcon::String &description) const |
virtual void | gcMark (uint32 mark) |
virtual bool | get (uint32 &chr) |
Gets next character from the stream. | |
CoreString * | getCoreString () const |
Gets a string copying the content of the stream, allocating in the garbage the target string. | |
String * | getString () const |
Gets a string copying the content of the stream, newly allocating the target string. | |
void | getString (String &target) const |
Gets a string copying the content of the stream. | |
virtual int64 | lastError () const |
uint32 | length () const |
virtual bool | put (uint32 chr) |
Writes a character on the stream. | |
virtual int32 | read (void *buffer, int32 size) |
Reads from target stream. | |
virtual int32 | readAvailable (int32 msecs, const Sys::SystemData *sysData=0) |
Determines if the stream can be read, possibly with a given timeout. | |
virtual bool | readString (String &dest, uint32 size) |
Gets a whole string from the stream. | |
StringStream (const StringStream &strbuf) | |
StringStream (const String &strbuf) | |
StringStream (int32 size=0) | |
virtual int64 | tell () |
void | transfer (StringStream &strbuf) |
Transfers a string stream buffer into this one. | |
virtual bool | truncate (int64 pos=-1) |
virtual int32 | write (const void *buffer, int32 size) |
Write to the target stream. | |
virtual int32 | writeAvailable (int32 msecs, const Sys::SystemData *sysData=0) |
Determines if the stream can be written, possibly with a given timeout. | |
virtual bool | writeString (const String &source, uint32 begin=0, uint32 end=csh::npos) |
Writes a string on the stream. | |
virtual | ~StringStream () |
Protected Member Functions | |
bool | detachBuffer () |
virtual int64 | seek (int64 pos, e_whence whence) |
void | setBuffer (const char *source, int size=-1) |
void | setBuffer (const String &source) |
Protected Attributes | |
uint32 | m_pos |
Falcon::StringStream::StringStream | ( | int32 | size = 0 |
) |
Falcon::StringStream::StringStream | ( | const String & | strbuf | ) |
Falcon::StringStream::StringStream | ( | const StringStream & | strbuf | ) |
virtual Falcon::StringStream::~StringStream | ( | ) | [virtual] |
uint32 Falcon::StringStream::allocated | ( | ) | const |
virtual FalconData* Falcon::StringStream::clone | ( | ) | const [virtual] |
Clones the stream.
This version returns 0 and sets error to unsupported; subclasses must properly clone the stream.
Reimplemented from Falcon::Stream.
Reimplemented in Falcon::ROStringStream.
virtual bool Falcon::StringStream::close | ( | ) | [virtual] |
byte* Falcon::StringStream::closeToBuffer | ( | ) |
Gets the phisical memory created by this object.
This version of the method retreives the internally allocated buffer and empties this StringStream.
The returned buffer must be de-allocated using Falcon::memFree()
CoreString* Falcon::StringStream::closeToCoreString | ( | ) |
Gets the phisical memory created by this object and turns it into a newly created garbage collected string.
bool Falcon::StringStream::closeToString | ( | String & | target | ) |
Gets the phisical memory created by this object and turns it into a string.
This version of the method stores the phisical memory in the given string, and configures it as a single byte memory buffer string.
String* Falcon::StringStream::closeToString | ( | ) |
Gets the phisical memory created by this object and turns it into a string.
The memory that has been created by the stream-like operations is directly passed into a string object, in a very efficient way; as a result, the buffer in this object is transferred as-is into the returned string, and this object becomes unuseable (closed).
If the stream has already been closed, the function will return 0.
byte* Falcon::StringStream::data | ( | ) | const |
bool Falcon::StringStream::detachBuffer | ( | ) | [protected] |
virtual bool Falcon::StringStream::errorDescription | ( | ::Falcon::String & | description | ) | const [virtual] |
Reimplemented from Falcon::Stream.
virtual void Falcon::StringStream::gcMark | ( | uint32 | mark | ) | [inline, virtual] |
Reimplemented from Falcon::Stream.
virtual bool Falcon::StringStream::get | ( | uint32 & | chr | ) | [virtual] |
Gets next character from the stream.
Subclasses must manage both stateful transcoding and properly popping readahead characters from the buffer.
Implements Falcon::Stream.
CoreString* Falcon::StringStream::getCoreString | ( | ) | const [inline] |
Gets a string copying the content of the stream, allocating in the garbage the target string.
The memory that is currently held in this object is copied in a string. Read-write operations can then continue, and the status of the object is not changed.
String* Falcon::StringStream::getString | ( | ) | const [inline] |
Gets a string copying the content of the stream, newly allocating the target string.
The memory that is currently held in this object is copied in a string. Read-write operations can then continue, and the status of the object is not changed.
void Falcon::StringStream::getString | ( | String & | target | ) | const |
Gets a string copying the content of the stream.
The memory that is currently held in this object is copied in a string. Read-write operations can then continue, and the status of the object is not changed.
target | The string where the buffer is copied. |
virtual int64 Falcon::StringStream::lastError | ( | ) | const [virtual] |
Reimplemented from Falcon::Stream.
uint32 Falcon::StringStream::length | ( | ) | const |
virtual bool Falcon::StringStream::put | ( | uint32 | chr | ) | [virtual] |
Writes a character on the stream.
chr | the character to write. |
Reimplemented from Falcon::Stream.
Reads from target stream.
buffer | the buffer where read data will be stored. | |
size | the amount of bytes to read |
Reimplemented from Falcon::Stream.
virtual int32 Falcon::StringStream::readAvailable | ( | int32 | msecs_timeout, | |
const Sys::SystemData * | sysData = 0 | |||
) | [virtual] |
Determines if the stream can be read, possibly with a given timeout.
If sysData is not zero, it will be used to honor concurrent interrupt requests.
Reimplemented from Falcon::Stream.
Gets a whole string from the stream.
This is implemented by iteratively calling get( uint32 ). The caller should provide a string with enough space already reserved, if possible, to make operations more efficient.
The target string may be shorter than required if the stream ends before all the characters are read, or in case of error.
Reimplemented from Falcon::Stream.
Reimplemented from Falcon::Stream.
void Falcon::StringStream::setBuffer | ( | const char * | source, | |
int | size = -1 | |||
) | [protected] |
void Falcon::StringStream::setBuffer | ( | const String & | source | ) | [protected] |
virtual int64 Falcon::StringStream::tell | ( | ) | [virtual] |
Reimplemented from Falcon::Stream.
void Falcon::StringStream::transfer | ( | StringStream & | strbuf | ) |
Transfers a string stream buffer into this one.
The original buffer is emptied, and this buffer aqcuires the same status, allocation and contents of the other one.
virtual bool Falcon::StringStream::truncate | ( | int64 | pos = -1 |
) | [virtual] |
Write to the target stream.
Reimplemented from Falcon::Stream.
Reimplemented in Falcon::ROStringStream.
virtual int32 Falcon::StringStream::writeAvailable | ( | int32 | msecs_timeout, | |
const Sys::SystemData * | sysData = 0 | |||
) | [virtual] |
Determines if the stream can be written, possibly with a given timeout.
If sysData is not zero, it will be used to honor concurrent interrupt requests.
Reimplemented from Falcon::Stream.
Reimplemented in Falcon::ROStringStream.
virtual bool Falcon::StringStream::writeString | ( | const String & | source, | |
uint32 | begin = 0 , |
|||
uint32 | end = csh::npos | |||
) | [virtual] |
Writes a string on the stream.
Encoding range is in [begin, end), that is, the last character encoded is end - 1.
source | the string that must be encoded | |
begin | first character from which to encode | |
end | one past last character to encode (can be safely greater than string lenght() ) |
Reimplemented from Falcon::Stream.
uint32 Falcon::StringStream::m_pos [protected] |