ConfigStream Class Reference

#include <cstream.h>

List of all members.

Public Member Functions

 ConfigStream ()
 constructor
void open (char *FileName)
ConfigPos tellg ()
ConfigPos tellTagBegin ()
ConfigStreamseekg (ConfigPos &pos)
 moves to the byte offset of the stream and sets the corresponding line position
bool GetTag (char *buf, int len)
void FwdToTag (const char *tag)
ostream & LineStamp (ostream &oS)
unsigned int GetLineNo ()


Detailed Description

remembers not just the byte position but the line position also special stream class which remembers not just the byte position but the line position also, and suggests some functions useful for reading configuration files

Member Function Documentation

void ConfigStream::FwdToTag ( const char *  tag  ) 

runs forward to meet the text the same as tag

Parameters:
tag searched text

bool ConfigStream::GetTag ( char *  buf,
int  len 
)

����

Parameters:
buf [out] buffer where the result will returned
len [in] length of the buffer in bytes
Returns:
true if any valuable data is in buffer
false if end of file encountered
Attention:
�caller should preserve the buf large enough to slurp any line
from the config file, char buf[256] is good choice for most cases
reads the stream of configuration file skips the comment lines which should begin with # cleans the whitespaces and trailing comments, but preserving them in quoted parts and saves the line counts also

Parameters:
buf buffer where to return the line from the stream
len length of the buffer caller should reserve buf long enough to read any line of the config file
Returns:
True if the valuable configuration string is found False if end of file encountered

void ConfigStream::open ( char *  FileName  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

ConfigStream & ConfigStream::seekg ( ConfigPos pos  ) 

moves to the byte offset of the stream and sets the corresponding line position

skips to the required position with atention to the line of the given byte position is overloaded intentionally to preserve the right line counting

Parameters:
pos instance of the special class, storing the line numbers also
Returns:
the stream again

ConfigPos ConfigStream::tellg (  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
both the line and byte offet of the stream

special object, storing the current stream byte offset and the line number

ConfigPos ConfigStream::tellTagBegin (  ) 

Returns:
line and byte offset of the stream before last read

special object, storing the stream byte offset and the line number before the current tag has been read


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

doxygen