Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# InText Class Reference

Formated reading of text data to be used in streams. More...

`#include <InStreams.h>`

Inheritance diagram for InText:

[legend]
Collaboration diagram for InText:

[legend]
List of all members.

## Public Member Functions
| InText ()
| Default constructor.
void | reset ()
| Resets theChar to be able to use the same instance of InText or InConfig more than once.
## Protected Member Functions
virtual bool | isEof (const PhysicalInStream &stream) const
| The function returns whether the end of stream has been reached.
virtual void | readChar (char &d, PhysicalInStream &stream)
| reads a character from a stream
virtual void | readUChar (unsigned char &d, PhysicalInStream &stream)
| reads a unsigned character from a stream
virtual void | readShort (short &d, PhysicalInStream &stream)
| reads a short from a stream
virtual void | readUShort (unsigned short &d, PhysicalInStream &stream)
| reads a unsigned short from a stream
virtual void | readInt (int &d, PhysicalInStream &stream)
| reads a int from a stream
virtual void | readUInt (unsigned int &d, PhysicalInStream &stream)
| reads a unsigned int from a stream
virtual void | readLong (long &d, PhysicalInStream &stream)
| reads a long from a stream
virtual void | readULong (unsigned long &d, PhysicalInStream &stream)
| reads a unsigned long from a stream
virtual void | readFloat (float &d, PhysicalInStream &stream)
| reads a float from a stream
virtual void | readDouble (double &d, PhysicalInStream &stream)
| reads a double from a stream
virtual void | readString (char *d, PhysicalInStream &stream)
| The function reads a string from a stream.
virtual void | readEndl (PhysicalInStream &stream)
| reads the 'end of line' from a stream
virtual bool | isWhitespace ()
| The function determines whether the current character is a whitespace.
virtual void | skipWhitespace (PhysicalInStream &stream)
| The function skips the whitespace.
virtual void | nextChar (PhysicalInStream &stream)
| The function reads the next character from the stream.
virtual void | readData (void *p, int size, PhysicalInStream &stream)
| The function reads a number of bytes from the file.
## Protected Attributes
char | theChar
| The last character read.
## Private Attributes
char | buf [200]
| A buffer to convert read strings.
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 286 of file InStreams.h.

## Constructor & Destructor Documentation

InText::InText | ( |  | ) | `[inline]`

| Default constructor. Definition at line 294 of file InStreams.h. References reset().

Here is the call graph for this function:

## Member Function Documentation

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 299 of file InStreams.h. References eof, and theChar. Referenced by MessageQueue::handleAllMessages(), MessageQueue::handleSpecificMessages(), InText(), and InMessage::resetReadPosition().

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 313 of file InStreams.h. References eof. Referenced by InConfig::create(), InConfig::nextChar(), readString(), InConfig::skipComment(), InConfig::skipLine(), InConfig::skipWhitespace(), 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 320 of file InStreams.h. References readString(). Referenced by readData().

Here is the call graph for this function:

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 328 of file InStreams.h. References readString().

Here is the call graph for this function:

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 336 of file InStreams.h. References readString().

Here is the call graph for this function:

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 344 of file InStreams.h. References readString().

Here is the call graph for this function:

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 352 of file InStreams.h. References readString().

Here is the call graph for this function:

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 361 of file InStreams.h. References readString().

Here is the call graph for this function:

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 369 of file InStreams.h. References readString().

Here is the call graph for this function:

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 377 of file InStreams.h. References readString().

Here is the call graph for this function:

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 385 of file InStreams.h. References readString().

Here is the call graph for this function:

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 393 of file InStreams.h. References readString().

Here is the call graph for this function:

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 30 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().

Here is the call graph for this function:

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

  | reads the 'end of line' from a stream Parameters:
  stream | the stream to read from
Implements StreamReader. Definition at line 412 of file InStreams.h.

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

| The function determines whether the current character is a whitespace. Reimplemented in InConfig. Definition at line 51 of file InStreams.cpp. References theChar. Referenced by InConfig::isWhitespace(), readString(), InConfig::skipWhitespace(), and skipWhitespace().

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

| The function skips the whitespace. Reimplemented in InConfig. Definition at line 56 of file InStreams.cpp. References isEof(), isWhitespace(), and nextChar(). Referenced by readString().

Here is the call graph for this function:

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

| The function reads the next character from the stream. Reimplemented in InConfig. Definition at line 427 of file InStreams.h. References eof, PhysicalInStream::getEof(), PhysicalInStream::readFromStream(), and theChar. Referenced by InConfig::nextChar(), InTextMessage::readAll(), readString(), and skipWhitespace().

Here is the call graph for this function:

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 45 of file InStreams.cpp. References readChar().

Here is the call graph for this function:

## Member Data Documentation

char InText::buf[200]`[private]`

| A buffer to convert read strings. Definition at line 289 of file InStreams.h.

bool InText::eof`[private]`

| Definition at line 290 of file InStreams.h. Referenced by isEof(), nextChar(), and reset().

char InText::theChar`[protected]`

| The last character read. Definition at line 305 of file InStreams.h. Referenced by isWhitespace(), nextChar(), readString(), and reset().

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

- Tools/Streams/InStreams.h
- Tools/Streams/InStreams.cpp