Arguments¶
-
class
Arguments
¶ The Arguments class takes in arguments as a map of strings (e.g., key,value pairs in a dictionary). It then uses chainsetters to access the key values and finds keys that were used for error checking.
Public Functions
-
void
init
(const argtype &args)¶ Initialize the arguments using a brace enclosed initializer list.
-
Arguments
(const argtype &args)¶ Construct via brace enclosed initializer list.
-
Arguments &
key
(const std::string &key)¶ Set the argument key (the first in the map/dictionary pair). Store the key for error processing. Return self for chainsetting.
-
Arguments &
dflt
(const std::string &defaultVal)¶ Set the default value if key is not present in args.
-
bool
empty
()¶ Return true if key is not present in args. Otherwise, false.
-
std::string
str
()¶ Return the value of the processed keyword. Reset key and dflt
-
double
dble
()¶ Return the conversion of a str of the processed keyword to double a precision floating point number.
-
int
integer
()¶ Return the conversion of a str of the processed keyword to int.
-
bool
boolean
()¶ Return the conversion of a str of the processed keyword to boolean. Accept the strings “True”, “False”, “1”, “0”, “true” or “false”.
-
bool
check_all_used
()¶ Upon destruction, check that all provided args were processed. Automatically include empty string key as processed.
-
int
size
() const¶ Return the size of the args (e.g., the number)
-
std::string
status
() const¶ Print the status of the arguments to human readable string.
-
void
dont_check
()¶ Don’t check for unused arguments upon destruction.
-
argtype
remove
(const std::string first, const argtype &args) const¶ Return argtype after removing any pair with the given first index.
-
argtype
append
(const std::string append, const std::string first, const argtype &args) const¶ Return argtype after appending onto pair with given first index.
-
void