8 #ifndef INCL_evo_config_h 9 #define INCL_evo_config_h 135 template<
class ConsoleT=Console>
139 typedef typename ConsoleT::OutT
OutT;
208 for (
SizeT i = 0, sz = values.size(); i < sz; ++i)
242 virtual void addsep() = 0;
327 struct OptionInfo :
public Option {
338 OptionInfo() : type(tPOS), bitflags(0), max_length(0) {
341 OptionInfo(Type type,
const String& key,
const String& help) :
349 OptionInfo(Type type,
const String& key,
const String& helpname,
const String& help) :
358 OptionInfo(
const OptionInfo& src) :
362 helpname(src.helpname),
364 default_val(src.default_val),
365 choices(src.choices),
366 bitflags(src.bitflags),
378 bitflags |= BITFLAG_REQUIRED;
380 bitflags &= ~BITFLAG_REQUIRED;
386 bitflags |= BITFLAG_MULTI_VALUE;
388 bitflags &= ~BITFLAG_MULTI_VALUE;
393 bitflags |= BITFLAG_NUMERIC;
404 while (tmpval.
token(tok,
';'))
409 String& format(
String& str,
bool shorthand=
false)
const {
412 const bool required = (bitflags & BITFLAG_REQUIRED);
413 if (!required && !shorthand)
415 if (!helpname.
empty())
422 if (bitflags & BITFLAG_MULTI_VALUE)
428 if (!helpname.
empty())
429 str <<
' ' << helpname;
438 void store_flag(T& map)
const {
444 void store_value(T& map,
const SubString& value)
const {
445 if (bitflags & BITFLAG_MULTI_VALUE)
452 OptionInfo& operator=(
const OptionInfo& src);
460 struct NullOption :
public Option {
463 Option&
multi(
bool val=
true) { (void)val;
return *
this; }
469 struct CommandInfo :
public Command {
475 const OptionMap* parent_options;
477 OptionList options_list;
480 CommandInfo() : parent(NULL), parent_options(NULL) {
484 static NullOption null;
491 if (lines.token_line(line)) {
493 if (tok.
nextw(
' ')) {
505 names.addsep(
',').add(tok.
value());
507 if (i > 2 && (line[i-1] !=
' ' || line[i-2] !=
' ')) {
514 get_help_text(help, str, i);
519 return addopt(names, value, help);
526 get_help_text(help, str, i);
534 parent->show_warning() <<
"CommandLine::add() ignoring malformed input: " << line << parent->newline_;
540 options_list.
add(sep);
544 OptionInfoShPtr arg(
new OptionInfo(tFLAG, key, help) );
547 while (tok.
next(
',')) {
552 options_list.
add(arg);
557 get_option_key(key, names);
559 parent->show_warning() <<
"CommandLine::addflag() ignoring malformed names: " << names << parent->newline_;
565 OptionInfoShPtr arg(
new OptionInfo(tOPTION, key, helpname, help) );
568 while (tok.
next(
',')) {
573 options_list.
add(arg);
579 get_option_key(key, names);
581 parent->show_warning() <<
"CommandLine::addopt() ignoring malformed names: " << names << parent->newline_;
582 static NullOption null;
585 return addopt(names, key, helpname, help);
589 return addopt(names,
"<value>", help);
595 arg.helpname = helpname;
601 return addarg(key, key, help);
605 void option_cleanup() {
607 for (
SizeT j = options_list.
size(); j > 0; ) {
608 const OptionInfo* ptr = options_list[--j].ptr();
610 ptr->all.split(
',', name_sub);
611 const OptionInfoShPtr* findptr = options.
find(name_sub.
stripl(
'-'));
612 if (findptr == NULL || findptr->
ptr() != ptr)
620 void set_defaults(T& map) {
622 const OptionInfo* ptr = iter->ptr();
623 if (ptr != NULL && !ptr->default_val.null())
624 map[ptr->key] = ptr->default_val;
631 while (tok.
next(
',')) {
635 else if (tokname.starts(
"--") || (key.
empty() && tokname.starts(
"-")))
636 key = tokname.
stripl(
'-');
645 for (uint i = 0; lines.token_line(line); ) {
646 if (indent ==
NONE) {
654 line.
triml(indent <= maxtrim ? indent : maxtrim);
673 CommandLineT() : con_(ConsoleT::get()), progname_set_(false), maxline_(This::MAXLINE_DEFAULT), noexit_(false), error_(false) {
682 CommandLineT(
const String& description) : con_(ConsoleT::get()), progname_set_(false), description_(description), maxline_(This::MAXLINE_DEFAULT), noexit_(false), error_(false) {
714 const uint MIN_MAXLINE = 40;
715 if (maxline < MIN_MAXLINE)
716 maxline = MIN_MAXLINE;
730 progname_set_ =
true;
762 version_ = version_info;
781 return main_.add(str);
802 return main_.addflag(names, key, help);
812 return main_.addflag(names, help);
826 return main_.addopt(names, key, helpname, help);
838 return main_.addopt(names, helpname, help);
851 return main_.addopt(names, help);
863 return main_.addarg(key, helpname, help);
874 return main_.addarg(key, help);
885 CommandInfo& cmd = subcommands_[name];
886 if (cmd.parent == NULL) {
890 subcommand_list_.
add(name);
916 bool parse(TMap& map,
int argc,
const char* argv[],
int offset=0) {
917 int i = (offset >= 0 ? offset : 0);
918 if (progname_.null() || !progname_set_) {
928 if (progname_.empty()) {
929 con_.err <<
"ERROR: CommandLine processing not setup correctly -- No program name set" << newline_;
934 addflag(
"-h, --help",
"evo_help_", (subcommands_.size() > 0 ?
"Show this usage help, or command usage help if after command" :
"Show this usage help"));
935 addflag(
"--help-general",
"evo_help_general_",
"Show general argument processing help");
936 if (!version_.empty())
937 addflag(
"--version",
"evo_version_",
"Show version information");
942 const CommandInfo* cmd = NULL;
943 for (
int j = i; j < argc; ++j) {
948 }
else if (opt ==
"-h" || opt ==
"--help") {
950 return finish(
false);
951 }
else if (opt ==
"--help-general") {
952 print_help_general();
953 return finish(
false);
954 }
else if (opt ==
"--version") {
955 if (!version_.empty()) {
957 return finish(
false);
961 const CommandInfo* new_cmd = subcommands_.find(opt);
969 main_.set_defaults(map);
970 ParseState state(main_);
971 for (; i < argc; ++i) {
972 if (!parse_arg(state, map, argv[i]))
977 if (state.current != NULL && state.valnum > 0)
979 while (state.argnum < state.cur_args->size()) {
980 if ((*state.cur_args)[state.argnum].bitflags & BITFLAG_REQUIRED) {
981 con_.err << progname_ <<
": ERROR: Missing required argument: " << (*state.cur_args)[state.argnum].helpname << newline_;
986 if (subcommands_.size() > 0 && state.cur_cmd == NULL) {
987 con_.err << progname_ <<
": ERROR: Missing required command" << newline_;
1004 if (!progname_.empty())
1005 con_.err << progname_ <<
": ";
1006 con_.err <<
"ERROR: ";
1020 if (!progname_.empty())
1021 con_.err << progname_ <<
": ";
1022 con_.err <<
"WARNING: ";
1027 static const ulong BITFLAG_REQUIRED = 0x01;
1028 static const ulong BITFLAG_MULTI_VALUE = 0x02;
1029 static const ulong BITFLAG_DEFAULT_TRUE = 0x04;
1030 static const ulong BITFLAG_NUMERIC = 0x08;
1044 CommandList subcommands_;
1048 bool finish(
bool err) {
1057 main_.option_cleanup();
1062 const OptionInfo* current;
1063 const OptionInfo* prev_arg;
1064 const CommandInfo* cur_cmd;
1065 const OptionMap* cur_opts;
1066 const ArgList* cur_args;
1071 ParseState(
const CommandInfo& cmd) : current(NULL), prev_arg(NULL), cur_cmd(NULL), cur_opts(&cmd.options), cur_args(&cmd.args), argnum(0), valnum(0), end_options(false) {
1074 void value_expected(
const OptionInfo& info) {
1079 void value_stored(
const OptionInfo& info) {
1080 if (info.type != tPOS) {
1081 if (prev_arg != NULL) {
1088 }
else if (info.bitflags & BITFLAG_MULTI_VALUE) {
1095 void value_added(
const OptionInfo& info) {
1096 if (info.type == tPOS) {
1097 if (info.bitflags & BITFLAG_MULTI_VALUE) {
1101 }
else if (prev_arg != NULL) {
1111 const OptionInfo* option_lookup(
const ParseState& state,
const SubString& name)
const {
1112 const OptionInfoShPtr* result;
1113 if (state.cur_cmd != NULL) {
1114 result = state.cur_cmd->options.find(name);
1116 return result->ptr();
1118 result = main_.options.find(name);
1120 return result->ptr();
1124 bool parse_validate(
const OptionInfo& info,
const SubString& value) {
1125 if (info.bitflags & BITFLAG_NUMERIC) {
1127 if (i < sz && value[i] ==
'-')
1129 for (
StrSizeT digits = 0; i < sz; ++i, ++digits) {
1130 if (value[i] <
'0' || value[i] >
'9') {
1131 con_.err << progname_ <<
": ERROR: Value must be numeric: " << value << newline_;
1132 return finish(
true);
1134 if (info.max_length > 0 && digits >= info.max_length) {
1135 con_.err << progname_ <<
": ERROR: Numeric value too long (max digits: " << info.max_length <<
"): " << value << newline_;
1136 return finish(
true);
1139 }
else if (info.max_length > 0 && value.
size() > info.max_length) {
1140 con_.err << progname_ <<
": ERROR: Value too long (max length: " << info.max_length <<
"): " << value << newline_;
1141 return finish(
true);
1143 if (info.choices.size() > 0 && !info.choices.contains(value)) {
1144 con_.err << progname_ <<
": ERROR: Invalid value: " << value << newline_;
1145 return finish(
true);
1150 template<
class TMap>
1151 bool parse_arg(ParseState& state, TMap& map,
const SubString& arg) {
1152 if (!state.end_options) {
1155 state.current = NULL;
1156 state.prev_arg = NULL;
1158 }
else if (arg ==
"--") {
1160 state.end_options =
true;
1161 state.current = NULL;
1166 if (state.current == NULL && state.prev_arg != NULL) {
1168 state.current = state.prev_arg;
1172 if (state.current != NULL) {
1173 if (!state.end_options && arg.
starts(
'-') && state.valnum > 0) {
1175 if (state.current->type == tPOS && state.current->bitflags & BITFLAG_MULTI_VALUE)
1176 state.prev_arg = state.current;
1177 state.current = NULL;
1181 const OptionInfo& info = *state.current;
1182 if (!parse_validate(info, arg))
1184 info.store_value(map, arg);
1185 state.value_added(info);
1190 if (!state.end_options) {
1193 if (arg.
starts(
"--", 2)) {
1196 const bool found_value = str.
split(
'=', name, value);
1198 const OptionInfo* infop = option_lookup(state, name);
1199 if (infop == NULL) {
1200 if (name.
starts(
"no-", 3)) {
1203 infop = option_lookup(state, noname);
1204 if (infop != NULL) {
1206 con_.err << progname_ <<
": ERROR: Value not allowed with reset option: --" << name << newline_;
1207 return finish(
true);
1209 map.remove(infop->key);
1213 con_.err << progname_ <<
": ERROR: Unknown option: --" << name << newline_;
1214 return finish(
true);
1217 const OptionInfo& info = *infop;
1218 if (info.type == tFLAG) {
1220 con_.err << progname_ <<
": ERROR: Unexpected value with option: --" << name << newline_;
1221 return finish(
true);
1223 info.store_flag(map);
1224 }
else if (found_value) {
1225 if (!parse_validate(info, value))
1227 info.store_value(map, value);
1228 state.value_stored(info);
1230 state.value_expected(info);
1232 }
else if (arg.
starts(
'-')) {
1235 for (
StrSizeT i = 0, c = args.size(); i < c; ++i) {
1236 if (args[i] ==
'h') {
1237 print_help(state.cur_cmd);
1238 return finish(
false);
1240 str.
set(args.data() + i, 1);
1241 const OptionInfo* infop = option_lookup(state, str);
1242 if (infop == NULL) {
1243 con_.err << progname_ <<
": ERROR: Unknown option: -" << str << newline_;
1244 return finish(
true);
1247 const OptionInfo& info = *infop;
1248 if (info.type == tFLAG) {
1249 if (i + 1 < c && args[i + 1] ==
'=') {
1250 con_.err << progname_ <<
": ERROR: Unexpected value with option: -" << args[i] << newline_;
1251 return finish(
true);
1253 info.store_flag(map);
1256 state.value_expected(info);
1259 if (args[i + 1] ==
'=') {
1262 str.
set(args.data() + i + 1, c - i - 1);
1263 con_.err << progname_ <<
": ERROR: Possible typo, use '" << args[i] <<
'=' << str <<
"' for clarity when combining short options in: -" << args << newline_;
1264 return finish(
true);
1267 str.
set(args.data() + i + 1, c - i - 1);
1268 if (!parse_validate(info, str))
1270 info.store_value(map, str);
1271 state.value_stored(info);
1281 if (state.argnum >= state.cur_args->size()) {
1282 if (subcommands_.size() > 0 && state.cur_cmd == NULL) {
1284 state.cur_cmd = subcommands_.find(arg);
1285 if (state.cur_cmd == NULL) {
1286 con_.err << progname_ <<
": ERROR: Unknown command: " << arg << newline_;
1287 return finish(
true);
1289 map[
"command"] = arg;
1290 state.current = NULL;
1291 state.prev_arg = NULL;
1292 state.cur_args = &(state.cur_cmd->args);
1298 con_.err << progname_ <<
": ERROR: Unexpected argument: " << arg << newline_;
1299 return finish(
true);
1302 const OptionInfo& info = (*state.cur_args)[state.argnum];
1303 if (!parse_validate(info, arg))
1305 info.store_value(map, arg);
1306 state.value_stored(info);
1311 void print_help_usage(
const CommandInfo& cmd,
const char* options_prefix=
"")
const {
1312 if (cmd.options.size() > 0)
1313 con_.out <<
" [" << options_prefix <<
"options]";
1316 const OptionInfo& info = *iter;
1317 con_.out <<
' ' << info.format(tmp);
1321 void print_help_args(
const CommandInfo& cmd,
const char* options_prefix=
"")
const {
1324 if (cmd.options.size() > 0) {
1325 con_.out << newline_ << options_prefix <<
"Options:" << newline_;
1330 const OptionInfoShPtr& info = *iter;
1332 StrSizeT len = info->format(tmp).size();
1337 if (maxlen > MAX_MAXLEN)
1338 maxlen = MAX_MAXLEN;
1340 String help, help_default;
1343 const OptionInfoShPtr& info = *iter;
1345 con_.out << newline_;
1351 con_.out << newline_ <<
FmtChar(
' ', maxlen + 1);
1353 if (info->help.empty()) {
1354 con_.out << newline_;
1357 if (!info->default_val.null()) {
1359 help_default.
set() <<
"[default: " << info->default_val <<
']';
1360 if (help.
findreplace(
"${default}", 10, help_default) == 0)
1361 help.
addsep(
' ') << help_default;
1368 if (cmd.args.size() > 0) {
1369 bool found_help =
false;
1372 const OptionInfo& info = *iter;
1373 StrSizeT len = info.format(tmp,
true).size();
1376 if (!info.help.empty())
1381 con_.out << newline_ <<
"Arguments:" << newline_;
1382 const StrSizeT help_indent = maxlen + SEP.size() + 1;
1384 const OptionInfo& info = *iter;
1386 if (info.help.empty())
1387 con_.out << newline_;
1395 void print_help(
const CommandInfo* cur_cmd=NULL)
const {
1398 con_.out <<
"Usage: " << progname_;
1399 print_help_usage(main_, (subcommands_.size() > 0 ?
"global_" :
""));
1401 if (cur_cmd != NULL) {
1402 con_.out <<
' ' << cur_cmd->name;
1403 print_help_usage(*cur_cmd,
"command_");
1404 con_.out << newline_;
1405 print_help_args(*cur_cmd);
1409 if (subcommands_.size() > 0)
1410 con_.out <<
" <command> [args]";
1411 con_.out << newline_;
1412 if (description_.
size() > 0)
1415 print_help_args(main_, (subcommands_.size() > 0 ?
"Global " :
""));
1418 if (subcommands_.size() > 0) {
1419 con_.out << newline_ <<
"Commands:" << newline_;
1428 const StrSizeT help_indent = maxlen + SEP.size() + 1;
1430 const CommandInfo& info = *(subcommands_.find(*iter));
1431 con_.out <<
' ' <<
FmtString(info.name, maxlen);
1432 if (info.helptext.empty())
1433 con_.out << newline_;
1439 if (epilog_.
size() > 0)
1440 con_.out << newline_ << epilog_ << newline_;
1443 void print_help_general()
const {
1448 " * Flag options are boolean and will give an error if a value is supplied\n" 1449 " * Other options require a value, and in some cases may have multiple values\n" 1450 "Long options start with a double dash, example: --help\n" 1451 " * and may include a value using '=', example: --file=myfile\n" 1452 " * or may give a value with the next argument, example: --file myfile\n" 1453 "Short options are a single character and start with a single dash, example: -h\n" 1454 " * and may be combined in standard Unix/Linux fashion, example '-abc' is the same as: -a -b -c\n" 1455 " * and may include a value using '=', example: -f=myfile\n" 1456 " * or may include a value with an additional argument, example: -f myfile\n" 1457 " * or may include a value without any separator, example '-fmyfile' is the same as: -f=myfile\n" 1458 " * however a separator is required when combining options, example '-abcf=myfile' is the same as: -a -b -c -f=myfile\n" 1459 " * a short option with a value must be last when combined with flag options, to avoid confusion\n" 1460 "\nNote that in most cases options may be mixed in with arguments, but option order often does matter," 1461 " and repeated options may either accumulate or replace the previous value, depending on the option.\n" 1464 "Any option may be reset (deleted) by prefixing it with '--no-', example '--no-file' deletes option '--file'," 1465 " and the option may then be set again afterwards.\n" 1466 "\nSpecial Arguments\n" 1467 "-----------------\n\n" 1468 "* A double dash argument (--) stops option processesing and all options after this are treated as raw arguments." 1469 " This is useful for specifying options that will be passed to another program via arguments\n" 1470 "* A dash-dot argument (-.) terminates a list of multiple values (rare)\n" 1472 con_.out <<
"Evo C++ Library CommandLine processor version " <<
EVO_VERSION_STRING << newline_
1473 << FmtStringWrap(SubString(help), maxline_).set_newline(newline_);
ListType & add(const Item *data, Size size)
Append new items copied from data pointer (modifier).
Definition: list.h:2019
bool empty() const
Get whether empty.
virtual Option & maxlen(uint len)=0
Set maximum value length, or max digits if required to be numeric.
Size size() const
Get size.
Definition: list.h:759
SubString & triml(Size size)
Trim left (beginning) items.
Definition: substring.h:1307
UInt numu(int base=0) const
Convert to number value (unsigned).
Definition: string.h:4177
Holds a Newline value that can be null, which implicitly converts to NL_SYS (system default newline)...
Definition: sys.h:813
Option & addarg(const String &key, const String &help)
Add a positional argument.
Definition: commandline.h:873
Size skipws()
Advance current position for next token by skipping whitespace.
Definition: strtok.h:438
This & set_progname(const String &name)
Set program name to use with usage help.
Definition: commandline.h:728
bool token(StringT &value, char delim)
Extract next token from string.
Definition: substring.h:383
void addflag(const String &names, const String &help)
Add a global option flag.
Definition: commandline.h:811
CommandLineT< ConsoleT > This
This type.
Definition: commandline.h:138
bool tokenr_any(StringT &value, Char &found_delim, const char *delims, Size count)
Extract next token from string in reverse (from end of string) using any of given delimiters...
Definition: substring.h:497
Size findreplace(char ch, const char *str, Size size, Size max=ALL)
Find character and replace with string (modifier).
Definition: string.h:3920
Key iend(Size offset=0) const
Get index from last item using offset.
Definition: list.h:826
Basic character type (char) – see CharT.
Definition: type.h:775
Used to set command options and arguments.
Definition: commandline.h:217
void addflag(const String &names, const String &key, const String &help)
Add a global option flag.
Definition: commandline.h:801
virtual Option & default_value(const String &value)=0
Set default value for option.
bool token_line(StringT &line)
Extract next line from string.
Definition: substring.h:533
ConsoleT & get_con()
Get reference to console object used.
Definition: commandline.h:689
Random access iterator.
Definition: iter.h:904
OutT & show_error()
This writes the beginning (prefix) of an error message and returns a stream for the caller to write t...
Definition: commandline.h:1003
const T * ptr() const
Get current pointer (const).
Definition: type.h:1735
Key findanybut(const char *chars, Size count, Key start=0, Key end=END) const
Find first occurrence of any character not listed with forward search.
Definition: substring.h:873
Option & addopt(const String &names, const String &help)
Add a global option that stores a value.
Definition: commandline.h:850
Evo I/O streams and Console I/O.
Option & addchoices(const T &values)
Add one or more preset choices from string list.
Definition: commandline.h:207
String & clear()
Clear by removing all items.
Definition: string.h:4975
This & set_noexit(bool val=true)
Set no-exit flag to prevent parse() from terminating and instead have it return false.
Definition: commandline.h:749
Option & addopt(const String &names, const String &key, const String &helpname, const String &help)
Add a global option that stores a value.
Definition: commandline.h:825
Size size() const
Get size.
FmtStringWrap & set_indent(int new_indent=0)
Definition: str.h:3017
CommandInfo & addcmd(const String &name, const String &help)
Add a sub-command argument with it's own options and arguments.
Definition: commandline.h:884
Size remove(Key index, Size size=1)
Remove items (modifier).
Definition: list.h:2189
bool starts(const char *str) const
Check if starts with given terminated string.
Definition: substring.h:658
virtual Option & addchoice(const SubString &value)=0
Add one or more preset choices.
bool parse(TMap &map, int argc, const char *argv[], int offset=0)
Parse and process command-line using current option and argument info.
Definition: commandline.h:916
Size index() const
Get current index before next token.
Definition: strtok.h:30
bool empty() const
Get whether empty.
Definition: list.h:753
uint32 StrSizeT
Default Evo string size type.
Definition: sys.h:734
String container.
Definition: string.h:674
virtual ~Command()
Destructor.
Definition: commandline.h:219
Option & addarg(const String &key, const String &helpname, const String &help)
Add a positional argument.
Definition: commandline.h:862
Used to set additional option/argument information.
Definition: commandline.h:146
This & set_maxline(uint maxline)
Set new max line length for usage help output.
Definition: commandline.h:713
SubString & stripl()
Strip left (beginning) whitespace (spaces and tabs).
Definition: substring.h:1090
This & set_epilog(const String &text)
Set epilog text shown in usage help.
Definition: commandline.h:740
SubString & stripr()
Strip right (ending) whitespace (spaces and tabs).
Definition: substring.h:1135
virtual Option & numeric()=0
Require option/argument value to be numeric.
This & addver(const String &version_info)
Add version info and enable option flags to show it.
Definition: commandline.h:761
String & setn(int num, int base=fDEC)
Set as formatted signed number (modifier).
Definition: string.h:1117
ListType & addnew(Size size=1)
Append new items (modifier).
Definition: list.h:1996
const SubString & value() const
Get current token value from last call to next().
Definition: strtok.h:42
Process command-line arguments.
Definition: commandline.h:136
static const uint MAXLINE_DEFAULT
Default maxline value.
Definition: commandline.h:141
virtual Option & multi(bool val=true)=0
Allow multiple values for option/argument.
This & set_newline(const NewlineValue &nl)
Set current newline value used for output.
Definition: commandline.h:704
bool error() const
Check whether an error occurred while parsing arguments.
Definition: commandline.h:900
Option & add(const String &str)
Parse input string and add an global option or argument as described.
Definition: commandline.h:780
bool nextw(char delim)
Find next token using word delimiter.
Definition: strtok.h:278
Evo C++ Library namespace.
Definition: alg.h:11
static const EndT NONE
Special integer value for indicating no item or unknown item.
Definition: type.h:1832
Explicitly format a string.
Definition: str.h:2931
const NewlineValue & get_newline() const
Get current newline value used for output.
Definition: commandline.h:696
void addsep()
Add a global options separator in usage help.
Definition: commandline.h:789
ConsoleT::OutT OutT
Output stream type.
Definition: commandline.h:139
String & addsep(char delim=',')
Append separator/delimiter if needed (modifier).
Definition: string.h:2799
bool next(char delim)
Find next token using delimiter.
Definition: strtok.h:184
Option & addopt(const String &names, const String &helpname, const String &help)
Add a global option that stores a value.
Definition: commandline.h:837
String & add(char ch)
Append character (modifier).
Definition: string.h:2741
OutT & show_warning()
This writes the beginning (prefix) of a warning message and returns a stream for the caller to write ...
Definition: commandline.h:1019
IteratorRa< ThisType >::Const Iter
Iterator (const) - IteratorRa.
Definition: list.h:263
Shared smart pointer to single object.
Definition: ptr.h:399
String forward tokenizer.
Definition: strtok.h:112
Explicitly format a repeated character.
Definition: str.h:2914
FmtStringWrap & set_newline(Newline nl)
Definition: str.h:3022
#define EVO_VERSION_STRING
Evo version string (major.minor.patch).
Definition: evo_config.h:24
virtual Option & required(bool val=true)=0
Make this option/argument required.
bool split(char delim, T1 &left, T2 &right) const
Split at first occurrence of delimiter into left/right substrings.
Definition: substring.h:976
const Value * find(const Key &key) const
Find (lookup) value for given key (const).
Definition: maplist.h:437
Value & add(const Value &item, bool update=false)
Add or update using given item.
Definition: setlist.h:579
String & set()
Set as null and empty.
Definition: string.h:995
SubString & set(const char *data)
Set as reference to terminated string.
Definition: substring.h:353
uint32 SizeT
Default Evo container size type.
Definition: sys.h:729
Reference and access existing string data.
Definition: substring.h:229
virtual ~Option()
Destructor.
Definition: commandline.h:148
CommandLineT(const String &description)
Constructor with help description.
Definition: commandline.h:682
CommandLineT()
Default constructor.
Definition: commandline.h:673
const char * data() const
Get data pointer.