|
TrueReality
v0.1.1912
|
A a command line argument parser class that helps to create, manage, and pass commands to other systems. More...
#include <ArgumentParser.h>
Classes | |
| class | Parameter |
Public Types | |
| enum | ErrorSeverity { ErrorSeverity::BENIGN = osg::ArgumentParser::ErrorSeverity::BENIGN, ErrorSeverity::CRITICAL = osg::ArgumentParser::ErrorSeverity::CRITICAL } |
| using | ErrorMessageMap = std::map< std::string, ErrorSeverity > |
Public Member Functions | |
| ArgumentParser (int *argc, char **argv) | |
| Default constructor that takes the argc and argv from the main function for command line parsing. More... | |
| ~ArgumentParser () | |
| Destructor. More... | |
| osg::ArgumentParser & | GetOSGArgumentParser () |
| Gets internal osg argument parser. More... | |
| const osg::ArgumentParser & | GetOSGArgumentParser () const |
| Gets the internal osg argument parser. More... | |
| bool | IsOption (const char *str) const |
| Return true if the specified string is an option in the form -option or –option. More... | |
| bool | IsString (const char *str) const |
| Return true if string is non-NULL and not an option in the form -option or –option. More... | |
| bool | IsNumber (const char *str) const |
| Return true if specified parameter is a number. More... | |
| bool | IsBool (const char *str) const |
| Return true if specified parameter is a bool. More... | |
| void | SetApplicationUsage (ApplicationUsage *usage) |
| Sets application usage. More... | |
| ApplicationUsage * | GetApplicationUsage () |
| Gets application usage. More... | |
| const ApplicationUsage * | GetApplicationUsage () const |
| Gets application usage. More... | |
| int & | GetArgc () |
| Return the argument count. More... | |
| char ** | GetArgv () |
| Return the argument array. More... | |
| std::string | GetApplicationName () const |
| Return the application name, as specified by argv[0]. More... | |
| int | Find (const std::string &str) const |
| Return the position of an occurrence of a string in the argument list. More... | |
| bool | IsOption (int pos) const |
| Return true if the specified parameter is an option in the form of -option or –option. More... | |
| bool | IsString (int pos) const |
| Return true if the specified parameter is a string not in the form of an option. More... | |
| bool | IsNumber (int pos) const |
| Return true if the specified parameter is a number. More... | |
| bool | ContainsOptions () const |
| Query if this object contains options. More... | |
| void | Remove (int pos, int num=1) |
| Remove one or more arguments from the argv argument list, and decrement the argc respectively. More... | |
| bool | Match (int pos, const std::string &str) const |
| Return true if the specified argument matches the given string. More... | |
| bool | Read (const std::string &str) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (const std::string &str, Parameter value1) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (const std::string &str, Parameter value1, Parameter value2) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (const std::string &str, Parameter value1, Parameter value2, Parameter value3) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8) |
| Search for an occurrence of a string in the argument list. More... | |
| bool | Read (int pos, const std::string &str) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Read (int pos, const std::string &str, Parameter value1) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Read (int pos, const std::string &str, Parameter value1, Parameter value2) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8) |
| If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. More... | |
| bool | Errors (ErrorSeverity severity=ErrorSeverity::BENIGN) const |
| Return the error flag, true if an error has occurred when reading arguments. More... | |
| void | ReportError (const std::string &message, ErrorSeverity severity=ErrorSeverity::CRITICAL) |
| Report an error message by adding to the ErrorMessageMap. More... | |
| void | ReportRemainingOptionsAsUnrecognized (ErrorSeverity severity=ErrorSeverity::BENIGN) |
| For each remaining option, report it as unrecognized. More... | |
| void | WriteErrorMessages (std::ostream &output, ErrorSeverity severity=ErrorSeverity::BENIGN) |
| Write error messages to the given ostream, if at or above the given severity. More... | |
| ApplicationUsage::Type | ReadHelpType () |
| This convenience method handles help requests on the command line. More... | |
| void | SetApplicationName (const std::string &name) |
| Sets the Applications Name. More... | |
| void | SetDescription (const std::string &desc) |
| If non-empty, the Description is typically shown by the Help Handler as text on the Help display (which also lists keyboard abbreviations.) More... | |
| const std::string & | GetDescription () const |
| Gets the description. More... | |
| void | AddUsageExplanation (ApplicationUsage::Type type, const std::string &option, const std::string &explanation) |
| Adds an usage explanation. More... | |
| void | SetCommandLineUsage (const std::string &explanation) |
| Sets command line usage. More... | |
| const std::string & | GetCommandLineUsage () const |
| Gets command line usage. More... | |
| void | AddCommandLineOption (const std::string &option, const std::string &explanation, const std::string &defaultValue="") |
| Adds a command line option. More... | |
| void | SetCommandLineOptions (const ApplicationUsage::UsageMap &usageMap) |
| Sets command line options. More... | |
| const ApplicationUsage::UsageMap & | GetCommandLineOptions () const |
| Gets command line options. More... | |
| void | SetCommandLineOptionsDefaults (const ApplicationUsage::UsageMap &usageMap) |
| Sets command line options defaults. More... | |
| const ApplicationUsage::UsageMap & | GetCommandLineOptionsDefaults () const |
| Gets command line options defaults. More... | |
| void | AddEnvironmentalVariable (const std::string &option, const std::string &explanation, const std::string &defaultValue="") |
| Adds an environmental variable usage explanation. More... | |
| void | SetEnvironmentalVariables (const ApplicationUsage::UsageMap &usageMap) |
| Sets environmental variables usage. More... | |
| const ApplicationUsage::UsageMap & | GetEnvironmentalVariables () const |
| Gets environmental variables usage. More... | |
| void | SetEnvironmentalVariablesDefaults (const ApplicationUsage::UsageMap &usageMap) |
| Sets environmental variables usage default usage map. More... | |
| const ApplicationUsage::UsageMap & | GetEnvironmentalVariablesDefaults () const |
| Gets environmental variables usage default usage map. More... | |
| void | AddKeyboardMouseBinding (const std::string &prefix, int key, const std::string &explanation) |
| Adds a keyboard mouse binding usage. More... | |
| void | AddKeyboardMouseBinding (int key, const std::string &explanation) |
| void | AddKeyboardMouseBinding (const std::string &option, const std::string &explanation) |
| Adds a keyboard mouse binding usage. More... | |
| void | SetKeyboardMouseBindings (const ApplicationUsage::UsageMap &usageMap) |
| Sets keyboard mouse bindings usage. More... | |
| const ApplicationUsage::UsageMap & | GetKeyboardMouseBindings () const |
| Gets keyboard mouse bindings usage. More... | |
| void | GetFormattedString (std::string &str, const ApplicationUsage::UsageMap &usageMap, unsigned int widthOfOutput=80, bool showDefaults=false, const ApplicationUsage::UsageMap &usageMapDef=ApplicationUsage::UsageMap()) |
| Gets formatted string. More... | |
| void | Write (std::ostream &output, const ApplicationUsage::UsageMap &usageMap, unsigned int widthOfOutput=80, bool showDefaults=false, const ApplicationUsage::UsageMap &usageMapDef=ApplicationUsage::UsageMap()) |
| Writes out all the settings to the screen. More... | |
| void | Write (std::ostream &output, ApplicationUsage::Type type=ApplicationUsage::Type::COMMAND_LINE_OPTION, unsigned int widthOfOutput=80, bool showDefaults=false) |
| Writes. More... | |
| void | WriteEnvironmentSettings (std::ostream &output) |
| Writes out the environment settings. More... | |
Protected Attributes | |
| std::unique_ptr< osg::ArgumentParser > | mArgParser |
| The argument parser. More... | |
| std::unique_ptr< ApplicationUsage > | mAppUsage |
A a command line argument parser class that helps to create, manage, and pass commands to other systems.
Definition at line 47 of file ArgumentParser.h.
| using trUtil::ArgumentParser::ErrorMessageMap = std::map<std::string, ErrorSeverity> |
Definition at line 57 of file ArgumentParser.h.
|
strong |
| Enumerator | |
|---|---|
| BENIGN | |
| CRITICAL | |
Definition at line 51 of file ArgumentParser.h.
| trUtil::ArgumentParser::ArgumentParser | ( | int * | argc, |
| char ** | argv | ||
| ) |
Default constructor that takes the argc and argv from the main function for command line parsing.
| [in,out] | argc | If non-null, the argc. |
| [in,out] | argv | If non-null, the argv. |
Definition at line 122 of file ArgumentParser.cpp.
References mAppUsage, and mArgParser.
| trUtil::ArgumentParser::~ArgumentParser | ( | ) |
Destructor.
Definition at line 129 of file ArgumentParser.cpp.
| void trUtil::ArgumentParser::AddCommandLineOption | ( | const std::string & | option, |
| const std::string & | explanation, | ||
| const std::string & | defaultValue = "" |
||
| ) |
Adds a command line option.
| option | The option. |
| explanation | The explanation. |
| defaultValue | (Optional) The default value. |
Definition at line 441 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::AddEnvironmentalVariable | ( | const std::string & | option, |
| const std::string & | explanation, | ||
| const std::string & | defaultValue = "" |
||
| ) |
Adds an environmental variable usage explanation.
| option | The option. |
| explanation | The explanation. |
| defaultValue | (Optional) The default value. |
Definition at line 471 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::AddKeyboardMouseBinding | ( | const std::string & | prefix, |
| int | key, | ||
| const std::string & | explanation | ||
| ) |
Adds a keyboard mouse binding usage.
| prefix | The prefix. |
| key | The key. |
| explanation | The explanation. |
Definition at line 501 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::AddKeyboardMouseBinding | ( | int | key, |
| const std::string & | explanation | ||
| ) |
Definition at line 507 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::AddKeyboardMouseBinding | ( | const std::string & | option, |
| const std::string & | explanation | ||
| ) |
Adds a keyboard mouse binding usage.
| option | The option. |
| explanation | The explanation. |
Definition at line 513 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::AddUsageExplanation | ( | ApplicationUsage::Type | type, |
| const std::string & | option, | ||
| const std::string & | explanation | ||
| ) |
Adds an usage explanation.
| type | The type. |
| option | The option. |
| explanation | The explanation. |
Definition at line 423 of file ArgumentParser.cpp.
References mAppUsage.
| bool trUtil::ArgumentParser::ContainsOptions | ( | ) | const |
Query if this object contains options.
Definition at line 231 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Errors | ( | ErrorSeverity | severity = ErrorSeverity::BENIGN | ) | const |
Return the error flag, true if an error has occurred when reading arguments.
| severity | (Optional) The severity. |
Definition at line 357 of file ArgumentParser.cpp.
References mArgParser.
| int trUtil::ArgumentParser::Find | ( | const std::string & | str | ) | const |
Return the position of an occurrence of a string in the argument list.
Return -1 if no string is found.
| str | The string. |
Definition at line 207 of file ArgumentParser.cpp.
References mArgParser.
| std::string trUtil::ArgumentParser::GetApplicationName | ( | ) | const |
Return the application name, as specified by argv[0].
Definition at line 201 of file ArgumentParser.cpp.
References mArgParser.
| ApplicationUsage * trUtil::ArgumentParser::GetApplicationUsage | ( | ) |
Gets application usage.
Definition at line 177 of file ArgumentParser.cpp.
References mAppUsage.
| const ApplicationUsage * trUtil::ArgumentParser::GetApplicationUsage | ( | ) | const |
Gets application usage.
Definition at line 183 of file ArgumentParser.cpp.
References mAppUsage.
| int & trUtil::ArgumentParser::GetArgc | ( | ) |
Return the argument count.
Definition at line 189 of file ArgumentParser.cpp.
References mArgParser.
| char ** trUtil::ArgumentParser::GetArgv | ( | ) |
Return the argument array.
Definition at line 195 of file ArgumentParser.cpp.
References mArgParser.
| const ApplicationUsage::UsageMap & trUtil::ArgumentParser::GetCommandLineOptions | ( | ) | const |
Gets command line options.
Definition at line 453 of file ArgumentParser.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ArgumentParser::GetCommandLineOptionsDefaults | ( | ) | const |
Gets command line options defaults.
Definition at line 465 of file ArgumentParser.cpp.
References mAppUsage.
| const std::string & trUtil::ArgumentParser::GetCommandLineUsage | ( | ) | const |
Gets command line usage.
Definition at line 435 of file ArgumentParser.cpp.
References mAppUsage.
| const std::string & trUtil::ArgumentParser::GetDescription | ( | ) | const |
Gets the description.
Definition at line 417 of file ArgumentParser.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ArgumentParser::GetEnvironmentalVariables | ( | ) | const |
Gets environmental variables usage.
Definition at line 483 of file ArgumentParser.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ArgumentParser::GetEnvironmentalVariablesDefaults | ( | ) | const |
Gets environmental variables usage default usage map.
Definition at line 495 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::GetFormattedString | ( | std::string & | str, |
| const ApplicationUsage::UsageMap & | usageMap, | ||
| unsigned int | widthOfOutput = 80, |
||
| bool | showDefaults = false, |
||
| const ApplicationUsage::UsageMap & | usageMapDef = ApplicationUsage::UsageMap() |
||
| ) |
Gets formatted string.
| [in,out] | str | The string. |
| usageMap | The usage map. | |
| widthOfOutput | (Optional) Width of the output. | |
| showDefaults | (Optional) True to show, false to hide the defaults. | |
| usageMapDef | (Optional) The usage map default. |
Definition at line 531 of file ArgumentParser.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ArgumentParser::GetKeyboardMouseBindings | ( | ) | const |
Gets keyboard mouse bindings usage.
Definition at line 525 of file ArgumentParser.cpp.
References mAppUsage.
| osg::ArgumentParser & trUtil::ArgumentParser::GetOSGArgumentParser | ( | ) |
Gets internal osg argument parser.
Definition at line 134 of file ArgumentParser.cpp.
References mArgParser.
| const osg::ArgumentParser & trUtil::ArgumentParser::GetOSGArgumentParser | ( | ) | const |
Gets the internal osg argument parser.
Definition at line 140 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::IsBool | ( | const char * | str | ) | const |
Return true if specified parameter is a bool.
| str | The string. |
Definition at line 164 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::IsNumber | ( | const char * | str | ) | const |
Return true if specified parameter is a number.
| str | The string. |
Definition at line 158 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::IsNumber | ( | int | pos | ) | const |
Return true if the specified parameter is a number.
| pos | The position. |
Definition at line 225 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::IsOption | ( | const char * | str | ) | const |
Return true if the specified string is an option in the form -option or –option.
| str | The string. |
Definition at line 146 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::IsOption | ( | int | pos | ) | const |
Return true if the specified parameter is an option in the form of -option or –option.
| pos | The position. |
Definition at line 213 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::IsString | ( | const char * | str | ) | const |
Return true if string is non-NULL and not an option in the form -option or –option.
| str | The string. |
Definition at line 152 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::IsString | ( | int | pos | ) | const |
Return true if the specified parameter is a string not in the form of an option.
| pos | The position. |
Definition at line 219 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Match | ( | int | pos, |
| const std::string & | str | ||
| ) | const |
Return true if the specified argument matches the given string.
| pos | The position. |
| str | The string. |
Definition at line 243 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | const std::string & | str | ) |
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
Definition at line 249 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | const std::string & | str, |
| Parameter | value1 | ||
| ) |
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
| value1 | The first value. |
Definition at line 255 of file ArgumentParser.cpp.
References mArgParser.
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
| value1 | The first value. |
| value2 | The second value. |
Definition at line 261 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | const std::string & | str, |
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3 | ||
| ) |
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
Definition at line 267 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | const std::string & | str, |
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4 | ||
| ) |
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
Definition at line 273 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | const std::string & | str, |
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4, | ||
| Parameter | value5 | ||
| ) |
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
| value5 | The fifth value. |
Definition at line 279 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | const std::string & | str, |
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4, | ||
| Parameter | value5, | ||
| Parameter | value6 | ||
| ) |
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
| value5 | The fifth value. |
| value6 | The value 6. |
Definition at line 285 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | const std::string & | str, |
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4, | ||
| Parameter | value5, | ||
| Parameter | value6, | ||
| Parameter | value7 | ||
| ) |
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
| value5 | The fifth value. |
| value6 | The value 6. |
| value7 | The value 7. |
Definition at line 291 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | const std::string & | str, |
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4, | ||
| Parameter | value5, | ||
| Parameter | value6, | ||
| Parameter | value7, | ||
| Parameter | value8 | ||
| ) |
Search for an occurrence of a string in the argument list.
If found, remove that occurrence and return true. Otherwise, return false.
| str | The String to read. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
| value5 | The fifth value. |
| value6 | The value 6. |
| value7 | The value 7. |
| value8 | The value 8. |
Definition at line 297 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
Definition at line 303 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str, | ||
| Parameter | value1 | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
| value1 | The first value. |
Definition at line 309 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str, | ||
| Parameter | value1, | ||
| Parameter | value2 | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
| value1 | The first value. |
| value2 | The second value. |
Definition at line 315 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str, | ||
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3 | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
Definition at line 321 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str, | ||
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4 | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
Definition at line 327 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str, | ||
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4, | ||
| Parameter | value5 | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
| value5 | The fifth value. |
Definition at line 333 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str, | ||
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4, | ||
| Parameter | value5, | ||
| Parameter | value6 | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
| value5 | The fifth value. |
| value6 | The sixth value. |
Definition at line 339 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str, | ||
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4, | ||
| Parameter | value5, | ||
| Parameter | value6, | ||
| Parameter | value7 | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
| value5 | The fifth value. |
| value6 | The sixth value. |
| value7 | The seventh value. |
Definition at line 345 of file ArgumentParser.cpp.
References mArgParser.
| bool trUtil::ArgumentParser::Read | ( | int | pos, |
| const std::string & | str, | ||
| Parameter | value1, | ||
| Parameter | value2, | ||
| Parameter | value3, | ||
| Parameter | value4, | ||
| Parameter | value5, | ||
| Parameter | value6, | ||
| Parameter | value7, | ||
| Parameter | value8 | ||
| ) |
If the argument value at the specified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true.
Otherwise, return false.
| pos | The position. |
| str | The string. |
| value1 | The first value. |
| value2 | The second value. |
| value3 | The third value. |
| value4 | The fourth value. |
| value5 | The fifth value. |
| value6 | The sixth value. |
| value7 | The seventh value. |
| value8 | The eighth value. |
Definition at line 351 of file ArgumentParser.cpp.
References mArgParser.
| ApplicationUsage::Type trUtil::ArgumentParser::ReadHelpType | ( | ) |
This convenience method handles help requests on the command line.
Return the type(s) of help requested. The return value of this function is suitable for passing into getApplicationUsage()->write(). If ApplicationUsage::NO_HELP is returned then no help commandline option was found on the command line.
Definition at line 381 of file ArgumentParser.cpp.
References trUtil::ApplicationUsage::COMMAND_LINE_OPTION, trUtil::ApplicationUsage::ENVIRONMENTAL_VARIABLE, trUtil::ApplicationUsage::KEYBOARD_MOUSE_BINDING, mArgParser, and trUtil::ApplicationUsage::NO_HELP.
| void trUtil::ArgumentParser::Remove | ( | int | pos, |
| int | num = 1 |
||
| ) |
Remove one or more arguments from the argv argument list, and decrement the argc respectively.
| pos | The position. |
| num | (Optional) Number of. |
Definition at line 237 of file ArgumentParser.cpp.
References mArgParser.
| void trUtil::ArgumentParser::ReportError | ( | const std::string & | message, |
| ErrorSeverity | severity = ErrorSeverity::CRITICAL |
||
| ) |
Report an error message by adding to the ErrorMessageMap.
| message | The message. |
| severity | (Optional) The severity. |
Definition at line 363 of file ArgumentParser.cpp.
References mArgParser.
| void trUtil::ArgumentParser::ReportRemainingOptionsAsUnrecognized | ( | ErrorSeverity | severity = ErrorSeverity::BENIGN | ) |
For each remaining option, report it as unrecognized.
| severity | (Optional) The severity. |
Definition at line 369 of file ArgumentParser.cpp.
References mArgParser.
| void trUtil::ArgumentParser::SetApplicationName | ( | const std::string & | name | ) |
Sets the Applications Name.
It is used in Application description.
| name | The name. |
Definition at line 405 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::SetApplicationUsage | ( | ApplicationUsage * | usage | ) |
Sets application usage.
| [in,out] | usage | If non-null, the usage. |
Definition at line 170 of file ArgumentParser.cpp.
References mAppUsage, and mArgParser.
| void trUtil::ArgumentParser::SetCommandLineOptions | ( | const ApplicationUsage::UsageMap & | usageMap | ) |
Sets command line options.
| usageMap | The usage map. |
Definition at line 447 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::SetCommandLineOptionsDefaults | ( | const ApplicationUsage::UsageMap & | usageMap | ) |
Sets command line options defaults.
| usageMap | The usage map. |
Definition at line 459 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::SetCommandLineUsage | ( | const std::string & | explanation | ) |
Sets command line usage.
| explanation | The explanation. |
Definition at line 429 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::SetDescription | ( | const std::string & | desc | ) |
If non-empty, the Description is typically shown by the Help Handler as text on the Help display (which also lists keyboard abbreviations.)
| desc | The description. |
Definition at line 411 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::SetEnvironmentalVariables | ( | const ApplicationUsage::UsageMap & | usageMap | ) |
Sets environmental variables usage.
| usageMap | The usage map. |
Definition at line 477 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::SetEnvironmentalVariablesDefaults | ( | const ApplicationUsage::UsageMap & | usageMap | ) |
Sets environmental variables usage default usage map.
| usageMap | The usage map. |
Definition at line 489 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::SetKeyboardMouseBindings | ( | const ApplicationUsage::UsageMap & | usageMap | ) |
Sets keyboard mouse bindings usage.
| usageMap | The usage map. |
Definition at line 519 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::Write | ( | std::ostream & | output, |
| const ApplicationUsage::UsageMap & | usageMap, | ||
| unsigned int | widthOfOutput = 80, |
||
| bool | showDefaults = false, |
||
| const ApplicationUsage::UsageMap & | usageMapDef = ApplicationUsage::UsageMap() |
||
| ) |
Writes out all the settings to the screen.
| [in,out] | output | The output stream. |
| usageMap | The usage map. | |
| widthOfOutput | (Optional) Width of the output. | |
| showDefaults | (Optional) True to show, false to hide the defaults. | |
| usageMapDef | (Optional) The ud. |
Definition at line 537 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::Write | ( | std::ostream & | output, |
| ApplicationUsage::Type | type = ApplicationUsage::Type::COMMAND_LINE_OPTION, |
||
| unsigned int | widthOfOutput = 80, |
||
| bool | showDefaults = false |
||
| ) |
Writes.
| [in,out] | output | The output stream. |
| type | (Optional) The type. | |
| widthOfOutput | (Optional) Width of the output. | |
| showDefaults | (Optional) True to show, false to hide the defaults. |
Definition at line 543 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::WriteEnvironmentSettings | ( | std::ostream & | output | ) |
Writes out the environment settings.
| [in,out] | output | The output. |
Definition at line 549 of file ArgumentParser.cpp.
References mAppUsage.
| void trUtil::ArgumentParser::WriteErrorMessages | ( | std::ostream & | output, |
| ErrorSeverity | severity = ErrorSeverity::BENIGN |
||
| ) |
Write error messages to the given ostream, if at or above the given severity.
| [in,out] | output | The output. |
| severity | (Optional) The severity. |
Definition at line 375 of file ArgumentParser.cpp.
References mArgParser.
|
protected |
Definition at line 1030 of file ArgumentParser.h.
Referenced by AddCommandLineOption(), AddEnvironmentalVariable(), AddKeyboardMouseBinding(), AddUsageExplanation(), ArgumentParser(), GetApplicationUsage(), GetCommandLineOptions(), GetCommandLineOptionsDefaults(), GetCommandLineUsage(), GetDescription(), GetEnvironmentalVariables(), GetEnvironmentalVariablesDefaults(), GetFormattedString(), GetKeyboardMouseBindings(), SetApplicationName(), SetApplicationUsage(), SetCommandLineOptions(), SetCommandLineOptionsDefaults(), SetCommandLineUsage(), SetDescription(), SetEnvironmentalVariables(), SetEnvironmentalVariablesDefaults(), SetKeyboardMouseBindings(), Write(), and WriteEnvironmentSettings().
|
protected |
The argument parser.
Definition at line 1029 of file ArgumentParser.h.
Referenced by ArgumentParser(), ContainsOptions(), Errors(), Find(), GetApplicationName(), GetArgc(), GetArgv(), GetOSGArgumentParser(), IsBool(), IsNumber(), IsOption(), IsString(), Match(), Read(), ReadHelpType(), Remove(), ReportError(), ReportRemainingOptionsAsUnrecognized(), SetApplicationUsage(), and WriteErrorMessages().