#include <CmdLineOptionParser.hh>
Models an option that has an integer value.
Definition at line 117 of file CmdLineOptionParser.hh.
◆ IntegerCmdLineOptionParser() [1/2]
IntegerCmdLineOptionParser::IntegerCmdLineOptionParser |
( |
std::string |
name, |
|
|
std::string |
desc, |
|
|
std::string |
alias = "" |
|
) |
| |
Constructor.
- Parameters
-
name | The name of the option. |
desc | The description of the option. |
alias | The short name of the option. |
Definition at line 184 of file CmdLineOptionParser.cc.
◆ ~IntegerCmdLineOptionParser()
IntegerCmdLineOptionParser::~IntegerCmdLineOptionParser |
( |
| ) |
|
|
virtual |
◆ IntegerCmdLineOptionParser() [2/2]
◆ copy()
OptionValue * IntegerCmdLineOptionParser::copy |
( |
| ) |
const |
|
virtual |
◆ integer()
int IntegerCmdLineOptionParser::integer |
( |
int |
index = 0 | ) |
const |
|
virtual |
◆ operator=()
◆ parseValue()
bool IntegerCmdLineOptionParser::parseValue |
( |
std::string |
arguments, |
|
|
std::string |
prefix |
|
) |
| |
|
virtual |
Parses the integer option value.
- Parameters
-
arguments | The arguments of option. |
prefix | The prefix of option. |
- Returns
- True when parsing is ready.
- Exceptions
-
Implements CmdLineOptionParser.
Definition at line 219 of file CmdLineOptionParser.cc.
222 string msg =
"Illegal prefix for integer option";
223 string method =
"IntegerCmdLineOptionParser::parseValue()";
227 if (arguments ==
"") {
228 string msg =
"Missing value for integer option.";
229 string method =
"IntegerCmdLineOptionParser::parseValue()";
233 istringstream istream(arguments);
234 if((!(istream >>
value_)) || istream.peek() != EOF) {
235 string msg =
"Format of " +
longName() +
" option value was wrong: "
237 string method =
"IntegerCmdLineOptionParser::parseValue()";
References CmdLineOptionParser::longName(), CmdLineOptionParser::setDefined(), and value_.
◆ value_
int IntegerCmdLineOptionParser::value_ |
|
private |
The documentation for this class was generated from the following files: