InText Class Reference

#include <InStreams.h>

Inheritance diagram for InText:

StreamReader InConfig InStream< InFile, InText > InStream< InMemory, InText > InStream< InMessageQueue, InText > InStream< InFile, InConfig > InStream< InMemory, InConfig > InStream< InMessageQueue, InConfig > InTextFile InTextMemory InTextMessage InConfigFile InConfigMemory InConfigMessage List of all members.

Public Member Functions

 InText ()
void reset ()

Protected Member Functions

virtual bool isEof (const PhysicalInStream &stream) const
virtual void readChar (char &d, PhysicalInStream &stream)
virtual void readUChar (unsigned char &d, PhysicalInStream &stream)
virtual void readShort (short &d, PhysicalInStream &stream)
virtual void readUShort (unsigned short &d, PhysicalInStream &stream)
virtual void readInt (int &d, PhysicalInStream &stream)
virtual void readUInt (unsigned int &d, PhysicalInStream &stream)
virtual void readLong (long &d, PhysicalInStream &stream)
virtual void readULong (unsigned long &d, PhysicalInStream &stream)
virtual void readFloat (float &d, PhysicalInStream &stream)
virtual void readDouble (double &d, PhysicalInStream &stream)
virtual void readString (char *d, PhysicalInStream &stream)
virtual void readEndl (PhysicalInStream &stream)
virtual bool isWhitespace ()
virtual void skipWhitespace (PhysicalInStream &stream)
virtual void nextChar (PhysicalInStream &stream)
virtual void readData (void *p, int size, PhysicalInStream &stream)

Protected Attributes

char theChar

Private Attributes

char buf [200]
bool eof

Detailed Description

Formated reading of text data to be used in streams. The physical reading is done by PhysicalInStream derivates.

Definition at line 293 of file InStreams.h.


Constructor & Destructor Documentation

InText::InText (  )  [inline]

Default constructor

Definition at line 301 of file InStreams.h.

References reset().


Member Function Documentation

virtual bool InText::isEof ( const PhysicalInStream stream  )  const [inline, protected, virtual]

The function returns whether the end of stream has been reached. If this function returns false, "theChar" is valid, otherwise it is not.

Parameters:
stream The stream.
Returns:
End of stream reached?

Implements StreamReader.

Definition at line 320 of file InStreams.h.

References eof.

Referenced by InConfig::create(), InConfig::nextChar(), readEndl(), readString(), InConfig::skipComment(), InConfig::skipLine(), InConfig::skipWhitespace(), and skipWhitespace().

bool InText::isWhitespace (  )  [protected, virtual]

The function determines whether the current character is a whitespace.

Reimplemented in InConfig.

Definition at line 58 of file InStreams.cpp.

References theChar.

Referenced by InConfig::isWhitespace(), readString(), InConfig::skipWhitespace(), and skipWhitespace().

virtual void InText::nextChar ( PhysicalInStream stream  )  [inline, protected, virtual]

The function reads the next character from the stream.

Reimplemented in InConfig.

Definition at line 438 of file InStreams.h.

References eof, PhysicalInStream::getEof(), PhysicalInStream::readFromStream(), and theChar.

Referenced by InConfig::nextChar(), InTextMessage::readAll(), readEndl(), readString(), and skipWhitespace().

virtual void InText::readChar ( char &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a character from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 327 of file InStreams.h.

References buf, and readString().

Referenced by readData().

void InText::readData ( void *  p,
int  size,
PhysicalInStream stream 
) [protected, virtual]

The function reads a number of bytes from the file.

Parameters:
p The address the data is written to. Note that p must point to a memory area that is at least "size" bytes large.
size The number of bytes to be read.
stream The stream to read from.

Implements StreamReader.

Definition at line 52 of file InStreams.cpp.

References readChar().

virtual void InText::readDouble ( double &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a double from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 400 of file InStreams.h.

References buf, and readString().

virtual void InText::readEndl ( PhysicalInStream stream  )  [inline, protected, virtual]

reads the 'end of line' from a stream and this time we mean it

Parameters:
stream the stream to read from

Implements StreamReader.

Definition at line 420 of file InStreams.h.

References isEof(), nextChar(), and theChar.

virtual void InText::readFloat ( float &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a float from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 392 of file InStreams.h.

References buf, and readString().

virtual void InText::readInt ( int &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a int from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 359 of file InStreams.h.

References buf, int(), and readString().

virtual void InText::readLong ( long &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a long from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 376 of file InStreams.h.

References buf, and readString().

virtual void InText::readShort ( short &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a short from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 343 of file InStreams.h.

References buf, and readString().

void InText::readString ( char *  d,
PhysicalInStream stream 
) [protected, virtual]

The function reads a string from a stream. It skips all whitespace characters, and then reads a sequence of non-whitespace characters to a buffer, until it again recognizes a whitespace.

Parameters:
d The value that is read. Note that value must point to a memory area that is large enough to carry the string.
stream the stream to read from

Implements StreamReader.

Definition at line 37 of file InStreams.cpp.

References isEof(), isWhitespace(), nextChar(), skipWhitespace(), and theChar.

Referenced by InConfig::create(), readChar(), readDouble(), readFloat(), readInt(), readLong(), readShort(), readUChar(), readUInt(), readULong(), and readUShort().

virtual void InText::readUChar ( unsigned char &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a unsigned character from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 335 of file InStreams.h.

References buf, and readString().

virtual void InText::readUInt ( unsigned int &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a unsigned int from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 368 of file InStreams.h.

References buf, int(), and readString().

virtual void InText::readULong ( unsigned long &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a unsigned long from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 384 of file InStreams.h.

References buf, and readString().

virtual void InText::readUShort ( unsigned short &  d,
PhysicalInStream stream 
) [inline, protected, virtual]

reads a unsigned short from a stream

Parameters:
d the data to read from the stream
stream the stream to read from

Implements StreamReader.

Definition at line 351 of file InStreams.h.

References buf, and readString().

void InText::reset ( void   )  [inline]

Resets theChar to be able to use the same instance of InText or InConfig more than once.

Definition at line 306 of file InStreams.h.

References eof, and theChar.

Referenced by MessageQueue::handleAllMessages(), MessageQueue::handleSpecificMessages(), InText(), and InMessage::resetReadPosition().

void InText::skipWhitespace ( PhysicalInStream stream  )  [protected, virtual]

The function skips the whitespace.

Reimplemented in InConfig.

Definition at line 63 of file InStreams.cpp.

References isEof(), isWhitespace(), and nextChar().

Referenced by readString().


Member Data Documentation

char InText::buf[200] [private]

A buffer to convert read strings.

Definition at line 296 of file InStreams.h.

Referenced by readChar(), readDouble(), readFloat(), readInt(), readLong(), readShort(), readUChar(), readUInt(), readULong(), and readUShort().

bool InText::eof [private]

Definition at line 297 of file InStreams.h.

Referenced by isEof(), nextChar(), and reset().

char InText::theChar [protected]

The last character read.

Definition at line 312 of file InStreams.h.

Referenced by InConfig::isWhitespace(), isWhitespace(), nextChar(), InConfig::nextChar(), InTextMessage::readAll(), readEndl(), readString(), reset(), InConfig::skipComment(), InConfig::skipLine(), and InConfig::skipWhitespace().


The documentation for this class was generated from the following files:
Generated on Thu Dec 7 01:38:58 2006 for DT2005.panorama by  doxygen 1.4.7