Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::Section Class Reference

#include <StreamTokenizer.h>

Inheritance diagram for util::Section:

util::Object util::EndDelimitedSection util::EOLSection List of all members.

Detailed Description

Section represents a part of input that is treated as a single token in StreamTokenizer.

Public Methods

 Section (const std::string &name, const std::string &start)
 Create a section with the given name and start string.

virtual ~Section ()
void setCaseSensitive (bool bSensitive)
bool isCaseSensitive (void)
void addReplacement (const std::string &from, const std::string &to)
 Replace all occurrences of from with to when reading this section.

void setName (const std::string &name)
 Set the name for this section, e.g.

std::string getName (void) const
 Get the name of this section.

std::string & name (void)
 Get the name of this section.

const std::string & name (void) const
 Get the name of this section.

std::string getStart (void) const
 Get the start string.

const std::string & start (void) const
 Get the start string.

virtual std::string readSection (std::istream &input)=0 throw (io::IOException&)
 Read the section's contents from a stream.

virtual int compare (const char *ptr1, const char *ptr2, size_t len)
 Compare two strings.

Protected Methods

bool checkReplace (unsigned char &, std::istream &, std::string &)

Protected Attributes

bool _bCaseSensitive
bool _baReplace [256]
std::string _strName
std::string _strStart
unsigned int _iMaxReplacementLength
List< Pair< std::string, std::string > > _lstReplacements


class StreamTokenizer

Constructor & Destructor Documentation

util::Section::Section const std::string &    name,
const std::string &    start

Create a section with the given name and start string.

name  the name of the section. When this section is encountered, StreamTokenizer will place its name to the sectionName variable.
start  the start string of this section (i.e. &sol;*)

Member Function Documentation

virtual int util::Section::compare const char *    ptr1,
const char *    ptr2,
size_t    len
[inline, virtual]

Compare two strings.

StreamTokenizer calls this method when it thinks it has found a section start. If the section start is case insensitive or it can otherwise take various forms, you can override this method to return 0 for all allowable section start strings. The default implementation returns strncmp(ptr1,ptr2,len).

ptr1  a character array representing the section start string
ptr2  a pointer to the data that StreamTokenizer thinks is a section start
len  the length of the section start string

void util::Section::setName const std::string &    name [inline]

Set the name for this section, e.g.

"string" or "comment".

The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.