Public Types | Public Member Functions | Protected Member Functions

zeus::TTextInputStream Class Reference

#include <TextInputStream.h>

Inheritance diagram for zeus::TTextInputStream:
zeus::TFilterInputStream zeus::TAbstractInputStream zeus::TZObject zeus::IInputStream zeus::IZUnknown zeus::IZUnknown

List of all members.

Public Types

enum  EEncodingType { etAutoDetect = 0, etISO_8859_1 = 1, etUTF_16 = 2 }
enum  EEndianType { etLittleEndian = 0, etBigEndian = 1 }

Public Member Functions

 TTextInputStream (IInputStream &rParentStream, EEncodingType eEncoding=etAutoDetect, EEndianType eEndian=etLittleEndian)
 TTextInputStream (const IString &rFileName, EEncodingType eEncoding=etAutoDetect, EEndianType eEndian=etLittleEndian)
Retval readLine (IString &rLine) const
Retval readText (IString &rText) const
Retval readText (IString &rText, Int iBlockSize, Int iExpectedStreamSize) const
EEndianType getEndianType () const
EEncodingType getEncodingType () const

Protected Member Functions

virtual ~TTextInputStream ()
virtual Int8 MQUALIFIER readInt8 (bool *pError) const
virtual Int16 MQUALIFIER readInt16 (bool *pError) const
virtual Int32 MQUALIFIER readInt32 (bool *pError) const
virtual Int64 MQUALIFIER readInt64 (bool *pError) const
virtual Uint16 MQUALIFIER readUint16 (bool *pError) const
virtual Uint32 MQUALIFIER readUint32 (bool *pError) const
virtual Uint64 MQUALIFIER readUint64 (bool *pError) const
virtual Float32 MQUALIFIER readFloat32 (bool *pError) const
virtual Float64 MQUALIFIER readFloat64 (bool *pError) const
virtual bool MQUALIFIER readBool (bool *pError) const
virtual Retval MQUALIFIER readArray (IByteArray &rData) const
virtual Retval MQUALIFIER readString (IString &rData) const
virtual Retval MQUALIFIER read (char *pBuffer, Int iBufferSize, Int &rValidSize) const
virtual Int MQUALIFIER readItem () const

Detailed Description

This is a special input stream filter to read text informations. The text can be read from any input stream or directly from a file. Following encodings are valid:


Member Enumeration Documentation

Text encoding type

Enumerator:
etAutoDetect 
etISO_8859_1 
etUTF_16 

Text endian type

Enumerator:
etLittleEndian 
etBigEndian 

Constructor & Destructor Documentation

TTextInputStream::TTextInputStream ( IInputStream rParentStream,
EEncodingType  eEncoding = etAutoDetect,
EEndianType  eEndian = etLittleEndian 
)

Creates a TextInputStream filter using any input stream as source

Parameters:
rParentStream: Source stream
eEncoding: Encoding of the text file (default is autodetection)
eEndian: endian type (little or big endian). Default is little endian
TTextInputStream::TTextInputStream ( const IString rFileName,
EEncodingType  eEncoding = etAutoDetect,
EEndianType  eEndian = etLittleEndian 
)

Creates a TextInputStream filter, using a file as source

Parameters:
rFileName: file name
eEncoding: Encoding of the text file (default is autodetection)
eEndian: endian type (little or big endian). Default is little endian
TTextInputStream::~TTextInputStream (  ) [protected, virtual]

Destroys the TextInputStream filter


Member Function Documentation

TTextInputStream::EEncodingType zeus::TTextInputStream::getEncodingType (  ) const [inline]

returns the encoding type

TTextInputStream::EEndianType zeus::TTextInputStream::getEndianType (  ) const [inline]

returns the endian type

Retval MQUALIFIER zeus::TTextInputStream::read ( char *  pBuffer,
Int  iBufferSize,
Int &  rValidSize 
) const [inline, protected, virtual]
See also:
IInputStream::read

Reimplemented from zeus::TFilterInputStream.

Retval MQUALIFIER zeus::TTextInputStream::readArray ( IByteArray rData ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

bool MQUALIFIER zeus::TTextInputStream::readBool ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Float32 MQUALIFIER zeus::TTextInputStream::readFloat32 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Float64 MQUALIFIER zeus::TTextInputStream::readFloat64 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Int16 MQUALIFIER zeus::TTextInputStream::readInt16 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Int32 MQUALIFIER zeus::TTextInputStream::readInt32 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Int64 MQUALIFIER zeus::TTextInputStream::readInt64 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Int8 MQUALIFIER zeus::TTextInputStream::readInt8 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Int MQUALIFIER zeus::TTextInputStream::readItem (  ) const [inline, protected, virtual]
See also:
IInputStream::readItem

Reimplemented from zeus::TFilterInputStream.

Retval TTextInputStream::readLine ( IString rLine ) const

Reads a text line into the string buffer

Parameters:
rLine: returns parameter containing a line of text
Retval MQUALIFIER zeus::TTextInputStream::readString ( IString rData ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Retval TTextInputStream::readText ( IString rText,
Int  iBlockSize,
Int  iExpectedStreamSize 
) const

Reads the whole text in one step

Parameters:
rText: Stream as text (Unicode or Ansi)
iBlockSize: Size of the block to read from stream. If you are using network communication you should use the packet size here
iExpectedStreamSize: Expected size of the file. If the expeced size is too small it will be increased dynamically, but this might slow down the performance.
Return values:
RET_NOERROR: Text read and returned
RET_REQUEST_FAILED: Could not open the stream
Retval zeus::TTextInputStream::readText ( IString rText ) const [inline]

returns the text of the whole buffer using some standard settings

Parameters:
rText: Stream as text (Unicode or Ansi)
Return values:
RET_NOERROR: Text read and returned
RET_REQUEST_FAILED: Could not open the stream
Uint16 MQUALIFIER zeus::TTextInputStream::readUint16 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Uint32 MQUALIFIER zeus::TTextInputStream::readUint32 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.

Uint64 MQUALIFIER zeus::TTextInputStream::readUint64 ( bool *  pError ) const [inline, protected, virtual]

Can not be used to read from text data

Reimplemented from zeus::TAbstractInputStream.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:41