To pass to all informations required during the construction to configure Case instances.
More...
#include <Defaults.h>
|
| 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...
|
|
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 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...
|
|
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 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 |
|
|
std::ostream & | print_ (std::ostream &os) const |
|
To pass to all informations required during the construction to configure Case instances.
#include <libpf/persistency/Defaults.h>
- Warning
-
Thread safe:
-
Extendable:
-
Platform dependencies:
◆ Defaults()
Libpf::Persistency::Defaults::Defaults |
( |
std::string |
tag = "" , |
|
|
std::string |
description = "" |
|
) |
| |
- Parameters
-
tag | UTF-8 encoded human-readable label |
description | UTF-8 encoded description |
◆ 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 |
◆ 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
-
prefix | the 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
-
tag | UTF-8 encoded human-readable label |
description | UTF-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
-
◆ 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
-
◆ 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
-
◆ 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
-
◆ tag()
const std::string & Libpf::Persistency::Defaults::tag |
( |
void |
| ) |
const |
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const Defaults & |
opt |
|
) |
| |
|
friend |
◆ 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: