|
BEEP-8 Helper Lib 1.0.0
|
Class for parsing command line arguments. More...
#include <argparse.h>
Public Types | |
| enum | Result { OK = 0 , SHOWED_HELP = -128 , UNKNOWN_FLAG , BAD_PARAM , UNKNOWN_VAR } |
| Enumeration of possible results from parsing arguments. More... | |
Public Member Functions | |
| int | GetVarInt (std::string name_, int if_not_found_) |
| Get the integer value of a variable. | |
| std::string | GetVarStr (std::string name_, std::string if_not_found_) |
| Get the string value of a variable. | |
| Result | ParseArgs (const std::vector< std::string > &args) |
| Parse command line arguments. | |
| void | ShowHelp () |
| Display help information for all arguments. | |
| int | AddArgument (std::string name_, std::string short_alias_, std::string help_, Argument::Action action_=Argument::store_true) |
| Add an argument to the parser. | |
| ArgumentParser () | |
| Constructor for ArgumentParser. | |
Public Attributes | |
| bool | _showed_help = false |
| Flag indicating whether help was shown. | |
Class for parsing command line arguments.
| int ArgumentParser::AddArgument | ( | std::string | name_, |
| std::string | short_alias_, | ||
| std::string | help_, | ||
| Argument::Action | action_ = Argument::store_true ) |
Add an argument to the parser.
| name_ | Full name of the argument |
| short_alias_ | Short alias of the argument |
| help_ | Help description for the argument |
| action_ | Action associated with the argument (default is store_true) |
| int ArgumentParser::GetVarInt | ( | std::string | name_, |
| int | if_not_found_ ) |
Get the integer value of a variable.
| name_ | Name of the variable |
| if_not_found_ | Value to return if the variable is not found |
| std::string ArgumentParser::GetVarStr | ( | std::string | name_, |
| std::string | if_not_found_ ) |
Get the string value of a variable.
| name_ | Name of the variable |
| if_not_found_ | Value to return if the variable is not found |
| ArgumentParser::Result ArgumentParser::ParseArgs | ( | const std::vector< std::string > & | args | ) |
Parse command line arguments.
| args | Vector of argument strings |