configuration::ModeConfigurationParser Class Reference

#include <modecontroller.h>

Inheritance diagram for configuration::ModeConfigurationParser:
configuration::IConfigurationParser< ModeRule, PropertyMode >

List of all members.

Public Types

typedef IConfigurationParser
< std::string, std::string > 
StringParser

Public Member Functions

 ModeConfigurationParser (StringParser &parser)
std::istream * setStream (std::istream *str)
void skip ()
bool eod ()
bool parse (ModeRule &rule, PropertyMode &mode)

Private Attributes

StringParserbaseParser

Detailed Description

Decorator for IConfigurationParser with ModeRule and PropertyMode specialization.

This class doesn't provide any stream reading. Instead it delegates all reading work to low-level baseParser (provided in constructor) which provides string representation of Rule and mode. Responisbility of this class is to parse those values to correct ModeRule and PropertyMode types.
ModeRule is supposed to have format:

 Type[.Value] : stringmode
 

All other IConfigurationParser operations are delegated to the baseParser.


Member Typedef Documentation


Constructor & Destructor Documentation

configuration::ModeConfigurationParser::ModeConfigurationParser ( StringParser parser  )  [inline]

Initialization constructor. Initializes baseParser field.


Member Function Documentation

bool configuration::ModeConfigurationParser::eod (  )  [inline, virtual]

Checks whether we are on end of data.

Delegates to baseParser.eod()

Returns:
true if there is nothing more to read, false otherwise.

Implements configuration::IConfigurationParser< ModeRule, PropertyMode >.

References baseParser, and configuration::IConfigurationParser< KeyType, ValueType >::eod().

bool configuration::ModeConfigurationParser::parse ( ModeRule rule,
PropertyMode mode 
) [virtual]

Parses key, value pair and transforms them to rule and mode.

Parameters:
rule Reference where to put parsed rule.
mode Reference where to put parsed mode.

Delegates to baseParser.parse and transforms returned strings to rule and mode.

Rule string has format:

 type[.name]
 

If `.' is not found name or there are no characters behind, name is empty. Everything before `.' is Type. It can also be empty. Both parts are trimed before set (all leading and trailing blanks re skiped).
Name string should be same as PropertyMode names. If not recognized, returns with an error.
Note that !parse() && eod() means no error but nothing more to parse.

Returns:
true if parsing was successful, false otherwise.

Implements configuration::IConfigurationParser< ModeRule, PropertyMode >.

References baseParser, mdAdvanced, mdHidden, mdNormal, mdReadOnly, mdUnknown, configuration::ModeRule::name, configuration::IConfigurationParser< KeyType, ValueType >::parse(), configuration::utils::tokenizer(), configuration::utils::trim(), and configuration::ModeRule::type.

std::istream* configuration::ModeConfigurationParser::setStream ( std::istream *  str  )  [inline, virtual]

Sets new data stream.

Parameters:
str Stream to set.

Delegates to baseStream (sets stream to low level string parser).

Returns:
Current stream reference.

Reimplemented from configuration::IConfigurationParser< ModeRule, PropertyMode >.

References baseParser, and configuration::IConfigurationParser< KeyType, ValueType >::setStream().

void configuration::ModeConfigurationParser::skip (  )  [inline, virtual]

Skips current key, value pair. Delegates to baseParser.skip()

Implements configuration::IConfigurationParser< ModeRule, PropertyMode >.

References baseParser, and configuration::IConfigurationParser< KeyType, ValueType >::skip().


Member Data Documentation

Low level string parser. This parser is initialized in constructor and it is used for input data parsing.

Referenced by eod(), parse(), setStream(), and skip().


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