Structure for holding the definition of potential options to pass on the command line.
More...
#include <posix/app/chilictl/common/Args.hpp>
|
| ArgOpt (char aShortArg, const char *aLongArg, ArgPerm aArgPerm=ArgPerm::NO_ARG) |
| Construct an ArgOpt data structure. More...
|
|
void | SetHelpString (const char *aHelpString) |
| Set the help string of the option. More...
|
|
void | SetArgHint (const char *aArgHint) |
| Set the short argument hint string, describing the argument (eg "yes|no", "path", "value) More...
|
|
void | SetCallback (argCallback aCallback) |
| Set the callback to be called when the option is detected. More...
|
|
template<class T > |
void | SetCallback (argCallbackMemRaw< T > aCallback, T &aInstance) |
| Set the callback to be called when the option is detected. More...
|
|
int | GetCallCount (void) |
| Get the number of times this option was detected during parsing. More...
|
|
Structure for holding the definition of potential options to pass on the command line.
◆ ArgPerm
Enumeration for whether or not an option permits/requires arguments.
Enumerator |
---|
NO_ARG | No argument allowed to option.
|
OPTIONAL_ARG | Option has optional argument.
|
MANDATORY_ARG | Option requires an argument to be provided.
|
◆ ArgOpt()
ca::ArgOpt::ArgOpt |
( |
char |
aShortArg, |
|
|
const char * |
aLongArg, |
|
|
ArgPerm |
aArgPerm = ArgPerm::NO_ARG |
|
) |
| |
Construct an ArgOpt data structure.
- Parameters
-
aShortArg | Short form option (or '\0' if none) |
aLongArg | Long form option (or NULL if none) |
aArgPerm | |
- See also
- ArgPerm
◆ GetCallCount()
int ca::ArgOpt::GetCallCount |
( |
void |
| ) |
|
|
inline |
Get the number of times this option was detected during parsing.
This is incremented just before calling the callback.
- Returns
- Count of the number of times this option has been detected so far during parsing.
◆ SetArgHint()
void ca::ArgOpt::SetArgHint |
( |
const char * |
aArgHint | ) |
|
|
inline |
Set the short argument hint string, describing the argument (eg "yes|no", "path", "value)
- Parameters
-
aArgHint | Pointer to a arg hint string with static lifetime (e.g. a string constant) |
◆ SetCallback() [1/2]
void ca::ArgOpt::SetCallback |
( |
argCallback |
aCallback | ) |
|
|
inline |
Set the callback to be called when the option is detected.
- Parameters
-
aCallback | The callback to be called, or NULL for none. |
◆ SetCallback() [2/2]
template<class T >
void ca::ArgOpt::SetCallback |
( |
argCallbackMemRaw< T > |
aCallback, |
|
|
T & |
aInstance |
|
) |
| |
|
inline |
Set the callback to be called when the option is detected.
- Parameters
-
aCallback | Function pointer to member function to call |
aInstance | Instance to call the member function on |
◆ SetHelpString()
void ca::ArgOpt::SetHelpString |
( |
const char * |
aHelpString | ) |
|
|
inline |
Set the help string of the option.
- Parameters
-
aHelpString | Pointer to a help string with static lifetime (e.g. a string constant) |
◆ Args
The documentation for this class was generated from the following files: