namespace command {
/**
* Class responsible for handling commandline options.
- * Options are non-required, named parameters of program.
+ * Options are named parameters of program.
*
* Example:
* ./myprog OptionName=OptionValue
*/
OptionType value;
- /** Variable indicating if current Option was already used or not */
- bool used = false;
-
public:
/**
* Default constructor.
virtual bool understand(const std::string & argv)
throw(std::invalid_argument) {
- if ((!used) && (argv.find(name) == 0)) {
+ if ((!isUsed()) && (argv.find(name) == 0)) {
std::size_t pos = argv.find("=");
if (pos != name.size()) {
std::stringstream ss;
ss << argv.substr(pos + 1);
- ss >> value;// memory leak? when is uncommented, and exception is
+ ss >> value;// memory leak? when uncommented and exception is
// thrown, valgrind shows e.g.:
// possibly lost: 380 bytes in 7 blocks
* Current Option name
*/
const OptionName name;
-
- /** Variable indicating if current Option was already used or not */
- bool used = false;
-
public:
/**
* Default constructor.
* used to check against next value.
*/
virtual bool understand(const std::string & argv) {
- if ((!used) &&
+ if ((!isUsed()) &&
(argv == name)) {
used = true;
return true;