Used to process - or filter, if you will - command arguments.
More...
#include <ArgFilter.h>
Used to process - or filter, if you will - command arguments.
- See also
- Args
-
data
-
Shell
◆ datatype
Possible datatypes for an argument value.
Enumerator |
---|
STRING | String type.
|
INT | Integer type.
|
FLOAT | Floating point type.
|
BOOL | Boolean type.
|
◆ ArgFilter() [1/2]
etm::ArgFilter::ArgFilter |
( |
| ) |
|
◆ ArgFilter() [2/2]
◆ addAlias()
void etm::ArgFilter::addAlias |
( |
const std::string & |
name | ) |
|
Adds alias for last filter entree.
- Note
- Silently overwrites any pre-existing aliases of the same name.
- Parameters
-
- Exceptions
-
std::out_of_range | If there aren't any filters |
◆ addFilter()
void etm::ArgFilter::addFilter |
( |
const std::string & |
name, |
|
|
datatype |
type |
|
) |
| |
Add another filter, aka command parameter.
- Note
- Does not account for filters that have the same
name
.
- Parameters
-
[in] | name | The name of the parameter. This is what's used to lookup the parameter. |
[in] | type | The expected type of the parameter |
◆ datatypeToString()
static const char* etm::ArgFilter::datatypeToString |
( |
datatype |
val | ) |
|
|
static |
Converts a datatype to its string representation.
Returns "[invalid enum]" upon failure.
- Parameters
-
- Returns
- A c-string representing the datatype.
◆ filter()
bool etm::ArgFilter::filter |
( |
const std::vector< std::string > & |
arguments, |
|
|
Args & |
out, |
|
|
std::string & |
errMsg |
|
) |
| |
Filter/process/parse given arguments.
- Note
- Assumes that
arguments.size() > 0
- Parameters
-
[in] | arguments | The arguments split up into parts |
[out] | out | The Args object to store data in |
[out] | errMsg | String to dump error messages |
- Returns
true
if encountered an error
◆ getDefaultErrorHandle()
static ErrorHandle& etm::ArgFilter::getDefaultErrorHandle |
( |
| ) |
|
|
static |
◆ getErrorHandle()
◆ getStoreDefaultErrorHandle()
◆ getUsage()
std::string etm::ArgFilter::getUsage |
( |
| ) |
|
◆ setDefaultErrorHandle()
static void etm::ArgFilter::setDefaultErrorHandle |
( |
ErrorHandle & |
handle | ) |
|
|
static |
Set the default error handle.
The default error handle is what's set as the error handle of an ArgFilter if none are provided.
- Note
- Stores a pointer to
handle
, so you must keep it allocated.
- Parameters
-
[in] | handle | Reference to the new error handle |
- See also
- getDefaultErrorHandle()
◆ setErrorHandle()
void etm::ArgFilter::setErrorHandle |
( |
ErrorHandle & |
errorHandle | ) |
|
◆ setMaxArrayArgs()
void etm::ArgFilter::setMaxArrayArgs |
( |
unsigned int |
count | ) |
|
Sets the maximum number of flagless parameters that can be passed.
- Parameters
-
[in] | count | The max, inclusive |
◆ setUsage()
void etm::ArgFilter::setUsage |
( |
const std::string & |
usage | ) |
|
Sets the string that is printed when the filter fails to parse arguments.
- Parameters
-
[in] | usage | The string to print |
- See also
- getUsage()
The documentation for this class was generated from the following file: