#include <confparser.h>
Public Member Functions | |
| IConfigurationParser () | |
| IConfigurationParser (std::istream *str) | |
| virtual | ~IConfigurationParser () |
| virtual void | skip ()=0 |
| virtual std::istream * | setStream (std::istream *str) |
| virtual bool | parse (KeyType &key, ValueType &value)=0 |
| virtual bool | eod ()=0 |
Protected Attributes | |
| std::istream * | stream |
Interface for configuration parsers. Defines methods needed for parsing configuration file. Template paramters specifies concrete types for configuration entities which allways consist of two parts key and value, where key determines meaning of value. Implementator gives meaning to both of them.
Current unparsed key, value pair may be skipped by skip method.
Note that this interface doesn't say how format looks like or whether data are read by lines or what so ever. One parse method call fills key and value and moves to following one or returns with false if no more data are available.
Data are read from input stream which is set in constructor and stored in this class as protected field. Stream may be changed by setStream method.
| configuration::IConfigurationParser< KeyType, ValueType >::IConfigurationParser | ( | ) | [inline] |
Empty constructor. Initializes stream to NULL.
| configuration::IConfigurationParser< KeyType, ValueType >::IConfigurationParser | ( | std::istream * | str | ) | [inline] |
Initialization constructor.
| str | Stream with data. |
Sets stream field.
| virtual configuration::IConfigurationParser< KeyType, ValueType >::~IConfigurationParser | ( | ) | [inline, virtual] |
Empty virtual destructor.
| virtual bool configuration::IConfigurationParser< KeyType, ValueType >::eod | ( | ) | [pure virtual] |
Checks whether we are on end of data.
Allways returns true if no stream is specified (it is NULL).
Implemented in configuration::ModeConfigurationParser, and configuration::StringConfigurationParser.
Referenced by configuration::ModeConfigurationParser::eod().
| virtual bool configuration::IConfigurationParser< KeyType, ValueType >::parse | ( | KeyType & | key, | |
| ValueType & | value | |||
| ) | [pure virtual] |
Parse current key, value pair.
| key | Reference where to put parsed key. | |
| value | Reference where to put parsed value. |
Moves current parsing position after parsed data.
Implemented in configuration::ModeConfigurationParser, and configuration::StringConfigurationParser.
Referenced by configuration::ModeConfigurationParser::parse().
| virtual std::istream* configuration::IConfigurationParser< KeyType, ValueType >::setStream | ( | std::istream * | str | ) | [inline, virtual] |
Sets new data stream.
| str | Stream to set. |
Sets new value of stream.
Reimplemented in configuration::ModeConfigurationParser.
Referenced by configuration::ModeConfigurationParser::setStream().
| virtual void configuration::IConfigurationParser< KeyType, ValueType >::skip | ( | ) | [pure virtual] |
Skipps current key, value pair.
Implemented in configuration::ModeConfigurationParser, and configuration::StringConfigurationParser.
Referenced by configuration::ModeConfigurationParser::skip().
std::istream* configuration::IConfigurationParser< KeyType, ValueType >::stream [protected] |
Stream with data.
Referenced by configuration::IConfigurationParser< std::string, std::string >::setStream().