![]() |
HAL
|
#include <program_arguments.h>
Public Member Functions | |
ProgramArguments (int argc, const char **argv) | |
ProgramArguments () | |
~ProgramArguments ()=default | |
void | get_original_arguments (int *argc, const char ***argv) |
std::vector< std::string > | get_set_options () const |
bool | is_option_set (const std::string &flag) const |
void | set_option (const std::string &flag, const std::string ¶meter) |
void | set_option (const std::string &flag, const std::vector< std::string > ¶meters) |
bool | set_option (const std::string &flag, const std::set< std::string > &equivalent_flags, const std::vector< std::string > ¶meters) |
std::string | get_parameter (const std::string &flag) const |
std::vector< std::string > | get_parameters (const std::string &flag) const |
Holds the program arguments that have been passed to HAL using the command line or at any other point in time during execution.
Definition at line 45 of file program_arguments.h.
hal::ProgramArguments::ProgramArguments | ( | int | argc, |
const char ** | argv | ||
) |
Constructor. Stores the command line arguments internally.
[out] | argc | - Pointer to number of arguments. |
[out] | argv | - Pointer to array of arguments. |
Definition at line 13 of file program_arguments.cpp.
hal::ProgramArguments::ProgramArguments | ( | ) |
Constructor. Stores no command line arguments internally.
Definition at line 7 of file program_arguments.cpp.
|
default |
void hal::ProgramArguments::get_original_arguments | ( | int * | argc, |
const char *** | argv | ||
) |
Copies the original command line arguments into the parameters.
[out] | argc | - Pointer to number of arguments. |
[out] | argv | - Pointer to array of arguments. |
Definition at line 19 of file program_arguments.cpp.
std::string hal::ProgramArguments::get_parameter | ( | const std::string & | flag | ) | const |
Returns the parameter of the option.
If the option expects more than one parameter, use get_parameters().
If the user did not supply a parameter, the default value is returned.
[in] | flag | - A flag of the option. If the option was entered with multiple flags, any of these works. |
Definition at line 116 of file program_arguments.cpp.
References get_parameters().
std::vector< std::string > hal::ProgramArguments::get_parameters | ( | const std::string & | flag | ) | const |
Returns the parameters of the option.
If the option expects only one parameter, use the shorthand get_parameter().
If the user did not supply (all) parameters, the default values are returned in those places.
[in] | flag | - A flag of the option. If the option was entered with multiple flags, any of these works. |
Definition at line 126 of file program_arguments.cpp.
References log_error.
Referenced by get_parameter().
std::vector< std::string > hal::ProgramArguments::get_set_options | ( | ) | const |
Returns all flags which were used to set options in the parsed arguments or programatically in order of appearance.
Definition at line 25 of file program_arguments.cpp.
bool hal::ProgramArguments::is_option_set | ( | const std::string & | flag | ) | const |
Checks whether an option was set.
Any flag of the option works, even if one of the other flags was actually used to set the option.
[in] | flag | - A flag of the option. |
Definition at line 30 of file program_arguments.cpp.
bool hal::ProgramArguments::set_option | ( | const std::string & | flag, |
const std::set< std::string > & | equivalent_flags, | ||
const std::vector< std::string > & | parameters | ||
) |
Programatically set an option (specifying a set of equivalent flags) and supply parameters.
[in] | flag | - A single flag which is actually set. |
[in] | equivalent_flags | - All flags for the same option. |
[in] | parameters | - The parameters for this flag. |
Definition at line 53 of file program_arguments.cpp.
References hal::utils::join(), and log_error.
void hal::ProgramArguments::set_option | ( | const std::string & | flag, |
const std::string & | parameter | ||
) |
Programatically set an option via a single flag and supply a parameter. This is just a shorthand for set_option(flag, {parameter});
[in] | flag | - A flag of the option. |
[in] | parameter | - The parameter for this flag. |
Definition at line 43 of file program_arguments.cpp.
Referenced by set_option().
void hal::ProgramArguments::set_option | ( | const std::string & | flag, |
const std::vector< std::string > & | parameters | ||
) |
Programatically set an option via a single flag and supply parameters.
[in] | flag | - A flag of the option. |
[in] | parameters | - The parameters for this flag. |
Definition at line 48 of file program_arguments.cpp.
References set_option().