To pass to all informations required during the construction to configure Case instances.
More...
#include <Defaults.h>
|
| Defaults (const std::string &tag="", const 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/user/Defaults.h>
- Warning
-
Thread safe:
-
Extendable:
-
Platform dependencies:
Libpf::User::Defaults::Defaults |
( |
const std::string & |
tag = "" , |
|
|
const std::string & |
description = "" |
|
) |
| |
- Parameters
-
tag | UTF-8 encoded human-readable label |
description | UTF-8 encoded description |
void Libpf::User::Defaults::addIntegerOption |
( |
std::string |
name, |
|
|
int |
value |
|
) |
| |
set Integer option with name to the value, but only if that option is not already set
void Libpf::User::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
const std::string& Libpf::User::Defaults::description |
( |
void |
| ) |
const |
Defaults Libpf::User::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 |
const std::map<std::string, int>& Libpf::User::Defaults::msi |
( |
void |
| ) |
const |
- Returns
- reference to the associative array of Integer tags / values
const std::map<std::string, std::string>& Libpf::User::Defaults::mss |
( |
void |
| ) |
const |
- Returns
- reference to the associative array of String tags / values
Defaults& Libpf::User::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
Defaults& Libpf::User::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
int Libpf::User::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
std::ostream& Libpf::User::Defaults::print_ |
( |
std::ostream & |
os | ) |
const |
|
protected |
Defaults Libpf::User::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 |
int Libpf::User::Defaults::si |
( |
const std::string & |
s | ) |
const |
- Returns
- value of Integer option with tag s or -1 if not specified
- Parameters
-
bool Libpf::User::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
-
int Libpf::User::Defaults::size |
( |
void |
| ) |
const |
return total number of options
const std::string& Libpf::User::Defaults::ss |
( |
const std::string & |
s | ) |
const |
- Returns
- value of String option with tag s or empty string if not specified
- Parameters
-
bool Libpf::User::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
-
const std::string& Libpf::User::Defaults::tag |
( |
void |
| ) |
const |
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
const Defaults & |
opt |
|
) |
| |
|
friend |
std::string Libpf::User::Defaults::description_ |
|
protected |
UTF-8 encoded description.
std::string Libpf::User::Defaults::emptyString_ |
|
staticprotected |
used to return an empty string if no option is found
std::map<std::string, int> Libpf::User::Defaults::integerOptions_ |
|
protected |
associative array of Integer tags / values
std::map<std::string, std::string> Libpf::User::Defaults::stringOptions_ |
|
protected |
associative array of String tags / values
std::string Libpf::User::Defaults::tag_ |
|
protected |
UTF-8 encoded human-readable label.
The documentation for this class was generated from the following file: