To pass to all informations required during the construction to configure Case instances. More...

#include <Defaults.h>

Public Member Functions

 Defaults (std::string tag="", std::string description="")
 
int parseArgv (int argc, char *argv[])
 
Defaults relay (const std::string &tag, const std::string &description) const
 
Defaults filter (const std::string &prefix) const
 
void addIntegerOption (std::string name, int value)
 set Integer option with name to the value, but only if that option is not already set More...
 
Defaultsoperator() (std::string name, int value)
 set Integer option with name to the value with currying syntax, but only if that option is not already set More...
 
void addStringOption (std::string name, std::string value)
 set String option with name to the value, but only if that option is not already set More...
 
Defaultsoperator() (std::string name, std::string value)
 set String option with name to the value with currying syntax, but only if that option is not already set More...
 
const std::string & tag (void) const
 return tag More...
 
const std::string & description (void) const
 return description More...
 
int size (void) const
 return total number of options More...
 
int si (const std::string &s) const
 
const std::string & ss (const std::string &s) const
 
const std::map< std::string, int > & msi (void) const
 
const std::map< std::string, std::string > & mss (void) const
 
bool ssCheck (const std::string &s) const
 
bool siCheck (const std::string &s) const
 

Protected Member Functions

std::ostream & print_ (std::ostream &os) const
 

Protected Attributes

std::string tag_
 UTF-8 encoded human-readable label. More...
 
std::string description_
 UTF-8 encoded description. More...
 
std::map< std::string, int > integerOptions_
 associative array of Integer tags / values More...
 
std::map< std::string, std::string > stringOptions_
 associative array of String tags / values More...
 

Static Protected Attributes

static std::string emptyString_
 used to return an empty string if no option is found More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Defaults &opt)
 

Detailed Description

To pass to all informations required during the construction to configure Case instances.

#include <libpf/persistency/Defaults.h>

Remarks
Warning
Thread safe:
Extendable:
Platform dependencies:

Constructor & Destructor Documentation

◆ Defaults()

Libpf::Persistency::Defaults::Defaults ( std::string  tag = "",
std::string  description = "" 
)
Parameters
tagUTF-8 encoded human-readable label
descriptionUTF-8 encoded description

Member Function Documentation

◆ addIntegerOption()

void Libpf::Persistency::Defaults::addIntegerOption ( std::string  name,
int  value 
)

set Integer option with name to the value, but only if that option is not already set

◆ addStringOption()

void Libpf::Persistency::Defaults::addStringOption ( std::string  name,
std::string  value 
)

set String option with name to the value, but only if that option is not already set

◆ description()

const std::string & Libpf::Persistency::Defaults::description ( void  ) const

return description

◆ filter()

Defaults Libpf::Persistency::Defaults::filter ( const std::string &  prefix) const

return a copy, containing only the options starting with prefix, stripped of prefix

Parameters
prefixthe prefix for the options to forward

◆ msi()

const std::map< std::string, int > & Libpf::Persistency::Defaults::msi ( void  ) const
Returns
reference to the associative array of Integer tags / values

◆ mss()

const std::map< std::string, std::string > & Libpf::Persistency::Defaults::mss ( void  ) const
Returns
reference to the associative array of String tags / values

◆ operator()() [1/2]

Defaults & Libpf::Persistency::Defaults::operator() ( std::string  name,
int  value 
)

set Integer option with name to the value with currying syntax, but only if that option is not already set

◆ operator()() [2/2]

Defaults & Libpf::Persistency::Defaults::operator() ( std::string  name,
std::string  value 
)

set String option with name to the value with currying syntax, but only if that option is not already set

◆ parseArgv()

int Libpf::Persistency::Defaults::parseArgv ( int  argc,
char *  argv[] 
)

read in options in argument list, in the format option1=a option2=b ... empty option values and values starting with an alphabetic (a-z, A-Z) character will go in Strings all the other option values will be read in as Integers returns the number of read options

◆ print_()

std::ostream & Libpf::Persistency::Defaults::print_ ( std::ostream &  os) const
protected

◆ relay()

Defaults Libpf::Persistency::Defaults::relay ( const std::string &  tag,
const std::string &  description 
) const

return a copy, with overridden tag and description

Parameters
tagUTF-8 encoded human-readable label
descriptionUTF-8 encoded description

◆ si()

int Libpf::Persistency::Defaults::si ( const std::string &  s) const
Returns
value of Integer option with tag s or -1 if not specified
Parameters
stag of Integer option

◆ siCheck()

bool Libpf::Persistency::Defaults::siCheck ( const std::string &  s) const

check for existence of String option with tag s

Returns
true if String option with tag s exists
Parameters
stag of String option

◆ size()

int Libpf::Persistency::Defaults::size ( void  ) const

return total number of options

◆ ss()

const std::string & Libpf::Persistency::Defaults::ss ( const std::string &  s) const
Returns
value of String option with tag s or empty string if not specified
Parameters
stag of String option

◆ ssCheck()

bool Libpf::Persistency::Defaults::ssCheck ( const std::string &  s) const

check for existence of Integer option with tag s

Returns
true if Integer option with tag s exists
Parameters
stag of Integer option

◆ tag()

const std::string & Libpf::Persistency::Defaults::tag ( void  ) const

return tag

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const Defaults opt 
)
friend

Member Data Documentation

◆ description_

std::string Libpf::Persistency::Defaults::description_
protected

UTF-8 encoded description.

◆ emptyString_

std::string Libpf::Persistency::Defaults::emptyString_
staticprotected

used to return an empty string if no option is found

◆ integerOptions_

std::map<std::string, int> Libpf::Persistency::Defaults::integerOptions_
protected

associative array of Integer tags / values

◆ stringOptions_

std::map<std::string, std::string> Libpf::Persistency::Defaults::stringOptions_
protected

associative array of String tags / values

◆ tag_

std::string Libpf::Persistency::Defaults::tag_
protected

UTF-8 encoded human-readable label.


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