CFEL - ASG Software Suite
2.5.0
CASS
|
command line argument parser More...
#include <cl_parser.hpp>
Public Types | |
typedef std::map< std::string, std::pair< bool *, std::string > > | switches_t |
a container type for switches More... | |
typedef std::map< std::string, std::pair< int *, std::string > > | intarguments_t |
a container type for switches More... | |
typedef std::map< std::string, std::pair< std::string *, std::string > > | stringarguments_t |
a container type for switches More... | |
Public Member Functions | |
void | usage () |
output which commandline parameters are available More... | |
void | operator() (const QStringList &argumentList) |
operator to parse the argumetns More... | |
void | add (const std::string &sw, const std::string &desc, bool &val) |
add a switch to the switches container More... | |
void | add (const std::string &sw, const std::string &desc, std::string &val) |
add a switch to the string container More... | |
void | add (const std::string &sw, const std::string &desc, int &val) |
add a switch to the int container More... | |
Private Attributes | |
switches_t | _switches |
container for the switches More... | |
stringarguments_t | _stringargs |
container for the string arguments More... | |
intarguments_t | _intargs |
container for the int arguments More... | |
command line argument parser
object that will parse the command line parameters and set the switches and retrieve the arguments
Definition at line 27 of file cl_parser.hpp.
typedef std::map<std::string,std::pair<int*,std::string> > cass::CommandlineArgumentParser::intarguments_t |
a container type for switches
Definition at line 34 of file cl_parser.hpp.
typedef std::map<std::string,std::pair<std::string*,std::string> > cass::CommandlineArgumentParser::stringarguments_t |
a container type for switches
Definition at line 37 of file cl_parser.hpp.
typedef std::map<std::string,std::pair<bool*,std::string> > cass::CommandlineArgumentParser::switches_t |
a container type for switches
Definition at line 31 of file cl_parser.hpp.
|
inline |
add a switch to the switches container
sw | the name of the parameter to look for |
desc | the description of the parameter |
val | a reference to the value that should be changed. |
Definition at line 122 of file cl_parser.hpp.
References _switches.
Referenced by main().
|
inline |
add a switch to the string container
sw | the name of the parameter to look for |
desc | the description of the parameter |
val | a reference to the value that should be changed. |
Definition at line 133 of file cl_parser.hpp.
References _stringargs.
|
inline |
add a switch to the int container
sw | the name of the parameter to look for |
desc | the description of the parameter |
val | a reference to the value that should be changed. |
Definition at line 144 of file cl_parser.hpp.
References _intargs.
|
inline |
operator to parse the argumetns
the arguments are retrieved as a QStringList from Qt. Go through the list and try to find the parameter in the containers. If it is the switches container simply set the switch to true. Otherwise take the next parameter that should be the argument of the preceding parameter. Start at the 2nd argument of the list, since the first is just the program name.
argumentList | the list of arguments |
Definition at line 78 of file cl_parser.hpp.
References _intargs, _stringargs, _switches, and usage().
|
inline |
output which commandline parameters are available
Definition at line 40 of file cl_parser.hpp.
References _intargs, _stringargs, and _switches.
Referenced by main(), and operator()().
|
private |
container for the int arguments
Definition at line 157 of file cl_parser.hpp.
Referenced by add(), operator()(), and usage().
|
private |
container for the string arguments
Definition at line 154 of file cl_parser.hpp.
Referenced by add(), operator()(), and usage().
|
private |
container for the switches
Definition at line 151 of file cl_parser.hpp.
Referenced by add(), operator()(), and usage().