RSC  0.17.1
rsc::config::CommandLinePropertySource Class Reference

A source for options from the command line using a -D java properties-like syntax. More...

#include <CommandLinePropertySource.h>

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

Public Member Functions

 CommandLinePropertySource (int argc, const char **argv, bool reportSyntaxErrors=false, char option= 'D')
 Creates a new source. More...
 
virtual ~CommandLinePropertySource ()
 
void provideOptions (OptionHandler &handler)
 Implementations should pass all configuration options to handler. More...
 
- Public Member Functions inherited from rsc::config::ConfigSource
virtual ~ConfigSource ()
 

Private Attributes

logging::LoggerPtr logger
 
int argc
 
const char ** argv
 
bool reportSyntaxErrors
 
char option
 

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

A source for options from the command line using a -D java properties-like syntax.

The option key can be specified and in the default configuration unknown or ill-formatted options are ignored so that it is safe to use this source in conjunction with other command line handling routines.

Author
jwienke

Definition at line 44 of file CommandLinePropertySource.h.

Constructor & Destructor Documentation

rsc::config::CommandLinePropertySource::CommandLinePropertySource ( int  argc,
const char **  argv,
bool  reportSyntaxErrors = false,
char  option = 'D' 
)

Creates a new source.

Parameters
argcNumber of arguments given to the program
argvArgument vector given to the program
reportSyntaxErrorsif true, syntax errors in the options will raise exceptions in provideOptions, otherwise they will be ignored. Default: false
optionthe command line option key used to parse the properties, defaults to 'D'.

Definition at line 37 of file CommandLinePropertySource.cpp.

rsc::config::CommandLinePropertySource::~CommandLinePropertySource ( )
virtual

Definition at line 46 of file CommandLinePropertySource.cpp.

Member Function Documentation

void rsc::config::CommandLinePropertySource::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 49 of file CommandLinePropertySource.cpp.

References argc, argv, rsc::config::OptionHandler::handleOption(), logger, option, reportSyntaxErrors, RSCTRACE, RSCWARN, and rsc::config::ConfigSource::splitKeyAtDots().

Referenced by rsc::config::configure().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int rsc::config::CommandLinePropertySource::argc
private

Definition at line 69 of file CommandLinePropertySource.h.

Referenced by provideOptions().

const char** rsc::config::CommandLinePropertySource::argv
private

Definition at line 70 of file CommandLinePropertySource.h.

Referenced by provideOptions().

logging::LoggerPtr rsc::config::CommandLinePropertySource::logger
private

Definition at line 67 of file CommandLinePropertySource.h.

Referenced by provideOptions().

char rsc::config::CommandLinePropertySource::option
private

Definition at line 72 of file CommandLinePropertySource.h.

Referenced by provideOptions().

bool rsc::config::CommandLinePropertySource::reportSyntaxErrors
private

Definition at line 71 of file CommandLinePropertySource.h.

Referenced by provideOptions().


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