list of Options
Definition at line 63 of file CommandLine.hpp.
#include <CommandLine.hpp>
Classes | |
class | Option |
Public Member Functions | |
void | Add (char s, std::string l, std::string a, bool rep, bool req, bool *ptr, std::string predes, std::string des, bool doc=true) |
add a boolean option More... | |
void | Add (char s, std::string l, std::string a, bool rep, bool req, double *ptr, std::string predes, std::string des, bool doc=true) |
add a double option More... | |
void | Add (char s, std::string l, std::string a, bool rep, bool req, gnsstk::RinexSatID *ptr, std::string predes, std::string des, bool doc=true) |
add a RinexSatID option More... | |
void | Add (char s, std::string l, std::string a, bool rep, bool req, int *ptr, std::string predes, std::string des, bool doc=true) |
add an integer option More... | |
void | Add (char s, std::string l, std::string a, bool rep, bool req, std::string *ptr, std::string predes, std::string des, bool doc=true) |
add a string option More... | |
void | Add (char s, std::string l, std::string a, bool rep, bool req, std::vector< gnsstk::RinexSatID > *ptr, std::string predes, std::string des, bool doc=true) |
add a vector<RinexSatID> option More... | |
void | Add (char s, std::string l, std::string a, bool rep, bool req, std::vector< int > *ptr, std::string predes, std::string des, bool doc=true) |
add a vector integer option More... | |
void | Add (char s, std::string l, std::string a, bool rep, bool req, std::vector< std::string > *ptr, std::string predes, std::string des, bool doc=true) |
add a vector<string> option More... | |
void | Add_deprecated (std::string old_opt, std::string new_opt) |
void | Add_ignore (std::string opt, bool has_arg=false) |
void | Add_ignore_off (std::string opt) |
void | Add_ignore_on (std::string opt) |
CommandLine (void) | |
unsigned int | count (std::string lopt) |
void | DefineUsageString (std::string str) noexcept |
Define the text after 'Usage: '; default is '<prgm> [options] ...'. More... | |
void | DumpConfiguration (std::ostream &os, std::string tag=std::string()) |
bool | hasErrors (void) |
bool | hasHelp (void) |
void | noArgsRequired (void) |
void | noExpansion (std::string l) |
int | ProcessCommandLine (int argc, char **argv, std::string PrgmDesc, std::string &Usage, std::string &Errors, std::vector< std::string > &Unrec) |
void | setToggle (std::string lstr, bool b=true) |
~CommandLine (void) | |
Private Types | |
enum | OptionTypeEnum { typeUndefined =-1, typeBool, typeInt, typeVectorInt, typeDouble, typeString, typeVectorString, typeSat, typeVectorSat, typeCount } |
types of options supported - easily expanded More... | |
typedef enum gnsstk::CommandLine::OptionTypeEnum | typeOpt |
types of options supported - easily expanded More... | |
Private Member Functions | |
void | BuildSyntaxPage (void) |
void | Parse (std::vector< std::string > &Args, std::string &Errors, std::vector< std::string > &Unrecog) |
void | Postprocess (std::string &Errors, std::vector< std::string > &Unrecog) |
void | PreProcessArgs (const char *arg, std::vector< std::string > &Args, std::string &Errors) |
std::string | SyntaxPage (void) |
bool | ValidateCommandLine (std::string &msg) |
Private Attributes | |
int | debug |
std::map< std::string, std::string > | deprec_opts |
bool | foundErrors |
bool | help |
bool | helponly |
std::vector< std::string > | ignore_off_opts |
list of strings '–opt' that turn "ignoring of args" OFF More... | |
std::vector< std::string > | ignore_on_opts |
list of strings '–opt' that turn "ignoring of args" ON More... | |
std::vector< std::string > | ignore_opts_with_arg |
list of strings '–opt' that, with their following arg, are ignored More... | |
std::vector< std::string > | ignore_opts_without_arg |
list of strings '–opt' that are simply ignored More... | |
std::vector< Option > | options |
list of Options More... | |
int | optionsize |
bool | requireOneArg |
std::string | syntaxPage |
int | syntaxPageBuilt |
bool | verbose |
|
private |
types of options supported - easily expanded
|
private |
types of options supported - easily expanded
Enumerator | |
---|---|
typeUndefined | |
typeBool | |
typeInt | |
typeVectorInt | |
typeDouble | |
typeString | |
typeVectorString | |
typeSat | |
typeVectorSat | |
typeCount |
Definition at line 66 of file CommandLine.hpp.
|
inline |
Definition at line 152 of file CommandLine.hpp.
|
inline |
Definition at line 157 of file CommandLine.hpp.
|
inline |
add a boolean option
Definition at line 197 of file CommandLine.hpp.
|
inline |
add a double option
Definition at line 221 of file CommandLine.hpp.
|
inline |
add a RinexSatID option
Definition at line 246 of file CommandLine.hpp.
|
inline |
add an integer option
Definition at line 205 of file CommandLine.hpp.
|
inline |
add a string option
Definition at line 229 of file CommandLine.hpp.
|
inline |
add a vector<RinexSatID> option
Definition at line 254 of file CommandLine.hpp.
|
inline |
add a vector integer option
Definition at line 213 of file CommandLine.hpp.
|
inline |
add a vector<string> option
Definition at line 237 of file CommandLine.hpp.
|
inline |
add a deprecated option, that is let old_opt be equivalent to new_opt, where new_opt is the long option for one the the regular options.
Definition at line 192 of file CommandLine.hpp.
|
inline |
add an 'ignore' option, that is an option '–opt' that is simply ignored. if has_arg is true, the token following –opt (its argument) is also ignored.
Definition at line 176 of file CommandLine.hpp.
|
inline |
add an 'ignore_off' option; this is an option '–opt' that turns off the 'ignoring of options' that was started by an 'ignore_on' option.
Definition at line 188 of file CommandLine.hpp.
|
inline |
add an 'ignore_on' option; this is an option '–opt' that causes the options that follow to be ignored, until an 'ignore_off' option is found.
Definition at line 184 of file CommandLine.hpp.
|
private |
Build the syntax page.
Definition at line 381 of file CommandLine.cpp.
|
inline |
Definition at line 162 of file CommandLine.hpp.
|
inlinenoexcept |
Define the text after 'Usage: '; default is '<prgm> [options] ...'.
Definition at line 296 of file CommandLine.hpp.
void gnsstk::CommandLine::DumpConfiguration | ( | std::ostream & | os, |
std::string | tag = std::string() |
||
) |
Dump the configuration. Output is of the form longOpt Descript : values if tag is not empty (the default), begin each line with it.
Definition at line 180 of file CommandLine.cpp.
|
inline |
Definition at line 161 of file CommandLine.hpp.
|
inline |
Definition at line 160 of file CommandLine.hpp.
|
inline |
Definition at line 171 of file CommandLine.hpp.
|
inline |
modify a Vector option; string l must match long option string passed to constructor: turn off expansion of arguments ('a,b,c' -> 'a' 'b' and 'c')
Definition at line 265 of file CommandLine.hpp.
|
private |
Parse the (preprocessed) list of args.
Definition at line 679 of file CommandLine.cpp.
|
private |
Post process - convert value strings to real values.
Definition at line 803 of file CommandLine.cpp.
|
private |
Preprocess the arguments by pulling out debug, etc, replace deprecated options, drop ignored options, open –file files, open list files and parse comma-separated values
Definition at line 483 of file CommandLine.cpp.
int gnsstk::CommandLine::ProcessCommandLine | ( | int | argc, |
char ** | argv, | ||
std::string | PrgmDesc, | ||
std::string & | Usage, | ||
std::string & | Errors, | ||
std::vector< std::string > & | Unrec | ||
) |
Create the command line = list of commands; parse it
argc | the number of command line args |
argv | command line args |
PrgmDesc | string giving program description, shown at top of syntax page |
Usage | string return syntax page |
Errors | string return all error messages |
Unrec | vector of strings not recognized by parser |
Definition at line 80 of file CommandLine.cpp.
|
inline |
Modify a Bool option; string l must match long option string passed to constructor: when option is found, toggle instead of setting true If toggle is true, argument toggles the value rather than just setting it true.
lstr | long option string which identifies the option to be changed |
b | bool set 'toggle' switch to this, default true |
Definition at line 284 of file CommandLine.hpp.
|
private |
Generate the usage string (syntax page)
Definition at line 769 of file CommandLine.cpp.
|
private |
Determine if the command line, as declared, is valid.
Definition at line 294 of file CommandLine.cpp.
|
private |
Definition at line 124 of file CommandLine.hpp.
|
private |
for deprecated options - substitutions: if key is found, replace it with value; value must be the longOpt of an option. Include '–' in the strings
Definition at line 147 of file CommandLine.hpp.
|
private |
Definition at line 123 of file CommandLine.hpp.
|
private |
Definition at line 123 of file CommandLine.hpp.
|
private |
Definition at line 123 of file CommandLine.hpp.
|
private |
list of strings '–opt' that turn "ignoring of args" OFF
Definition at line 143 of file CommandLine.hpp.
|
private |
list of strings '–opt' that turn "ignoring of args" ON
Definition at line 140 of file CommandLine.hpp.
|
private |
list of strings '–opt' that, with their following arg, are ignored
Definition at line 134 of file CommandLine.hpp.
|
private |
list of strings '–opt' that are simply ignored
Definition at line 137 of file CommandLine.hpp.
|
private |
list of Options
Definition at line 131 of file CommandLine.hpp.
|
private |
Definition at line 128 of file CommandLine.hpp.
|
private |
Definition at line 123 of file CommandLine.hpp.
|
private |
Definition at line 127 of file CommandLine.hpp.
|
private |
Definition at line 126 of file CommandLine.hpp.
|
private |
Definition at line 123 of file CommandLine.hpp.