|
Fancy argparser
Single file argument parser for c++
|
namespace of argument parser constants and Classes can be changed if ARGPARSE_NAMESPACE_NAME macro specified during compilation. More...
Classes | |
| class | Argument |
| This class represents argument configuration which should be passed to ArgumentParser objects instance. More... | |
| struct | NamedArgSpec |
| Aggregate description of a named argument, for keyword-style construction. More... | |
| struct | PositionalArgSpec |
| Aggregate description of a positional argument, for keyword-style construction with C++20 designated initializers. More... | |
| class | ArgumentParsed |
| Class which represent actual parsed argument in case of successfully parsing. More... | |
| class | ArgumentsObject |
| Class that carries result of real parsing Indicates if parsing is successful and allows to get ArgumentParsed object in that case. More... | |
| class | ArgumentParser |
| Main class of argument parser hold all user arguments from code and orchestrate other classes in order to parse command line input. More... | |
Enumerations | |
| enum class | ArgTypeCast : int { e_String , e_int , e_longlong , e_double , e_bool } |
| Supported types for argument If needed type is not in this list, then just use e_String. More... | |
Functions | |
| Argument | CreateNamedArgument (const std::string &shortName="", const std::string &longName="", const int argsCount=1, ArgTypeCast argType=ArgTypeCast::e_String, const bool required=true, const std::string &help="") |
| Helper function to create named argument. | |
| Argument | CreatePositionalArgument (const std::string &positionalName="", const int argsCount=1, ArgTypeCast argType=ArgTypeCast::e_String, const bool required=true, const std::string &help="") |
| Helper function to create positional argument. | |
| Argument | CreateNamedArgument (const NamedArgSpec &spec) |
| Keyword-style factory for a named argument. | |
| Argument | CreatePositionalArgument (const PositionalArgSpec &spec) |
| Keyword-style factory for a positional argument. | |
Variables | |
| const int | kAnyArgCount = -1 |
| constant to indicate arguments with various count from 0 to infinite | |
| const int | kFromOneToInfiniteArgCount = -2 |
| constant to indicate arguments with various count from 1 to infinite | |
namespace of argument parser constants and Classes can be changed if ARGPARSE_NAMESPACE_NAME macro specified during compilation.
By default is namespace name is "argparse"
|
strong |
Supported types for argument If needed type is not in this list, then just use e_String.
| Enumerator | |
|---|---|
| e_String | |
| e_int | |
| e_longlong | |
| e_double | |
| e_bool | |
Definition at line 103 of file argparse.h.
|
inline |
Keyword-style factory for a named argument.
See NamedArgSpec.
| spec | aggregate of the argument's properties |
Definition at line 621 of file argparse.h.
|
inline |
Helper function to create named argument.
| shortName | Short name if needed. Will be used with single prefix. Short name could be auto-generated if possible when m_allowAbbrev in ArgumentParsed set to true) |
| longName | Full name of argument |
| argsCount | Count of arguments (use kFromOneToInfiniteArgCount or kAnyArgCount for various arguments count) |
| argType | e_String, e_int, e_longlong, e_double, e_bool |
| required | Marker if argument should be passed or ignored if missed. |
| help | Initial part of help for current argument in case of auto-generated help. |
Definition at line 568 of file argparse.h.
|
inline |
Keyword-style factory for a positional argument.
See PositionalArgSpec.
| spec | aggregate of the argument's properties |
Definition at line 641 of file argparse.h.
|
inline |
Helper function to create positional argument.
| positionalName | Name of positional argument to access from code. |
| argsCount | Count of arguments (use kFromOneToInfiniteArgCount or kAnyArgCount for various arguments count) |
| argType | e_String, e_int, e_longlong, e_double, e_bool |
| required | Marker if argument should be passed or ignored if missed. |
| help | Initial part of help for current argument in case of auto-generated help. |
Definition at line 587 of file argparse.h.
| const int ARGPARSE_NAMESPACE_NAME::kAnyArgCount = -1 |
constant to indicate arguments with various count from 0 to infinite
Definition at line 114 of file argparse.h.
| const int ARGPARSE_NAMESPACE_NAME::kFromOneToInfiniteArgCount = -2 |
constant to indicate arguments with various count from 1 to infinite
Definition at line 117 of file argparse.h.