|
TrueReality
v0.1.1912
|
An application usage class for the argument parser. More...
#include <ApplicationUsage.h>
Public Types | |
| enum | Type { Type::NO_HELP = osg::ApplicationUsage::NO_HELP, Type::COMMAND_LINE_OPTION = osg::ApplicationUsage::COMMAND_LINE_OPTION, Type::ENVIRONMENTAL_VARIABLE = osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE, Type::KEYBOARD_MOUSE_BINDING = osg::ApplicationUsage::KEYBOARD_MOUSE_BINDING, Type::HELP_ALL = KEYBOARD_MOUSE_BINDING | ENVIRONMENTAL_VARIABLE | COMMAND_LINE_OPTION } |
| using | UsageMap = std::map< std::string, std::string > |
| The message to command usage map. More... | |
Public Member Functions | |
| ApplicationUsage () | |
| Default constructor. More... | |
| ApplicationUsage (osg::ApplicationUsage *applicationUsage) | |
| Wraps an osg ApplicationUsage, and uses it as the internal class. More... | |
| ApplicationUsage (const std::string &commandLineUsage) | |
| Default constructor. More... | |
| ~ApplicationUsage () | |
| Destructor. More... | |
| void | SetApplicationName (const std::string &name) |
| Sets the Applications Name. More... | |
| const std::string & | GetApplicationName () const |
| Gets the stored application 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 (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 UsageMap &usageMap) |
| Sets command line options. More... | |
| const UsageMap & | GetCommandLineOptions () const |
| Gets command line options. More... | |
| void | SetCommandLineOptionsDefaults (const UsageMap &usageMap) |
| Sets command line options defaults. More... | |
| const 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 UsageMap &usageMap) |
| Sets environmental variables usage. More... | |
| const UsageMap & | GetEnvironmentalVariables () const |
| Gets environmental variables usage. More... | |
| void | SetEnvironmentalVariablesDefaults (const UsageMap &usageMap) |
| Sets environmental variables usage default usage map. More... | |
| const 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) |
| Adds a keyboard mouse binding usage. More... | |
| void | AddKeyboardMouseBinding (const std::string &option, const std::string &explanation) |
| Adds a keyboard mouse binding usage. More... | |
| void | SetKeyboardMouseBindings (const UsageMap &usageMap) |
| Sets keyboard mouse bindings usage. More... | |
| const UsageMap & | GetKeyboardMouseBindings () const |
| Gets keyboard mouse bindings usage. More... | |
| void | GetFormattedString (std::string &str, const UsageMap &um, unsigned int widthOfOutput=80, bool showDefaults=false, const UsageMap &ud=UsageMap()) |
| Gets formatted string. More... | |
| void | Write (std::ostream &output, const UsageMap &um, unsigned int widthOfOutput=80, bool showDefaults=false, const UsageMap &ud=UsageMap()) |
| Writes out all the settings to the screen. More... | |
| void | Write (std::ostream &output, Type type=Type::COMMAND_LINE_OPTION, unsigned int widthOfOutput=80, bool showDefaults=false) |
| Writes. More... | |
| void | WriteEnvironmentSettings (std::ostream &output) |
| Writes out the environment settings. More... | |
| operator osg::ApplicationUsage & () | |
| Implicit conversion operator to OSG ApplicationUsage. More... | |
| operator const osg::ApplicationUsage & () const | |
| Implicit conversion operator to OSG ApplicationUsage. More... | |
| operator osg::ApplicationUsage * () | |
| Implicit conversion operator to OSG ApplicationUsage. More... | |
| operator const osg::ApplicationUsage * () const | |
Protected Attributes | |
| osg::ref_ptr< osg::ApplicationUsage > | mAppUsage = nullptr |
An application usage class for the argument parser.
Definition at line 45 of file ApplicationUsage.h.
| using trUtil::ApplicationUsage::UsageMap = std::map<std::string, std::string> |
The message to command usage map.
Definition at line 50 of file ApplicationUsage.h.
|
strong |
| Enumerator | |
|---|---|
| NO_HELP | |
| COMMAND_LINE_OPTION | |
| ENVIRONMENTAL_VARIABLE | |
| KEYBOARD_MOUSE_BINDING | |
| HELP_ALL | |
Definition at line 52 of file ApplicationUsage.h.
| trUtil::ApplicationUsage::ApplicationUsage | ( | ) |
| trUtil::ApplicationUsage::ApplicationUsage | ( | osg::ApplicationUsage * | applicationUsage | ) |
Wraps an osg ApplicationUsage, and uses it as the internal class.
| [in,out] | applicationUsage | The application usage. |
Definition at line 38 of file ApplicationUsage.cpp.
References mAppUsage.
| trUtil::ApplicationUsage::ApplicationUsage | ( | const std::string & | commandLineUsage | ) |
Default constructor.
| commandLineUsage | The command line usage. |
Definition at line 44 of file ApplicationUsage.cpp.
References mAppUsage.
| trUtil::ApplicationUsage::~ApplicationUsage | ( | ) |
Destructor.
Definition at line 50 of file ApplicationUsage.cpp.
| void trUtil::ApplicationUsage::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 97 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::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 127 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::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 157 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::AddKeyboardMouseBinding | ( | int | key, |
| const std::string & | explanation | ||
| ) |
Adds a keyboard mouse binding usage.
| key | The key. |
| explanation | The explanation. |
Definition at line 163 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::AddKeyboardMouseBinding | ( | const std::string & | option, |
| const std::string & | explanation | ||
| ) |
Adds a keyboard mouse binding usage.
| option | The option. |
| explanation | The explanation. |
Definition at line 169 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::AddUsageExplanation | ( | 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 79 of file ApplicationUsage.cpp.
References mAppUsage.
| const std::string & trUtil::ApplicationUsage::GetApplicationName | ( | ) | const |
Gets the stored application name.
Definition at line 61 of file ApplicationUsage.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ApplicationUsage::GetCommandLineOptions | ( | ) | const |
Gets command line options.
Definition at line 109 of file ApplicationUsage.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ApplicationUsage::GetCommandLineOptionsDefaults | ( | ) | const |
Gets command line options defaults.
Definition at line 121 of file ApplicationUsage.cpp.
References mAppUsage.
| const std::string & trUtil::ApplicationUsage::GetCommandLineUsage | ( | ) | const |
Gets command line usage.
Definition at line 91 of file ApplicationUsage.cpp.
References mAppUsage.
| const std::string & trUtil::ApplicationUsage::GetDescription | ( | ) | const |
Gets the description.
Definition at line 73 of file ApplicationUsage.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ApplicationUsage::GetEnvironmentalVariables | ( | ) | const |
Gets environmental variables usage.
Definition at line 139 of file ApplicationUsage.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ApplicationUsage::GetEnvironmentalVariablesDefaults | ( | ) | const |
Gets environmental variables usage default usage map.
Definition at line 151 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::GetFormattedString | ( | std::string & | str, |
| const UsageMap & | um, | ||
| unsigned int | widthOfOutput = 80, |
||
| bool | showDefaults = false, |
||
| const UsageMap & | ud = UsageMap() |
||
| ) |
Gets formatted string.
| [in,out] | str | The string. |
| um | The usage map. | |
| widthOfOutput | (Optional) Width of the output. | |
| showDefaults | (Optional) True to show, false to hide the defaults. | |
| ud | (Optional) The usage map default. |
Definition at line 187 of file ApplicationUsage.cpp.
References mAppUsage.
| const ApplicationUsage::UsageMap & trUtil::ApplicationUsage::GetKeyboardMouseBindings | ( | ) | const |
Gets keyboard mouse bindings usage.
Definition at line 181 of file ApplicationUsage.cpp.
References mAppUsage.
| trUtil::ApplicationUsage::operator const osg::ApplicationUsage & | ( | ) | const |
Implicit conversion operator to OSG ApplicationUsage.
Definition at line 217 of file ApplicationUsage.cpp.
References mAppUsage.
| trUtil::ApplicationUsage::operator const osg::ApplicationUsage * | ( | ) | const |
Definition at line 229 of file ApplicationUsage.cpp.
References mAppUsage.
| trUtil::ApplicationUsage::operator osg::ApplicationUsage & | ( | ) |
Implicit conversion operator to OSG ApplicationUsage.
Definition at line 211 of file ApplicationUsage.cpp.
References mAppUsage.
| trUtil::ApplicationUsage::operator osg::ApplicationUsage * | ( | ) |
Implicit conversion operator to OSG ApplicationUsage.
Definition at line 223 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::SetApplicationName | ( | const std::string & | name | ) |
Sets the Applications Name.
It is used in Application description
| name | The name. |
Definition at line 55 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::SetCommandLineOptions | ( | const UsageMap & | usageMap | ) |
Sets command line options.
| usageMap | The usage map. |
Definition at line 103 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::SetCommandLineOptionsDefaults | ( | const UsageMap & | usageMap | ) |
Sets command line options defaults.
| usageMap | The usage map. |
Definition at line 115 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::SetCommandLineUsage | ( | const std::string & | explanation | ) |
Sets command line usage.
| explanation | The explanation. |
Definition at line 85 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::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 67 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::SetEnvironmentalVariables | ( | const UsageMap & | usageMap | ) |
Sets environmental variables usage.
| usageMap | The usage map. |
Definition at line 133 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::SetEnvironmentalVariablesDefaults | ( | const UsageMap & | usageMap | ) |
Sets environmental variables usage default usage map.
| usageMap | The usage map. |
Definition at line 145 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::SetKeyboardMouseBindings | ( | const UsageMap & | usageMap | ) |
Sets keyboard mouse bindings usage.
| usageMap | The usage map. |
Definition at line 175 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::Write | ( | std::ostream & | output, |
| const UsageMap & | um, | ||
| unsigned int | widthOfOutput = 80, |
||
| bool | showDefaults = false, |
||
| const UsageMap & | ud = UsageMap() |
||
| ) |
Writes out all the settings to the screen.
| [in,out] | output | The output stream. |
| um | The usage map. | |
| widthOfOutput | (Optional) Width of the output. | |
| showDefaults | (Optional) True to show, false to hide the defaults. | |
| ud | (Optional) The ud. |
Definition at line 193 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::Write | ( | std::ostream & | output, |
| Type | type = 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 199 of file ApplicationUsage.cpp.
References mAppUsage.
| void trUtil::ApplicationUsage::WriteEnvironmentSettings | ( | std::ostream & | output | ) |
Writes out the environment settings.
| [in,out] | output | The output. |
Definition at line 205 of file ApplicationUsage.cpp.
References mAppUsage.
|
protected |
Definition at line 386 of file ApplicationUsage.h.
Referenced by AddCommandLineOption(), AddEnvironmentalVariable(), AddKeyboardMouseBinding(), AddUsageExplanation(), ApplicationUsage(), GetApplicationName(), GetCommandLineOptions(), GetCommandLineOptionsDefaults(), GetCommandLineUsage(), GetDescription(), GetEnvironmentalVariables(), GetEnvironmentalVariablesDefaults(), GetFormattedString(), GetKeyboardMouseBindings(), operator const osg::ApplicationUsage &(), operator const osg::ApplicationUsage *(), operator osg::ApplicationUsage &(), operator osg::ApplicationUsage *(), SetApplicationName(), SetCommandLineOptions(), SetCommandLineOptionsDefaults(), SetCommandLineUsage(), SetDescription(), SetEnvironmentalVariables(), SetEnvironmentalVariablesDefaults(), SetKeyboardMouseBindings(), Write(), and WriteEnvironmentSettings().