#include <fstream.h>
Public Types | |
Public Member Functions | |
BaseFileStream (const BaseFileStream &other) | |
BaseFileStream (t_streamType streamType, FileSysData *fsdata) | |
virtual FalconData * | clone () const |
Clones the stream. | |
virtual bool | close () |
Close target stream. | |
virtual bool | errorDescription (::Falcon::String &description) const |
virtual bool | get (uint32 &chr) |
Gets next character from the stream. | |
const FileSysData * | getFileSysData () const |
virtual int64 | lastError () 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_timeout, const Sys::SystemData *sysData=0) |
Return 1 if read available, 0 if not available, -1 on error;. | |
virtual bool | readString (String &content, uint32 size) |
Gets a whole string from the stream. | |
void | setError (int64 errorCode) |
Set the error. | |
virtual int64 | tell () |
virtual bool | truncate (int64 pos=-1) |
virtual int32 | write (const void *buffer, int32 size) |
Write to the target stream. | |
virtual int32 | writeAvailable (int32 msecs_timeout, 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 | ~BaseFileStream () |
Protected Member Functions | |
virtual int64 | seek (int64 pos, Stream::e_whence whence) |
Protected Attributes | |
FileSysData * | m_fsData |
The BaseFileStream class is the base for the system-specific stream handlers. It provides an interface to the system functions that work with system streams, as files or standard streams.
Falcon::BaseFileStream::BaseFileStream | ( | t_streamType | streamType, | |
FileSysData * | fsdata | |||
) | [inline] |
Falcon::BaseFileStream::BaseFileStream | ( | const BaseFileStream & | other | ) |
virtual Falcon::BaseFileStream::~BaseFileStream | ( | ) | [virtual] |
virtual FalconData* Falcon::BaseFileStream::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.
virtual bool Falcon::BaseFileStream::close | ( | ) | [virtual] |
virtual bool Falcon::BaseFileStream::errorDescription | ( | ::Falcon::String & | description | ) | const [virtual] |
Reimplemented from Falcon::Stream.
virtual bool Falcon::BaseFileStream::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.
const FileSysData* Falcon::BaseFileStream::getFileSysData | ( | ) | const [inline] |
virtual int64 Falcon::BaseFileStream::lastError | ( | ) | const [virtual] |
Reimplemented from Falcon::Stream.
virtual bool Falcon::BaseFileStream::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.
Reimplemented in Falcon::OutputStream.
virtual int32 Falcon::BaseFileStream::readAvailable | ( | int32 | msecs_timeout, | |
const Sys::SystemData * | sysData = 0 | |||
) | [virtual] |
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.
virtual int64 Falcon::BaseFileStream::seek | ( | int64 | pos, | |
Stream::e_whence | whence | |||
) | [protected, virtual] |
Reimplemented from Falcon::Stream.
void Falcon::BaseFileStream::setError | ( | int64 | errorCode | ) |
Set the error.
Subclasses may use this to set error across platforms. The status is not changed.
virtual int64 Falcon::BaseFileStream::tell | ( | ) | [virtual] |
Reimplemented from Falcon::Stream.
virtual bool Falcon::BaseFileStream::truncate | ( | int64 | pos = -1 |
) | [virtual] |
Write to the target stream.
Reimplemented from Falcon::Stream.
Reimplemented in Falcon::InputStream.
virtual int32 Falcon::BaseFileStream::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.
virtual bool Falcon::BaseFileStream::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.
FileSysData* Falcon::BaseFileStream::m_fsData [protected] |