Class for a numeric string command line parameter.
More...
|
| | CommandParameterWordPtr (const char *pHelp, const char **ppParameterName, uintptr_t uParameterCount, uintptr_t uDefault, uintptr_t uMin=0, uintptr_t uMax=UINTPTR_MAX) noexcept |
| | Constructor for multiple valid commands.
|
| | CommandParameterWordPtr (const char *pHelp, const char *pParameterName, uintptr_t uDefault, uintptr_t uMin=0, uintptr_t uMax=UINTPTR_MAX) noexcept |
| | Constructor for a single valid command.
|
| int | Action (int argc, const char **argv) override |
| | Parses a numeric string.
|
| uintptr_t | GetValue (void) const noexcept |
| | Returns the value.
|
| Public Member Functions inherited from Burger::CommandParameter |
| const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
| | Get the description to the class.
|
| uint_t | IsHelpAvailable (void) const noexcept |
| | Determine if help is available.
|
| const char * | GetHelp (void) const noexcept |
| | Return the help string.
|
| const char * | get_class_name (void) const noexcept |
| | Get the name of the class.
|
| virtual | ~Base () noexcept=default |
| | Destructor.
|
|
| uintptr_t | m_uValue |
| | Parsed value.
|
| uintptr_t | m_uMin |
| | Lowest acceptable value.
|
| uintptr_t | m_uMax |
| | Highest acceptable value.
|
|
| Static Public Member Functions inherited from Burger::CommandParameter |
| static int | RemoveParms (int argc, const char **argv, int iIndexToArgv, int iRemoveCount) noexcept |
| | Remove entries from a "C" command list.
|
| static int | Process (int argc, const char **argv, const CommandParameter **ppParms, uintptr_t uParmCount, const char *pUsage=nullptr, int iMin=0, int iMax=0) noexcept |
| | Process an array of command parameters.
|
| Static Public Attributes inherited from Burger::CommandParameter |
| static const Burger::StaticRTTI | g_StaticRTTI |
| | The global description of the class.
|
| static const Burger::StaticRTTI | g_StaticRTTI |
| | The global description of the class.
|
| Protected Member Functions inherited from Burger::CommandParameter |
| | CommandParameter (const char *pHelp, const char *const *ppParameterNames, uintptr_t uParameterCount) noexcept |
| | Base class constructor.
|
| Protected Attributes inherited from Burger::CommandParameter |
| const char * | m_pHelp |
| | Pointer to the optional help string.
|
| const char *const * | m_ppParameterNames |
| | Array of "C" strings of the -parameter (Minus the -)
|
| uintptr_t | m_uParameterCount |
| | Number of possible strings to check.
|
Class for a numeric string command line parameter.
Parse an ASCII string and converts it into an integer number. Bounds checking is also performed.
- See also
- Burger::CommandParameter or Burger::CommandParameterBooleanTrue
◆ CommandParameterWordPtr() [1/2]
| Burger::CommandParameterWordPtr::CommandParameterWordPtr |
( |
const char * | pHelp, |
|
|
const char ** | ppParameterName, |
|
|
uintptr_t | uParameterCount, |
|
|
uintptr_t | uDefault, |
|
|
uintptr_t | uMin = 0, |
|
|
uintptr_t | uMax = UINTPTR_MAX ) |
|
inlinenoexcept |
Constructor for multiple valid commands.
In cases there multiple commands can trigger this command, pass a pointer to an array of "C" strings and the array size in entries to construct this parameter parser
- Note
- Do not set the count to 0, it will cause this class to treat the array pointer as a direct pointer which may not be desired behavior
- Parameters
-
| pHelp | Pointer to "C" string for usage |
| ppParameterName | Pointer to an array of "C" strings for valid inputs |
| uParameterCount | Number of entries in the array (1-XX). |
| uDefault | Default value to return if no parameter was parsed |
| uMin | Minimum allowable value |
| uMax | Maximum allowable value |
◆ CommandParameterWordPtr() [2/2]
| Burger::CommandParameterWordPtr::CommandParameterWordPtr |
( |
const char * | pHelp, |
|
|
const char * | pParameterName, |
|
|
uintptr_t | uDefault, |
|
|
uintptr_t | uMin = 0, |
|
|
uintptr_t | uMax = UINTPTR_MAX ) |
|
inlinenoexcept |
Constructor for a single valid command.
The default value is set to uDefault.
- Parameters
-
| pHelp | Pointer to "C" string for usage. |
| pParameterName | Pointer to a "C" string to match to trigger this parameter. |
| uDefault | Default value to return if no parameter was parsed |
| uMin | Minimum allowable value |
| uMax | Maximum allowable value |
◆ Action()
| int Burger::CommandParameterWordPtr::Action |
( |
int | argc, |
|
|
const char ** | argv ) |
|
overridevirtual |
Parses a numeric string.
If there is a parameter in the list, parse it as a numeric string. Test against the valid range and return either -1 if an error occurred or 2 to remove the 2 command entries.
- Parameters
-
| argc | Number of parameters in argv. |
| argv | Array of "C" strings. |
- Returns
- Returns -1 on error or 2 for success
Implements Burger::CommandParameter.
◆ GetValue()
| uintptr_t Burger::CommandParameterWordPtr::GetValue |
( |
void | | ) |
const |
|
inlinenoexcept |
Returns the value.
Returns the contained value
- Returns
- Returns the parsed value
◆ m_uMax
| uintptr_t Burger::CommandParameterWordPtr::m_uMax |
|
private |
Highest acceptable value.
◆ m_uMin
| uintptr_t Burger::CommandParameterWordPtr::m_uMin |
|
private |
◆ m_uValue
| uintptr_t Burger::CommandParameterWordPtr::m_uValue |
|
private |