VoiceMan
|
Parses command line arguments and prints help screen. More...
Classes | |
struct | USEDPARAM |
Public Member Functions | |
CmdArgsParser (CmdArg *allParams) | |
The constructor. | |
const std::string | operator[] (const std::string &name) const |
Returns additional argument value of command line parameter. | |
bool | parse (int argc, char *argv[]) |
Performs parsing of arguments provided by user. | |
void | printHelp () const |
Prints description of all available arguments. | |
bool | used (const std::string &name) const |
Checks if specified parameter was used at program call. | |
Public Attributes | |
const std::vector< std::string > & | files |
The set of arguments specified after known command line parameters. |
This class receives command line arguments and compares them with the table specified in application source code to determine invalid usage and easy command line check. Also this class can print prepared help screen with all available arguments and their descriptions.
CmdArgsParser::CmdArgsParser | ( | CmdArg * | allParams | ) |
Number of all available arguments is determined implicitly by the items of allParam argument. The last item in this array must have space in its shortName field.
[in] | allParams | The array with available command line arguments |
const std::string CmdArgsParser::operator[] | ( | const std::string & | name | ) | const |
Use this operator to get value of the specified parameter.
[in] | The | name of parameter to get argument of, specified by longName field |
bool CmdArgsParser::parse | ( | int | argc, |
char * | argv[] | ||
) |
This method performs complete command line parsing and fills all internal structures with the result. If there are invalid arguments specified by user this method prints error description and returns zero.
[in] | argc | The argc parameter received from main() function call |
[in] | argv | The argv parameter received from main() function call |
void CmdArgsParser::printHelp | ( | ) | const |
Use this method to generate complete help screen.
bool CmdArgsParser::used | ( | const std::string & | name | ) | const |
Use this method to check command line argument using.
[in] | name | The parameter name to check specified by longName field value |