matf-rg-engine 1.0.0
Base for project for the Computer Graphics course at Faculty of Mathematics, University of Belgrade
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
engine::util::ArgParser Class Reference

Parses command line arguments. More...

#include <ArgParser.hpp>

Public Member Functions

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.
 

Static Public Member Functions

static ArgParserinstance ()
 

Private Member Functions

std::string get_arg_value (std::string_view arg_name)
 Get the string value of an argument.
 
 ArgParser ()=default
 

Private Attributes

int m_argc = 0
 
char ** m_argv = nullptr
 

Friends

class App
 

Detailed Description

Parses command line arguments.

Constructor & Destructor Documentation

◆ ArgParser()

engine::util::ArgParser::ArgParser ( )
privatedefault

Member Function Documentation

◆ 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
TThe type of the argument.
Parameters
nameThe name of the argument.
default_valueThe 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
argcThe number of command line arguments.
argvThe 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_nameThe name of the argument.
Returns
The string value of the argument.

Friends And Related Symbol Documentation

◆ App

friend class App
friend

Member Data Documentation

◆ 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: