RSC  0.17.1
rsc::config::ConfigFileSource Class Reference

Objects of this class parse streams that contain configuration information in "ini-file" syntax. More...

#include <ConfigFileSource.h>

Inheritance diagram for rsc::config::ConfigFileSource:
Inheritance graph
Collaboration diagram for rsc::config::ConfigFileSource:
Collaboration graph

Public Member Functions

 ConfigFileSource (std::istream &stream)
 
void provideOptions (OptionHandler &handler)
 Implementations should pass all configuration options to handler. More...
 
- Public Member Functions inherited from rsc::config::ConfigSource
virtual ~ConfigSource ()
 

Private Member Functions

bool getOption (std::string &name, std::string &value)
 

Private Attributes

logging::LoggerPtr logger
 
std::istream & stream
 
std::string currentSection
 
std::map< std::vector< std::string >, std::string > options
 

Additional Inherited Members

- Protected Member Functions inherited from rsc::config::ConfigSource
void splitKeyAtDots (const std::string &input, std::vector< std::string > &output)
 Creates a key vector structure used in the options backend from a dot-separated string. More...
 

Detailed Description

Objects of this class parse streams that contain configuration information in "ini-file" syntax.

Sections and keys are mapped to hierarchical names.

Currently, only files with line encoding styles of the respective platform the code is run on are supported. Others may work but without guarantee.

Author
jmoringe

Definition at line 52 of file ConfigFileSource.h.

Constructor & Destructor Documentation

rsc::config::ConfigFileSource::ConfigFileSource ( std::istream &  stream)

Definition at line 57 of file ConfigFileSource.cpp.

References getOption(), logger, options, RSCTRACE, and rsc::config::ConfigSource::splitKeyAtDots().

Here is the call graph for this function:

Member Function Documentation

bool rsc::config::ConfigFileSource::getOption ( std::string &  name,
std::string &  value 
)
private

Definition at line 93 of file ConfigFileSource.cpp.

References currentSection, stream, and rsc::config::trim().

Referenced by ConfigFileSource().

Here is the call graph for this function:

Here is the caller graph for this function:

void rsc::config::ConfigFileSource::provideOptions ( OptionHandler handler)
virtual

Implementations should pass all configuration options to handler.

Parameters
handlerThe handler to which all option should be passed.
Exceptions
std::invalid_argumentmay be thrown when the options this source uses in the background are not well-formated

Implements rsc::config::ConfigSource.

Definition at line 85 of file ConfigFileSource.cpp.

References rsc::config::OptionHandler::handleOption(), and options.

Referenced by rsc::config::processConfigFile(), and rsc::logging::LoggerFactory::reconfigureFromFile().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::string rsc::config::ConfigFileSource::currentSection
private

Definition at line 62 of file ConfigFileSource.h.

Referenced by getOption().

logging::LoggerPtr rsc::config::ConfigFileSource::logger
private

Definition at line 59 of file ConfigFileSource.h.

Referenced by ConfigFileSource().

std::map<std::vector<std::string>, std::string> rsc::config::ConfigFileSource::options
private

Definition at line 64 of file ConfigFileSource.h.

Referenced by ConfigFileSource(), and provideOptions().

std::istream& rsc::config::ConfigFileSource::stream
private

Definition at line 61 of file ConfigFileSource.h.

Referenced by getOption().


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