![]() |
AJA NTV2 SDK
17.6.0.2675
NTV2 SDK 17.6.0.2675
|
#include <commandline.h>
Public Member Functions | |
| AJACommandLineParser (int flags=0) | |
| AJACommandLineParser (const std::string &name, int flags=0) | |
| AJACommandLineParser (const AJACommandLineParser &other) | |
| ~AJACommandLineParser () | |
| void | operator= (const AJACommandLineParser &other) |
| void | Clear () |
| void | Reset (bool clearAll=false) |
| void | Dump () |
| bool | HaveOption (const std::string &name) const |
| bool | HavePositionalArg (const std::string &name) const |
| AJAStringList | PositionalArgs () const |
| bool | OptionByName (const std::string &name, AJACommandLineOption &opt) const |
| bool | AddSubParser (AJACommandLineParser *sp) |
| bool | Parse (const AJAStringList &args) |
| bool | Parse (int argc, const char *argv[]) |
| bool | Parse (int argc, char *argv[]) |
| bool | IsSet (const std::string &name) const |
| AJAVariant | Value (const std::string &name, size_t index=0) const |
| AJAVariantList | Values (const std::string &name) const |
| std::string | ValueString (const std::string &name, size_t index=0) const |
| AJAStringList | ValueStrings (const std::string &name) const |
| bool | AddOption (const AJACommandLineOption &option) |
| bool | AddOptions (const std::vector< AJACommandLineOption > &options) |
| bool | AddHelpOption (bool useShortName=false) |
| bool | AddUsageOption (bool useShortName=false) |
| std::string | Name () const |
| void | SetUsageText (const std::string &usageText) |
| std::string | UsageText () |
| void | SetHelpText (const std::string &helpText) |
| std::string | HelpText () |
| std::string | CommandName () |
Class that represents a command-line args parser.
Definition at line 179 of file commandline.h.
|
explicit |
Definition at line 155 of file commandline.cpp.
|
explicit |
Definition at line 162 of file commandline.cpp.
| AJACommandLineParser::AJACommandLineParser | ( | const AJACommandLineParser & | other | ) |
Definition at line 169 of file commandline.cpp.
| AJACommandLineParser::~AJACommandLineParser | ( | ) |
Definition at line 174 of file commandline.cpp.
| bool AJACommandLineParser::AddHelpOption | ( | bool | useShortName = false | ) |
Add default -?/–help option to this args parser. The caller must check if IsSet("help"), and then call HelpText, in order to retrieve the help text string for printing to the console.
| [in] | useShortName | Specify whether or not the help option should consume the '-h' shortname. |
Definition at line 573 of file commandline.cpp.
| bool AJACommandLineParser::AddOption | ( | const AJACommandLineOption & | option | ) |
Add a AJACommandLineOption to this args parser. This method will fail if another option with the same name has already been added to this parser.
| [in] | option | The AJACommandLineOption to add. |
true if option was added successfully, otherwise false. Definition at line 533 of file commandline.cpp.
| bool AJACommandLineParser::AddOptions | ( | const std::vector< AJACommandLineOption > & | options | ) |
Add a list of AJACommandLineOptions to this args parser. This method will fail if the list contains an option whose name has already been added to the args parser.
| [in] | options | The list of AJACommandLineOptions to add. |
true if options are added successfully, otherwise false. Definition at line 558 of file commandline.cpp.
| bool AJACommandLineParser::AddSubParser | ( | AJACommandLineParser * | sp | ) |
Register another AJACommandLineParser instance with this parser.
| [in] | sp | The subparser to add. |
true if the subparser was added successfully, otherwise false. Definition at line 295 of file commandline.cpp.
| bool AJACommandLineParser::AddUsageOption | ( | bool | useShortName = false | ) |
Add default –usage option to this args parser. The caller must check if IsSet("usage"), and then call GetUsageText, in order to retrieve the usage text string for printing to the console.
| [in] | useShortName | Specify whether or not the usage option should consume the '-u' shortname. |
Definition at line 585 of file commandline.cpp.
| void AJACommandLineParser::Clear | ( | ) |
Delete all sub-parsers and options from this AJACommandLineParser.
Definition at line 204 of file commandline.cpp.
| std::string AJACommandLineParser::CommandName | ( | ) |
Definition at line 797 of file commandline.cpp.
| void AJACommandLineParser::Dump | ( | ) |
Dump the contents of this AJACommandLineParser to stdout.
Definition at line 226 of file commandline.cpp.
| bool AJACommandLineParser::HaveOption | ( | const std::string & | name | ) | const |
Determine this AJACommandLineParser has an option with the specified name.
| [in] | name | The name of the option to look up. |
true if the option is found, otherwise false. Definition at line 255 of file commandline.cpp.
| bool AJACommandLineParser::HavePositionalArg | ( | const std::string & | name | ) | const |
Determine this AJACommandLineParser has a positional arg.
| [in] | name | The positional arg string to look up. |
true if the positional arg is found, otherwise false. Definition at line 267 of file commandline.cpp.
| std::string AJACommandLineParser::HelpText | ( | ) |
Get the help text string for this args parser.
Definition at line 650 of file commandline.cpp.
| bool AJACommandLineParser::IsSet | ( | const std::string & | name | ) | const |
Tests if the specified arg was set on the command-line.
| [in] | name | The arg name. |
true if the arg was set, otherwise false. Definition at line 462 of file commandline.cpp.
| std::string AJACommandLineParser::Name | ( | ) | const |
Get the name of this command-line args parser.
Definition at line 596 of file commandline.cpp.
| void AJACommandLineParser::operator= | ( | const AJACommandLineParser & | other | ) |
Definition at line 178 of file commandline.cpp.
| bool AJACommandLineParser::OptionByName | ( | const std::string & | name, |
| AJACommandLineOption & | opt | ||
| ) | const |
Look up AJACommandLineOption by name in this AJACommandLineParser.
| [in] | name | The name of the option to look up. |
| [out] | opt | The AJACommandLineOption to retrieve. |
true if the option is found, otherwise false. Definition at line 282 of file commandline.cpp.
| bool AJACommandLineParser::Parse | ( | const AJAStringList & | args | ) |
Parse a list of strings containing command-line args.
| [in] | args | The list of arg strings. |
true if the command-line args were parsed successfully, otherwise false. Definition at line 306 of file commandline.cpp.
| bool AJACommandLineParser::Parse | ( | int | argc, |
| char * | argv[] | ||
| ) |
Parse a list of strings containing command-line args.
| [in] | argc | The arg count. |
| [in] | argv | The list of arg strings. |
Definition at line 450 of file commandline.cpp.
| bool AJACommandLineParser::Parse | ( | int | argc, |
| const char * | argv[] | ||
| ) |
Parse a list of strings containing command-line args.
| [in] | argc | The arg count. |
| [in] | argv | The list of arg strings. |
Definition at line 438 of file commandline.cpp.
| AJAStringList AJACommandLineParser::PositionalArgs | ( | ) | const |
Get a vector containing all positional args parsed from the command line args.
Definition at line 277 of file commandline.cpp.
| void AJACommandLineParser::Reset | ( | bool | clearAll = false | ) |
Reset the values and "set" state of all sub-parsers and options in this AJACommandLineParser.
| [in] | clearAll | Delete all sub-parsers and options instead of resetting them? |
Definition at line 210 of file commandline.cpp.
| void AJACommandLineParser::SetHelpText | ( | const std::string & | helpText | ) |
Set the help text string to print if help is invoked by the args parser.
| [in] | helpText | The help text string. |
Definition at line 638 of file commandline.cpp.
| void AJACommandLineParser::SetUsageText | ( | const std::string & | usageText | ) |
Set the usage text string to print if help is invoked by the args parser.
| [in] | usageText | The usage text string. |
Definition at line 608 of file commandline.cpp.
| std::string AJACommandLineParser::UsageText | ( | ) |
Get the usage text string for this args parser.
Definition at line 620 of file commandline.cpp.
| AJAVariant AJACommandLineParser::Value | ( | const std::string & | name, |
| size_t | index = 0 |
||
| ) | const |
Get a variant representing the value of the specified arg name.
| [in] | name | The arg name. |
| [in] | index | The index of the value to get. |
Definition at line 478 of file commandline.cpp.
| AJAVariantList AJACommandLineParser::Values | ( | const std::string & | name | ) | const |
Get a list of variants representing the values of the specified arg name.
| [in] | name | The arg name. |
Definition at line 483 of file commandline.cpp.
| std::string AJACommandLineParser::ValueString | ( | const std::string & | name, |
| size_t | index = 0 |
||
| ) | const |
Get the string value for the specified arg name.
| [in] | name | The arg name. |
| [in] | index | The index of value to get. |
Definition at line 496 of file commandline.cpp.
| AJAStringList AJACommandLineParser::ValueStrings | ( | const std::string & | name | ) | const |
Get a list of string values for the specified arg name.
| [in] | name | The arg name. |
Definition at line 517 of file commandline.cpp.