Parses command line arguments.
More...
#include <ArgParser.hpp>
|
template<typename T > |
std::optional< T > | arg (std::string_view name, std::optional< T > default_value={}) |
| Get the value of an argument. Supported types: bool, int, long long, float, double, std::string.
|
|
void | initialize (int argc, char **argv) |
| Initialize the ArgParser with the command line arguments.
|
|
|
std::string | get_arg_value (std::string_view arg_name) |
| Get the string value of an argument.
|
|
| ArgParser ()=default |
|
Parses command line arguments.
◆ ArgParser()
engine::util::ArgParser::ArgParser |
( |
| ) |
|
|
privatedefault |
◆ instance()
ArgParser * engine::util::ArgParser::instance |
( |
| ) |
|
|
static |
◆ arg()
template<typename T >
std::optional< T > engine::util::ArgParser::arg |
( |
std::string_view |
name, |
|
|
std::optional< T > |
default_value = {} |
|
) |
| |
|
inline |
Get the value of an argument. Supported types: bool, int, long long, float, double, std::string.
- Template Parameters
-
T | The type of the argument. |
- Parameters
-
name | The name of the argument. |
default_value | The default value of the argument. |
- Returns
- The value of the argument.
◆ initialize()
void engine::util::ArgParser::initialize |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Initialize the ArgParser with the command line arguments.
- Parameters
-
argc | The number of command line arguments. |
argv | The command line arguments. |
◆ get_arg_value()
std::string engine::util::ArgParser::get_arg_value |
( |
std::string_view |
arg_name | ) |
|
|
private |
Get the string value of an argument.
- Parameters
-
arg_name | The name of the argument. |
- Returns
- The string value of the argument.
◆ App
◆ m_argc
int engine::util::ArgParser::m_argc = 0 |
|
private |
◆ m_argv
char** engine::util::ArgParser::m_argv = nullptr |
|
private |
The documentation for this class was generated from the following files: