41 #ifdef CHECK_MEMORY_LEAKS
43 #endif // CHECK_MEMORY_LEAKS
52 for (
int i = 1; i < argc;) {
57 add =
check(argv[i], argv[i + 1], ok);
59 add =
check(argv[i], 0, ok);
63 WRITE_ERROR(
"On processing option '" + std::string(argv[i]) +
"':\n " + e.what());
84 std::string tmp(arg1 + 2);
85 const std::string::size_type idx1 = tmp.find(
'=');
87 if (idx1 != std::string::npos) {
88 ok &= oc.
set(tmp.substr(0, idx1), tmp.substr(idx1 + 1));
90 if (arg2 == 0 || (oc.
isBool(
convert(arg1 + 2)) && arg2[0] ==
'-')) {
100 for (
int i = 1; arg1[i] != 0; i++) {
103 if (arg2 == 0 || arg2[0] ==
'-' || arg1[i + 1] != 0) {
113 if (arg2 == 0 || arg1[i + 1] != 0) {
132 if (strlen(arg) < 3) {
133 WRITE_ERROR(
"Missing value for parameter '" + std::string(arg).substr(0, 1) +
"'.");
136 return oc.
set(
convert(arg[0]), std::string(arg + 2));
139 if (strlen(arg) < 2) {
140 WRITE_ERROR(
"Missing value for parameter '" + std::string(arg) +
"'.");
143 return oc.
set(
convert(arg[0]), std::string(arg + 1));
151 if (arg1[0] !=
'-') {
152 WRITE_ERROR(
"The parameter '" + std::string(arg1) +
"' is not allowed in this context.\n Switch or parameter name expected.");
161 return arg1[1] !=
'-';
static int check(const char *arg1, const char *arg2, bool &ok)
parses the previous arguments
static bool checkParameter(const char *arg1)
Returns the whether the given token is an option.
static bool processNonBooleanSingleSwitch(OptionsCont &oc, const char *arg)
Extracts the parameter directly attached to an option.
static OptionsCont & getOptions()
Retrieves the options.
static bool parse(int argc, char **argv)
Parses the given command line arguments.
bool isBool(const std::string &name) const
Returns the information whether the option is a boolean option.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
static bool isAbbreviation(const char *arg1)
returns the whether the given token is an abbreviation
A storage for options typed value containers)
static std::string convert(const char *arg)
Converts char* to string.