Falcon::BaseFileStream Class Reference

File stream base class. More...

#include <fstream.h>

Inheritance diagram for Falcon::BaseFileStream:

Inheritance graph
[legend]

List of all members.

Public Types


Public Member Functions

 BaseFileStream (const BaseFileStream &other)
 BaseFileStream (t_streamType streamType, FileSysData *fsdata)
virtual FalconDataclone () 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 FileSysDatagetFileSysData () 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

FileSysDatam_fsData


Detailed Description

File stream base class.

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.


Member Enumeration Documentation

System attributes.

Enumerator:
e_aOtherRead 
e_aOtherWrite 
e_aOtherExecute 
e_aGroupRead 
e_aGroupWrite 
e_aGroupExecute 
e_aUserRead 
e_aUserWrite 
e_aUserExecute 
e_aAll 
e_aReadOnly 
e_aHidden 

Open mode.

Enumerator:
e_omReadWrite 
e_omReadOnly 
e_omWriteOnly 

Share mode.

Enumerator:
e_smExclusive 
e_smShareRead 
e_smShareFull 


Constructor & Destructor Documentation

Falcon::BaseFileStream::BaseFileStream ( t_streamType  streamType,
FileSysData fsdata 
) [inline]

Falcon::BaseFileStream::BaseFileStream ( const BaseFileStream other  ) 

virtual Falcon::BaseFileStream::~BaseFileStream (  )  [virtual]


Member Function Documentation

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]

Close target stream.

Reimplemented from Falcon::Stream.

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.

Returns:
true if the character is available, false on stream end or error.

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.

Parameters:
chr the character to write.
Returns:
true success, false on stream error.

Reimplemented from Falcon::Stream.

virtual int32 Falcon::BaseFileStream::read ( void *  buffer,
int32  size 
) [virtual]

Reads from target stream.

Parameters:
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]

Return 1 if read available, 0 if not available, -1 on error;.

Reimplemented from Falcon::Stream.

virtual bool Falcon::BaseFileStream::readString ( String target,
uint32  size 
) [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.

Returns:
true if some characters are available, false on stream end or 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]

Reimplemented from Falcon::Stream.

Reimplemented in Falcon::StdStream.

virtual int32 Falcon::BaseFileStream::write ( const void *  buffer,
int32  size 
) [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.

Parameters:
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() )
Returns:
true success, false on stream error.

Reimplemented from Falcon::Stream.


Member Data Documentation


The documentation for this class was generated from the following file:

Generated on Mon Oct 19 10:11:32 2009 for Falcon_Core by  doxygen 1.5.8