Eclipse SUMO - Simulation of Urban MObility
|
Parses command line arguments. More...
#include <OptionsParser.h>
Static Public Member Functions | |
static bool | parse (const std::vector< std::string > &args, const bool ignoreAppenders=false) |
Parses the given command line arguments. | |
Static Private Member Functions | |
static int | check (const std::string &arg1, const std::string *const arg2, bool &ok, const bool ignoreAppenders) |
parses the previous arguments | |
static bool | checkParameter (const std::string &arg1) |
Returns the whether the given token is an option. | |
static bool | processNonBooleanSingleSwitch (OptionsCont &oc, const std::string &arg, const bool append) |
Extracts the parameter directly attached to an option. | |
Parses command line arguments.
The only public method parses the given list of arguments. It returns false when something failed. This may happen if the syntax of the arguments is invalid, a value is tried to be set several times or an unknown option is tried to be set.
The class assumes all options are unset or using default values only.
Definition at line 46 of file OptionsParser.h.
|
staticprivate |
parses the previous arguments
[in] | arg1 | The first token to parse |
[in] | arg2 | The second token to parse, 0 if there is none |
[in,out] | ok | Whether the parsing was successfull |
InvalidArgument | If a performed setting of an option failed (see Option::set) |
Definition at line 61 of file OptionsParser.cpp.
References checkParameter(), OptionsCont::getOptions(), OptionsCont::isBool(), processNonBooleanSingleSwitch(), and OptionsCont::set().
Referenced by parse().
|
staticprivate |
Returns the whether the given token is an option.
The given token is assumed to be an option if it starts with a '-' or a '+'.
[in] | arg1 | The token to check |
Definition at line 144 of file OptionsParser.cpp.
References TL, and WRITE_ERRORF.
Referenced by check().
|
static |
Parses the given command line arguments.
[in] | oc | The options container to fill |
[in] | args | The command line arguments |
InvalidArgument | If a performed setting of an option failed (see Option::set) |
Definition at line 37 of file OptionsParser.cpp.
References check(), and WRITE_ERROR.
Referenced by OptionsIO::getOptions(), and OptionsIO::loadConfiguration().
|
staticprivate |
Extracts the parameter directly attached to an option.
Parses single tokens which contain an option and the parameter (like -c=myconfig.cfg)
[in] | oc | The container to store the result into |
[in] | arg | The token to parse |
InvalidArgument | If a performed setting of an option failed (see Option::set) |
Definition at line 124 of file OptionsParser.cpp.
References OptionsCont::set(), TL, and WRITE_ERRORF.
Referenced by check().