![]() |
AJA NTV2 SDK
18.0.0.2717
NTV2 SDK 18.0.0.2717
|
#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 | SetFlags (int flags) |
| 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 578 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 538 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 563 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 300 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 590 of file commandline.cpp.
| void AJACommandLineParser::Clear | ( | ) |
Delete all sub-parsers and options from this AJACommandLineParser.
Definition at line 209 of file commandline.cpp.
| std::string AJACommandLineParser::CommandName | ( | ) |
Definition at line 802 of file commandline.cpp.
| void AJACommandLineParser::Dump | ( | ) |
Dump the contents of this AJACommandLineParser to stdout.
Definition at line 231 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 260 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 272 of file commandline.cpp.
| std::string AJACommandLineParser::HelpText | ( | ) |
Get the help text string for this args parser.
Definition at line 655 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 467 of file commandline.cpp.
| std::string AJACommandLineParser::Name | ( | ) | const |
Get the name of this command-line args parser.
Definition at line 601 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 287 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 311 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 455 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 443 of file commandline.cpp.
| AJAStringList AJACommandLineParser::PositionalArgs | ( | ) | const |
Get a vector containing all positional args parsed from the command line args.
Definition at line 282 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 215 of file commandline.cpp.
| void AJACommandLineParser::SetFlags | ( | int | flags | ) |
Override internal parser flags.
Definition at line 204 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 643 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 613 of file commandline.cpp.
| std::string AJACommandLineParser::UsageText | ( | ) |
Get the usage text string for this args parser.
Definition at line 625 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 483 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 488 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 501 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 522 of file commandline.cpp.