49 using std::istringstream;
67 longName_(name), shortName_(alias), desc_(desc), hidden_(hidden),
220 std::string arguments, std::string prefix) {
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()";
298 std::string arguments, std::string prefix) {
300 string msg =
"Illegal prefix for unsigned integer option";
301 string method =
"UnsignedIntegerCmdLineOptionParser::parseValue()";
305 if (arguments ==
"") {
306 string msg =
"Missing value for unsigned integer option.";
307 string method =
"UnsignedIntegerCmdLineOptionParser::parseValue()";
311 istringstream istream(arguments);
312 if((!(istream >>
value_)) || istream.peek() != EOF) {
313 string msg =
"Format of " +
longName() +
" option value was wrong: "
315 string method =
"unsignedIntegerCmdLineOptionParser::parseValue()";
383 std::string arguments, std::string prefix) {
385 string msg =
"Illegal prefix for string option";
386 string method =
"StringCmdLineOptionParser::parseValue()";
390 if (arguments ==
"") {
391 string msg =
"Missing value for string option.";
392 string method =
"StringCmdLineOptionParser::parseValue()";
420 std::string name, std::string desc, std::string alias)
454 std::string arguments, std::string prefix) {
456 string msg =
"Illegal prefix for string option";
457 string method =
"StringCmdLineOptionParser::parseValue()";
545 string msg =
"Illegal prefix for real option";
546 string method =
"RealCmdLineOptionParser::parseValue()";
551 if (arguments ==
"") {
552 string msg =
"Missing value for real option.";
553 string method =
"RealCmdLineOptionParser::parseValue()";
557 istringstream istream(arguments);
558 if((!(istream >>
value_)) || istream.peek() != EOF) {
559 string msg =
"Format of " +
longName() +
" option value was wrong: "
561 string method =
"RealCmdLineOptionParser::parseValue()";
629 if (prefix ==
"no-") {
631 }
else if (prefix ==
"") {
634 string msg =
"Illegal prefix for boolean option " +
longName() +
636 string method =
"BoolCmdLineOptionParser::parseValue()";
640 if (arguments !=
"") {
720 std::string arguments, std::string prefix) {
722 string msg =
"Illegal prefix for integer list option";
723 string method =
"IntegerListCmdLineOptionParser::parseValue()";
727 if (arguments ==
"") {
728 string msg =
"Missing value for option " +
longName();
729 string method =
"IntegerSetCmdLineOptionParser::parseValue()";
735 istringstream istream(arguments);
737 if (!(istream >> number)) {
738 string msg =
"Format of " +
longName() +
"option value was wrong";
739 string method =
"IntegerSetCmdLineOptionParser::parseValue()";
744 while (istream.peek() != EOF) {
747 if (!(istream >> comma) || comma !=
',') {
748 string msg =
"Format of " +
longName() +
"option value was wrong";
749 string method =
"IntegerSetCmdLineOptionParser::parseValue()";
753 if (!(istream >> number)) {
754 string msg =
"Format of " +
longName() +
"option value was wrong";
755 string method =
"IntegerSetCmdLineOptionParser::parseValue()";
773 assert(index > 0 &&
static_cast<unsigned>(index) <=
values_.size());
838 std::string arguments, std::string prefix) {
840 string msg =
"Illegal prefix for string list option";
844 if (arguments ==
"") {
845 string msg =
"Missing value for option " +
longName();
850 string::size_type commaPosition = 0;
851 string::size_type lastPosition = 0;
852 while (commaPosition < arguments.size()) {
853 commaPosition = arguments.find(comma, lastPosition);
854 if (commaPosition == string::npos) {
856 arguments.substr(lastPosition, arguments.size()));
860 arguments.substr(lastPosition, commaPosition-lastPosition));
861 lastPosition = commaPosition + 1;
878 assert(index > 0 &&
static_cast<unsigned>(index) <=
values_.size());