47 for (
int i = 1; i < argc;) {
52 add =
check(argv[i], argv[i + 1], ok);
54 add =
check(argv[i], 0, ok);
58 WRITE_ERROR(
"On processing option '" + std::string(argv[i]) +
"':\n " + e.what());
79 std::string tmp(arg1 + 2);
80 const std::string::size_type idx1 = tmp.find(
'=');
82 if (idx1 != std::string::npos) {
83 ok &= oc.
set(tmp.substr(0, idx1), tmp.substr(idx1 + 1));
85 if (arg2 == 0 || (oc.
isBool(
convert(arg1 + 2)) && arg2[0] ==
'-')) {
95 for (
int i = 1; arg1[i] != 0; i++) {
98 if (arg2 == 0 || arg2[0] ==
'-' || arg1[i + 1] != 0) {
108 if (arg2 == 0 || arg1[i + 1] != 0) {
127 if (strlen(arg) < 3) {
128 WRITE_ERROR(
"Missing value for parameter '" + std::string(arg).substr(0, 1) +
"'.");
131 return oc.
set(
convert(arg[0]), std::string(arg + 2));
134 if (strlen(arg) < 2) {
135 WRITE_ERROR(
"Missing value for parameter '" + std::string(arg) +
"'.");
138 return oc.
set(
convert(arg[0]), std::string(arg + 1));
146 if (arg1[0] !=
'-') {
147 WRITE_ERROR(
"The parameter '" + std::string(arg1) +
"' is not allowed in this context.\n Switch or parameter name expected.");
156 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.