Holds methods to parse and query CLI arguments.
Developers should not instantiate an object of this type but use the API that this class provides.
#include <visualizer/global_attributes.hh>
|
static void | ParseArguments (int argc, const char *const *argv) |
| Parses a list of CLI arguments and holds them as pairs key-value. More...
|
|
static bool | HasArgument (const std::string &key) |
| Query the key existence. More...
|
|
static std::string | GetArgument (const std::string &key) |
| Gets a CLI argument previously set using SetArgument. More...
|
|
◆ GetArgument()
std::string GetArgument |
( |
const std::string & |
key | ) |
|
|
static |
Gets a CLI argument previously set using SetArgument.
- Parameters
-
[in] | key | A string to index the value. |
- Returns
- A std::string with the argument.
- Exceptions
-
std::runtime_error | When there is no value for key . |
◆ HasArgument()
bool HasArgument |
( |
const std::string & |
key | ) |
|
|
static |
Query the key
existence.
- Parameters
-
[in] | key | A string to index the value. |
- Returns
- true When
key
exists, false otherwise.
◆ ParseArguments()
void ParseArguments |
( |
int |
argc, |
|
|
const char *const * |
argv |
|
) |
| |
|
static |
Parses a list of CLI arguments and holds them as pairs key-value.
Each element of argv
must be "--{KEY}={VALUE}". The key will be KEY, and the value will be VALUE. Note that "--" and "=" are necessary. Each element of argv
should not have: white spaces, '\n', '\r', '\t' characters and must be at least 5 characters long including "--" and "=".
- Parameters
-
[in] | argc | The number of elements in argv . |
[in] | argv | A vector of string constants that hold the arguments. |
- Exceptions
-
std::runtime_error | When any item of argv contains: white spaces, '\n', '\r' or '\t' characters. |
std::runtime_error | When any item of argv does not start with "--". |
std::runtime_error | When any item of argv does not have "=" from the third position on. |
std::runtime_error | When key or value any item of argv are empty strings. |
The documentation for this class was generated from the following files: