API Guides > ConceptRT 3.x
TextReader Class Reference

Text reader. More...

Detailed Description

Text reader.

Public Member Methods

 TextReader (Stream &stream)
 Constructor. More...
 
bool Peek (Char8 &value, Int32 offset=0)
 Peek the current character without removing it. More...
 
bool Peek (BaseStaticString &value, Char8 separator= '\0')
 Peek the current character without removing it. More...
 
bool PeekToken (BaseStaticString &value)
 Peek token. More...
 
bool SkipChar ()
 Skip character. More...
 
bool SkipLine ()
 Skip line. More...
 
bool SkipWhiteSpace ()
 Skip white space. More...
 
bool Read (Char8 &value)
 Reads. More...
 
bool Read (BaseStaticString &value, Char8 separator= '\0', bool skipSeparator=false)
 Reads. More...
 
bool Read (BaseStaticString &value, bool &allDataRead, Char8 separator= '\0', bool skipSeparator=false)
 Reads. More...
 
bool Read (Stream &stream, Char8 separator= '\0', bool skipSeparator=false)
 Reads. More...
 
bool ReadToken (BaseStaticString &value)
 Reads a token. More...
 
bool ReadToken (BaseStaticString &value, bool &tokenCompleted)
 Reads a token. More...
 
Int32 ReadFixedLength (BaseStaticString &value, Int32 length)
 Reads a fixed length. More...
 
bool Read (bool &value)
 Reads. More...
 
bool Read (Int16 &value)
 Reads. More...
 
bool Read (Int32 &value)
 Reads. More...
 
bool Read (Float32 &value)
 Reads. More...
 
bool Read (Float64 &value)
 Reads. More...
 
bool EndOfStream () const
 Query if end of stream reached. More...
 
Int32 GetPosition () const
 Gets the position. More...
 
Int32 GetLineIndex () const
 Gets the line index. More...
 
Int32 GetLineCharacterIndex () const
 Gets the line character index. More...
 

Constructor & Destructor Documentation

TextReader ( Stream stream)

Constructor.

Parameters
stream[in,out] The stream.

Methods Documentation

bool EndOfStream ( ) const

Query if end of stream reached.

Returns
true if end of stream reached, false if not.
Int32 GetLineCharacterIndex ( ) const

Gets the line character index.

Returns
The line character index.
Int32 GetLineIndex ( ) const

Gets the line index.

Returns
The line index.
Int32 GetPosition ( ) const

Gets the position.

Returns
The position.
bool Peek ( Char8 value,
Int32  offset = 0 
)

Peek the current character without removing it.

Parameters
value[in,out] The returned character.
offset(optional) the offset.
Returns
True if success, false if it fails.
bool Peek ( BaseStaticString value,
Char8  separator = '\0' 
)

Peek the current character without removing it.

Parameters
value[in,out] The returned character.
separator(optional) the separator.
Returns
True if success, false if it fails. Failure may be caused by a too long data to peek (exceeded internal peek buffer of TextReaderBufferCapacity) or by an eof. Check the eof return variable.
RT Exceptions:
RT_ERROR_TEXT_READER_PEEK_FAILD
bool PeekToken ( BaseStaticString value)

Peek token.

Parameters
value[in,out] The returned token.
Returns
True if success, false if it fails (no data to peek).
RT Exceptions:
RT_ERROR_TEXT_READER_PEEK_FAILD
bool Read ( Char8 value)

Reads.

Parameters
value[in,out] The returned character.
Returns
true if it succeeds, false if it fails (eof reached).
bool Read ( BaseStaticString value,
Char8  separator = '\0',
bool  skipSeparator = false 
)

Reads.

Parameters
value[in,out] The returned character.
separator(optional) the separator. Default is '\0'.
skipSeparator(optional) skip separator after reading. Default is false.
Returns
true if successful (data found to the separator), false if end of stream.
RT Exceptions:
RT_ERROR_TEXT_READER_SEPARATOR_NOT_REACHED
bool Read ( BaseStaticString value,
bool &  allDataRead,
Char8  separator = '\0',
bool  skipSeparator = false 
)

Reads.

Parameters
value[in,out] The returned character.
allDataReadreturn true if all data has been read (the separator has been found or end of stream reached).
separator(optional) the separator. Default is '\0'.
skipSeparator(optional) skip separator after reading. Default is false.
Returns
true if successful (the entire data to the separator or a part of data limited to the size of the value string or to end of stream has been found), false if end of stream.
bool Read ( Stream stream,
Char8  separator = '\0',
bool  skipSeparator = false 
)

Reads.

Parameters
stream[in,out] the destination stream.
separator(optional) the separator. Default is '\0'.
skipSeparator(optional) skip separator after reading. Default is false.
Returns
true if data found to the separator, false if end of internal stream.
bool Read ( bool &  value)

Reads.

Parameters
value[in,out] The returned value.
Returns
true if it succeeds, false if it fails.
bool Read ( Int16 value)

Reads.

Parameters
value[in,out] The returned value.
Returns
true if it succeeds, false if it fails.
bool Read ( Int32 value)

Reads.

Parameters
value[in,out] The returned value.
Returns
true if it succeeds, false if it fails.
bool Read ( Float32 value)

Reads.

Parameters
value[in,out] The returned value.
Returns
true if it succeeds, false if it fails.
bool Read ( Float64 value)

Reads.

Parameters
value[in,out] The returned value.
Returns
true if it succeeds, false if it fails.
Int32 ReadFixedLength ( BaseStaticString value,
Int32  length 
)

Reads a fixed length.

Parameters
value[in,out] The returned string.
lengthThe length.
Returns
The fixed length.
bool ReadToken ( BaseStaticString value)

Reads a token.

Parameters
value[in,out] The return character.
Returns
true if it succeeds, false if it fails.
RT Exceptions:
RT_ERROR_TEXT_READER_READ_TOKEN_FAILD
bool ReadToken ( BaseStaticString value,
bool &  tokenCompleted 
)

Reads a token.

Parameters
value[in,out] The return character.
tokenCompleted(optional) return true if the token is entirely read.
Returns
true if it succeeds, false if it fails. Failure may be caused by a value string size to small to get all data of the complete token or by an eof. Check the eof return variable.
bool SkipChar ( )

Skip character.

Returns
true if it succeeds, false if it fails (eof reached).
bool SkipLine ( )

Skip line.

Returns
true if it succeeds, false if it fails (eof reached).
bool SkipWhiteSpace ( )

Skip white space.

Returns
true if it succeeds, false if it fails (eof reached).