Shiokaze Framework
A research-oriented fluid solver for computer graphics
cmdparser Class Reference

Class that parses command line arguments. More...

#include <cmdparser.h>

Inheritance diagram for cmdparser:
configuration

Public Member Functions

 cmdparser ()
 Default constructor.
 
 cmdparser (int argc, const char *argv[])
 Constructor for cmdparser. More...
 
 cmdparser (const cmdparser &parser)
 Copy constructor for cmdparser. More...
 
 cmdparser (std::map< std::string, std::string > dictionary)
 Constructor for cmdparser. More...
 
void parse (std::map< std::string, std::string > dictionary)
 Parse dictionary and set arguments. More...
 
void parse (int argc, const char *argv[])
 Analyze arguments and set from the arguments called from main function. More...
 
void rebuild_arg_str ()
 Parse dictionary and set arguments.
 
std::string get_arg_string () const
 Get the organized string of arguments. More...
 
- Public Member Functions inherited from configuration
 configuration ()
 Default constructor for configuration.
 
 configuration (std::map< std::string, std::string > dictionary)
 Constructor for configuration. More...
 
void print_variables () const
 Print the currently set parameters.
 
void print_help () const
 Print a help manual of the currently set parameters.
 
void print_splash () const
 Print splash greeting messsages.
 
void check_touched () const
 Check if all the parameters are loaded by the program. More...
 
bool is_parameter_set (std::string name) const
 Check if a parameter with the name is set via command line. More...
 
bool check_set (std::string name) const
 Check if a parameter with the name is set. More...
 
std::string get_current_group_name (bool argument_name=false) const
 Get the name of the currently focused group (or argument name). More...
 
bool stack_empty () const
 Get if the group stack is empty. More...
 
void push_group (const credit &info)
 Push the group to the top of the group stack. More...
 
void push_group (std::string name, std::string argument_name="", std::string author="", std::string address="", std::tuple< int, int, int > date=std::tuple< int, int, int >(0, 0, 0), double version=0.0)
 Push the group to the top of the group stack. More...
 
void pop_group ()
 Remove the current group from the gruop stack.
 
bool get_integer (std::string name, int &value, std::string description=std::string())
 Get the integer parameter. More...
 
void set_integer (std::string name, int value)
 Set the integer parameter. More...
 
void set_default_integer (std::string name, int value)
 Set default integer parameter. More...
 
bool get_unsigned (std::string name, unsigned &value, std::string description=std::string())
 Get the unsigned integer parameter. More...
 
void set_unsigned (std::string name, unsigned value)
 Set the unsigned integer parameter. More...
 
void set_default_unsigned (std::string name, unsigned value)
 Set default unsgined integer parameter. More...
 
bool get_bool (std::string name, bool &value, std::string description=std::string())
 Get the boolean parameter. More...
 
void set_bool (std::string name, bool value)
 Set the boolean parameter. More...
 
void set_default_bool (std::string name, bool value)
 Set default boolean parameter. More...
 
double get_double (std::string name, double &value, std::string description=std::string())
 Get the parameter of double type. More...
 
void set_double (std::string name, double value)
 Set the parameter of double type. More...
 
void set_default_double (std::string name, double value)
 Set default parameter of double type. More...
 
bool get_real (std::string name, Real &value, std::string description=std::string())
 Get the parameter of Real type. More...
 
void set_real (std::string name, Real value)
 Set the parameter of Real type. More...
 
void set_default_real (std::string name, Real value)
 Set default parameter of Real type. More...
 
bool get_vec2i (std::string name, int value[2], std::string description=std::string())
 Get the parameter of vec2i type. More...
 
void set_vec2i (std::string name, const int value[2])
 Set the parameter of vec2i type. More...
 
void set_default_vec2i (std::string name, const int value[2])
 Set default parameter of vec2i type. More...
 
bool get_vec2d (std::string name, double value[2], std::string description=std::string())
 Get the parameter of vec2d type. More...
 
void set_vec2d (std::string name, const double value[2])
 Set the parameter of vec2d type. More...
 
void set_default_vec2d (std::string name, const double value[2])
 Set default parameter of vec2d type. More...
 
bool get_vec3i (std::string name, int value[3], std::string description=std::string())
 Get the parameter of vec3i type. More...
 
void set_vec3i (std::string name, const int value[3])
 Set the parameter of vec3i type. More...
 
void set_default_vec3i (std::string name, const int value[3])
 Set default parameter of vec3i type. More...
 
bool get_vec3d (std::string name, double value[3], std::string description=std::string())
 Get the parameter of vec3d type. More...
 
void set_vec3d (std::string name, const double value[3])
 Set the parameter of vec3d type. More...
 
void set_default_vec3d (std::string name, const double value[3])
 Set default parameter of vec3d type. More...
 
bool get_vec4d (std::string name, double value[4], std::string description=std::string())
 Get the parameter of vec4d type. More...
 
void set_vec4d (std::string name, const double value[4])
 Set the parameter of vec4d type. More...
 
void set_default_vec4d (std::string name, const double value[4])
 Set default parameter of vec4d type. More...
 
bool get_string (std::string name, std::string &value, std::string description=std::string())
 Get the string parameter. More...
 
void set_string (std::string name, std::string value)
 Set string parameter. More...
 
void set_default_string (std::string name, std::string value)
 Set default string parameter. More...
 
bool exist (std::string name) const
 Get if the parameter of the input name exists. More...
 
const std::map< std::string, std::string > & get_dictionary () const
 Get the dictionary of parameter. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from configuration
static void print_bar (std::string str="")
 Print the input message surrounded by --—.
 
static void print_center (std::string str)
 Print the input message at the center of the line.
 

Detailed Description

Class that parses command line arguments.

Constructor & Destructor Documentation

◆ cmdparser() [1/3]

cmdparser::cmdparser ( int  argc,
const char *  argv[] 
)
inline

Constructor for cmdparser.

Parameters
[in]argcNumber of arguments.
[in]argvList of arguments.

◆ cmdparser() [2/3]

cmdparser::cmdparser ( const cmdparser parser)
inline

Copy constructor for cmdparser.

Parameters
[in]parserA reference to an instance of cmdparser to copy.

◆ cmdparser() [3/3]

cmdparser::cmdparser ( std::map< std::string, std::string >  dictionary)
inline

Constructor for cmdparser.

Parameters
[in]dictionaryA set of arguments.

Member Function Documentation

◆ get_arg_string()

std::string cmdparser::get_arg_string ( ) const
inline

Get the organized string of arguments.

Returns
Organized string of arguments.

◆ parse() [1/2]

void cmdparser::parse ( int  argc,
const char *  argv[] 
)
inline

Analyze arguments and set from the arguments called from main function.

Parameters
[in]argcNumber of arguments.
[in]argvList of arguments.

◆ parse() [2/2]

void cmdparser::parse ( std::map< std::string, std::string >  dictionary)
inline

Parse dictionary and set arguments.

Parameters
[in]dictionaryA set of arguments.

The documentation for this class was generated from the following file: