TC::Stream Class Reference
[IO Classes and Functions]

Base class for all streams implements all operators and prepares methods for reading and writing. More...

#include <TCStream.h>

Inheritance diagram for TC::Stream:

Inheritance graph
[legend]
Collaboration diagram for TC::Stream:

Collaboration graph
[legend]

List of all members.

Public Types

enum  StreamErrorFlags {
  error_none,
  error_streamopen,
  error_streamclose,
  error_streamdirection,
  error_last
}
 Enumeration which defines the TCStream error flags. More...
enum  StreamDirection {
  stream_dead,
  stream_read,
  stream_write,
  stream_readwrite
}
 enumeration which defines different stream directions More...
enum  StreamPosition {
  POSITION_SET,
  POSITION_CURRENT,
  POSITION_END
}

Public Member Functions

virtual ~Stream ()
virtual sint32 GetStatus () const =0
virtual void ResetStatus ()=0
 Reset the error flag to error_none.
virtual bool Error () const =0
virtual bool IsOk () const =0
virtual void EnableDisplayErrorMessages (bool displ)=0
 Tell the stream if he should write out error messages or not.
virtual bool SetPosition (uint32, StreamPosition pos)=0
virtual uint32 GetPosition () const =0
virtual uint32 ReadBytes (uint32 nBytes, void *bytes)=0
 Methode for reading the bytes from the stream has to be implemented in each derived class.
virtual uint32 WriteBytes (uint32 nBytes, const void *bytes)=0
 Methode for writing the bytes to the stream has to be implemented in each derived class.
virtual uint32 Read (sint16 &val)=0
 Methode for reading one signed 16bit integer from the stream.
virtual uint32 Read (uint16 &val)=0
 Methode for reading one unsigned 16bit integer from the stream.
virtual uint32 Read (sint32 &val)=0
 Methode for reading one signed int 32bit integer the stream.
virtual uint32 Read (uint32 &val)=0
 Methode for reading one unsigned 32bit integer from the stream.
virtual uint32 Read (sint64 &val)=0
 Methode for reading one signed 64bit integer from the stream.
virtual uint32 Read (uint64 &val)=0
 Methode for reading one unsigned 64bit integer from the stream.
virtual uint32 Read (float &val)=0
 Methode for reading one float from the stream.
virtual uint32 Read (double &val)=0
 Methode for reading one double from the stream.
virtual uint32 Read (char *val)=0
 Methode for reading one string from the stream.
virtual uint32 Read (std::string &val)=0
 Methode for reading one std::string from the stream.
virtual uint32 Read (char &val)=0
 Methode for reading one char from the stream.
virtual uint32 Read (uchar &val)=0
 Methode for reading one unsigned char from the stream.
virtual uint32 Write (sint16 val)=0
 Methode for writing one signed 16bit integer to the stream.
virtual uint32 Write (uint16 val)=0
 Methode for writing one unsigned 16bit integer to the stream.
virtual uint32 Write (sint32 val)=0
 Methode for writing one signed 32bit integer to the stream.
virtual uint32 Write (uint32 val)=0
 Methode for writing one unsigned 32bit integer to the stream.
virtual uint32 Write (sint64 val)=0
 Methode for writing one signed 64bit integer to the stream.
virtual uint32 Write (uint64 val)=0
 Methode for writing one unsigned 64bit integer to the stream.
virtual uint32 Write (float val)=0
 Methode for writing one float to the stream.
virtual uint32 Write (double val)=0
 Methode for writing one double to the stream.
virtual uint32 Write (const char *val)=0
 Methode for writing one string to the stream.
virtual uint32 Write (const std::string &val)=0
 Methode for writing one std::string to the stream.
virtual uint32 Write (char val)=0
 Methode for writing one signed char to the stream.
virtual uint32 Write (uchar val)=0
 Methode for writing one unsigned char to the stream.
virtual uint32 WriteEndOfLine ()=0
 Writes the end of line characters if needed for the stream.
virtual uint32 WriteSpace ()=0
 Writes space to the stream if needed for the stream needed for separating words or numbers.
virtual void Flush ()=0
 flushes the stream if needed
virtual void CloseStream ()=0
 Closes the stream and sets the streamdirection to stream_dead.


Detailed Description

Base class for all streams implements all operators and prepares methods for reading and writing.

Definition at line 61 of file TCStream.h.


Member Enumeration Documentation

Enumeration which defines the TCStream error flags.

Enumerator:
error_none  no error happened
error_streamopen  Error openening the stream.
error_streamclose  Error closing the stream.
error_streamdirection  Using wrong stream direction.
error_last  Last error flag.

Definition at line 67 of file TCStream.h.

enumeration which defines different stream directions

Enumerator:
stream_dead  stream is not ready for read or write (not open or allready closed
stream_read  stream is used for reading
stream_write  stream is used for writing
stream_readwrite  stream is used for reading and writing

Definition at line 84 of file TCStream.h.

Enumerator:
POSITION_SET 
POSITION_CURRENT 
POSITION_END 

Definition at line 117 of file TCStream.h.


Constructor & Destructor Documentation

virtual TC::Stream::~Stream (  )  [inline, virtual]

Definition at line 97 of file TCStream.h.


Member Function Documentation

virtual sint32 TC::Stream::GetStatus (  )  const [pure virtual]

Returns:
the error flag defined in TCStream::StreamErrorFlags

virtual void TC::Stream::ResetStatus (  )  [pure virtual]

Reset the error flag to error_none.

virtual bool TC::Stream::Error (  )  const [pure virtual]

Returns:
False if no error happend else true

virtual bool TC::Stream::IsOk (  )  const [pure virtual]

Returns:
True if no error happend else false

virtual void TC::Stream::EnableDisplayErrorMessages ( bool  displ  )  [pure virtual]

Tell the stream if he should write out error messages or not.

Parameters:
displ true or false fro displaying error messages

virtual bool TC::Stream::SetPosition ( uint32  ,
StreamPosition  pos 
) [pure virtual]

virtual uint32 TC::Stream::GetPosition (  )  const [pure virtual]

virtual uint32 TC::Stream::ReadBytes ( uint32  nBytes,
void *  bytes 
) [pure virtual]

Methode for reading the bytes from the stream has to be implemented in each derived class.

Parameters:
nBytes number of bytes to read
bytes where to store the data which should be read

virtual uint32 TC::Stream::WriteBytes ( uint32  nBytes,
const void *  bytes 
) [pure virtual]

Methode for writing the bytes to the stream has to be implemented in each derived class.

Parameters:
nBytes number of bytes to written
bytes where the bytes are stored which should be written

virtual uint32 TC::Stream::Read ( sint16 val  )  [pure virtual]

Methode for reading one signed 16bit integer from the stream.

Parameters:
val the short which should store the short

virtual uint32 TC::Stream::Read ( uint16 val  )  [pure virtual]

Methode for reading one unsigned 16bit integer from the stream.

Parameters:
val the short which should store the short

virtual uint32 TC::Stream::Read ( sint32 val  )  [pure virtual]

Methode for reading one signed int 32bit integer the stream.

Parameters:
val the int which should store the int

virtual uint32 TC::Stream::Read ( uint32 val  )  [pure virtual]

Methode for reading one unsigned 32bit integer from the stream.

Parameters:
val the int which should store the int

virtual uint32 TC::Stream::Read ( sint64 val  )  [pure virtual]

Methode for reading one signed 64bit integer from the stream.

Parameters:
val the long which should store the long

virtual uint32 TC::Stream::Read ( uint64 val  )  [pure virtual]

Methode for reading one unsigned 64bit integer from the stream.

Parameters:
val the long which should store the long

virtual uint32 TC::Stream::Read ( float &  val  )  [pure virtual]

Methode for reading one float from the stream.

Parameters:
val the float which should store the float

virtual uint32 TC::Stream::Read ( double &  val  )  [pure virtual]

Methode for reading one double from the stream.

Parameters:
val the double which should store the double

virtual uint32 TC::Stream::Read ( char *  val  )  [pure virtual]

Methode for reading one string from the stream.

Parameters:
val the string which should store the string

virtual uint32 TC::Stream::Read ( std::string &  val  )  [pure virtual]

Methode for reading one std::string from the stream.

Parameters:
val the string which should store the string

virtual uint32 TC::Stream::Read ( char &  val  )  [pure virtual]

Methode for reading one char from the stream.

Parameters:
val the char which should store the char

virtual uint32 TC::Stream::Read ( uchar val  )  [pure virtual]

Methode for reading one unsigned char from the stream.

Parameters:
val the char which should store the char

virtual uint32 TC::Stream::Write ( sint16  val  )  [pure virtual]

Methode for writing one signed 16bit integer to the stream.

Parameters:
val the short which to write

virtual uint32 TC::Stream::Write ( uint16  val  )  [pure virtual]

Methode for writing one unsigned 16bit integer to the stream.

Parameters:
val the short which to write

virtual uint32 TC::Stream::Write ( sint32  val  )  [pure virtual]

Methode for writing one signed 32bit integer to the stream.

Parameters:
val the int which to write

virtual uint32 TC::Stream::Write ( uint32  val  )  [pure virtual]

Methode for writing one unsigned 32bit integer to the stream.

Parameters:
val the int which to write

virtual uint32 TC::Stream::Write ( sint64  val  )  [pure virtual]

Methode for writing one signed 64bit integer to the stream.

Parameters:
val the long which to write

virtual uint32 TC::Stream::Write ( uint64  val  )  [pure virtual]

Methode for writing one unsigned 64bit integer to the stream.

Parameters:
val the long which to write

virtual uint32 TC::Stream::Write ( float  val  )  [pure virtual]

Methode for writing one float to the stream.

Parameters:
val the float which to write

virtual uint32 TC::Stream::Write ( double  val  )  [pure virtual]

Methode for writing one double to the stream.

Parameters:
val the double which to write

virtual uint32 TC::Stream::Write ( const char *  val  )  [pure virtual]

Methode for writing one string to the stream.

Parameters:
val the string which to write

virtual uint32 TC::Stream::Write ( const std::string &  val  )  [pure virtual]

Methode for writing one std::string to the stream.

Parameters:
val the string which to write

virtual uint32 TC::Stream::Write ( char  val  )  [pure virtual]

Methode for writing one signed char to the stream.

Parameters:
val the char which to write

virtual uint32 TC::Stream::Write ( uchar  val  )  [pure virtual]

Methode for writing one unsigned char to the stream.

Parameters:
val the char which to write

virtual uint32 TC::Stream::WriteEndOfLine (  )  [pure virtual]

Writes the end of line characters if needed for the stream.

virtual uint32 TC::Stream::WriteSpace (  )  [pure virtual]

Writes space to the stream if needed for the stream needed for separating words or numbers.

virtual void TC::Stream::Flush (  )  [pure virtual]

flushes the stream if needed

virtual void TC::Stream::CloseStream (  )  [pure virtual]

Closes the stream and sets the streamdirection to stream_dead.


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

Copyright (c) Thomas Goessler 2003 - 2008