tclap 1.4.0
Arg.h
Go to the documentation of this file.
1// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
2
3/******************************************************************************
4 *
5 * file: Arg.h
6 *
7 * Copyright (c) 2003, Michael E. Smoot .
8 * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno .
9 * Copyright (c) 2017 Google Inc.
10 * All rights reserved.
11 *
12 * See the file COPYING in the top directory of this distribution for
13 * more information.
14 *
15 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 *****************************************************************************/
24
25#ifndef TCLAP_ARG_H
26#define TCLAP_ARG_H
27
28#ifdef HAVE_TCLAP_CONFIG_H
29#include <tclap/TCLAPConfig.h>
30#endif
31
32// Define to 1 before including TCLAP to retain the historical truncation of
33// ValueLike input at its first NUL byte. Use one setting across the program.
34#ifndef TCLAP_ALLOW_NUL_TRUNCATION
35#define TCLAP_ALLOW_NUL_TRUNCATION 0
36#endif
37
38#include <tclap/ArgException.h>
39#include <tclap/ArgTraits.h>
42#include <tclap/Visitor.h>
43#include <tclap/sstream.h>
44
45#include <cstdio>
46#include <iomanip>
47#include <iostream>
48#include <list>
49#include <string>
50#include <vector>
51
52namespace TCLAP {
53
55struct ArgAlias {
56 std::string flag;
57 std::string name;
58 ArgAlias(const std::string &f, const std::string &n) : flag(f), name(n) {}
59};
60
66class Arg {
67 friend class CmdLine;
68
69private:
70 // NULL uses the legacy static delimiter for unregistered arguments.
71 const char *_parserDelimiter;
72 std::vector<ArgAlias> _aliases;
73 // Registration validates against the destination parser's conventions.
74 void _validateAliases(char delimiter, const std::string &flagPrefix,
75 const std::string &namePrefix) const;
76 bool _aliasConflictsWithDialect(const ArgAlias &alias, char delimiter,
77 const std::string &flagPrefix,
78 const std::string &namePrefix) const;
79 void _validateAliasToken(const std::string &label, const std::string &prefix,
80 std::vector<std::string> &tokens) const;
81 void _validateAliasLabels(const std::string &flag,
82 const std::string &name) const;
83 bool _matchesDeclaredToken(const std::string &token,
84 const std::string &flagPrefix,
85 const std::string &namePrefix) const;
86 bool _aliasConflictsWith(const Arg &other, const std::string &flagPrefix,
87 const std::string &namePrefix) const;
88
92 Arg(const Arg &rhs);
93
97 Arg &operator=(const Arg &rhs);
98
103 static char &delimiterRef() {
104 static char delim = ' ';
105 return delim;
106 }
107
108protected:
109 bool matchesShortFlag(const std::string &flag) const;
110 bool matchesLongName(const std::string &name) const;
119 std::string _flag;
120
128 std::string _name;
129
133 std::string _description;
134
138 const bool _required;
139
144 std::string _requireLabel;
145
152
159
162 std::string _setBy;
163
171
176
178
184
188 void _checkWithVisitor() const;
189
203 Arg(const std::string &flag, const std::string &name,
204 const std::string &desc, bool req, bool valreq, Visitor *v = NULL);
205
206public:
214 Arg &addAlias(const std::string &flag, const std::string &name = "");
215
217 const std::vector<ArgAlias> &aliases() const { return _aliases; }
218
222 virtual ~Arg();
223
228 virtual void addToList(std::list<Arg *> &argList) const;
229
234 static char delimiter() { return delimiterRef(); }
235
239 char getDelimiter() const {
240 return _parserDelimiter ? *_parserDelimiter : delimiter();
241 }
242
247 static char blankChar() { return '\a'; }
248
253#ifndef TCLAP_FLAGSTARTCHAR
254#define TCLAP_FLAGSTARTCHAR '-'
255#endif
256 static char flagStartChar() { return TCLAP_FLAGSTARTCHAR; }
257
263#ifndef TCLAP_FLAGSTARTSTRING
264#define TCLAP_FLAGSTARTSTRING "-"
265#endif
266 static const std::string flagStartString() { return TCLAP_FLAGSTARTSTRING; }
267
272#ifndef TCLAP_NAMESTARTSTRING
273#define TCLAP_NAMESTARTSTRING "--"
274#endif
275 static const std::string nameStartString() { return TCLAP_NAMESTARTSTRING; }
276
280 static const std::string ignoreNameString() { return "ignore_rest"; }
281
287 static void setDelimiter(char c) { delimiterRef() = c; }
288
296 virtual bool processArg(int *i, std::vector<std::string> &args) = 0;
297
304 virtual bool operator==(const Arg &a) const;
305
313 bool conflictsWith(const Arg &a) const;
314
318 const std::string &getFlag() const;
319
323 const std::string &getName() const;
324
328 std::string getDescription() const { return getDescription(_required); }
329
333 virtual void setDescription(const std::string &desc) { _description = desc; }
334
341 std::string getDescription(bool required) const {
342 return (required ? "(" + _requireLabel + ") " : "") + _description;
343 }
344
348 virtual bool isRequired() const;
349
353 bool isValueRequired() const;
354
359 bool isSet() const;
360
364 const std::string &setBy() const { return _setBy; }
365
369 bool isIgnoreable() const;
370
379 virtual bool argMatches(const std::string &s) const;
380
385 virtual std::string toString() const;
386
391 virtual std::string shortID(const std::string &valueId = "val") const;
392
397 virtual std::string longID(const std::string &valueId = "val") const;
398
406 virtual void trimFlag(std::string &flag, std::string &value) const;
407
414 bool _hasBlanks(const std::string &s) const;
415
420 virtual bool allowMore();
421
426 virtual bool acceptsMultipleValues();
427
432 virtual void reset();
433
438 virtual void hideFromHelp(bool hide = true) { _visibleInHelp = !hide; }
439
443 virtual bool visibleInHelp() const { return _visibleInHelp; }
444
445 virtual bool hasLabel() const { return true; }
446};
447
451typedef std::list<Arg *>::const_iterator ArgListIterator;
452
456typedef std::vector<Arg *>::const_iterator ArgVectorIterator;
457
461typedef std::list<Visitor *>::const_iterator VisitorListIterator;
462
463/*
464 * Extract a value of type T from it's string representation contained
465 * in strVal. The ValueLike parameter used to select the correct
466 * specialization of ExtractValue depending on the value traits of T.
467 * ValueLike traits use operator>> to assign the value from strVal.
468 */
469template <typename T>
470void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl) {
471 static_cast<void>(vl); // Avoid warning about unused vl
472#if !TCLAP_ALLOW_NUL_TRUNCATION
473 if (strVal.find('\0') != std::string::npos)
474 throw ArgParseException("Embedded NUL in argument value");
475#endif
476 istringstream is(strVal.c_str());
477
478 int valuesRead = 0;
479 // Let the extractor decide whether an explicitly empty input is valid.
480 // Built-in numeric extraction fails; a custom extractor may accept it.
481 if (strVal.empty()) {
482 is >> destVal;
483 ++valuesRead;
484 }
485 while (is.good()) {
486 if (is.peek() != EOF)
487#ifdef TCLAP_SETBASE_ZERO
488 is >> std::setbase(0) >> destVal;
489#else
490 is >> destVal;
491#endif
492 else
493 break;
494
495 valuesRead++;
496 }
497
498 if (is.fail())
499 throw(
500 ArgParseException("Couldn't read argument value "
501 "from string '" +
502 strVal + "'"));
503
504 if (valuesRead > 1)
505 throw(
506 ArgParseException("More than one valid value parsed from "
507 "string '" +
508 strVal + "'"));
509}
510
511/*
512 * Extract a value of type T from it's string representation contained
513 * in strVal. The ValueLike parameter used to select the correct
514 * specialization of ExtractValue depending on the value traits of T.
515 * StringLike uses assignment (operator=) to assign from strVal.
516 */
517template <typename T>
518void ExtractValue(T &destVal, const std::string &strVal, StringLike sl) {
519 static_cast<void>(sl); // Avoid warning about unused sl
520 SetString(destVal, strVal);
521}
522
524// BEGIN Arg.cpp
526
527inline Arg::Arg(const std::string &flag, const std::string &name,
528 const std::string &desc, bool req, bool valreq, Visitor *v)
529 : _parserDelimiter(NULL),
530 _aliases(),
531 _flag(flag),
532 _name(name),
533 _description(desc),
534 _required(req),
535 _requireLabel("required"),
536 _valueRequired(valreq),
537 _alreadySet(false),
538 _setBy(),
539 _visitor(v),
540 _ignoreable(true),
541 _acceptsMultipleValues(false),
542 _visibleInHelp(true) {
543 if (_flag.length() > 1)
545 "Argument flag can only be one character long", Arg::toString()));
546
547 if (_name != ignoreNameString() &&
549 _flag == " "))
551 "Argument flag cannot be either '" + Arg::flagStartString() +
552 "' or '" + Arg::nameStartString() + "' or a space.",
553 Arg::toString()));
554
555 if ((_name.substr(0, Arg::flagStartString().length()) ==
557 (_name.substr(0, Arg::nameStartString().length()) ==
559 (_name.find(" ", 0) != std::string::npos))
560 throw(SpecificationException("Argument name begin with either '" +
561 Arg::flagStartString() + "' or '" +
562 Arg::nameStartString() + "' or space.",
563 Arg::toString()));
564}
565
566inline Arg::~Arg() {}
567
568inline std::string Arg::shortID(const std::string &valueId) const {
569 std::string id = "";
570
571 if (_flag != "")
573 else
575
576 if (_valueRequired) id += std::string(1, getDelimiter()) + valueId;
577
578 return id;
579}
580
581inline std::string Arg::longID(const std::string &valueId) const {
582 std::string id = "";
583
584 if (_flag != "") {
585 id += Arg::flagStartString() + _flag;
586
587 if (_valueRequired) id += std::string(1, getDelimiter()) + valueId;
588
589 id += ", ";
590 }
591
592 id += Arg::nameStartString() + _name;
593
594 if (_valueRequired) id += std::string(1, getDelimiter()) + valueId;
595
596 for (std::vector<ArgAlias>::const_iterator it = _aliases.begin();
597 it != _aliases.end(); ++it) {
598 if (!it->flag.empty()) {
599 id += ", " + flagStartString() + it->flag;
600 if (_valueRequired) id += std::string(1, getDelimiter()) + valueId;
601 }
602 if (!it->name.empty()) {
603 id += ", " + nameStartString() + it->name;
604 if (_valueRequired) id += std::string(1, getDelimiter()) + valueId;
605 }
606 }
607 return id;
608}
609
610inline bool Arg::_matchesDeclaredToken(const std::string &token,
611 const std::string &flagPrefix,
612 const std::string &namePrefix) const {
613 if ((!_flag.empty() && token == flagPrefix + _flag) ||
614 token == namePrefix + _name)
615 return true;
616 for (std::vector<ArgAlias>::const_iterator it = _aliases.begin();
617 it != _aliases.end(); ++it)
618 if ((!it->flag.empty() && token == flagPrefix + it->flag) ||
619 (!it->name.empty() && token == namePrefix + it->name))
620 return true;
621 return false;
622}
623
624inline bool Arg::_aliasConflictsWith(const Arg &other,
625 const std::string &flagPrefix,
626 const std::string &namePrefix) const {
627 for (std::vector<ArgAlias>::const_iterator it = _aliases.begin();
628 it != _aliases.end(); ++it)
629 if ((!it->flag.empty() &&
630 other._matchesDeclaredToken(flagPrefix + it->flag, flagPrefix,
631 namePrefix)) ||
632 (!it->name.empty() &&
633 other._matchesDeclaredToken(namePrefix + it->name, flagPrefix,
634 namePrefix)))
635 return true;
636 return false;
637}
638
639inline void Arg::_validateAliases(char delimiter, const std::string &flagPrefix,
640 const std::string &namePrefix) const {
641 if (_aliases.empty()) return;
642 std::vector<std::string> tokens;
643 if (!_flag.empty()) tokens.push_back(flagPrefix + _flag);
644 tokens.push_back(namePrefix + _name);
645 for (std::vector<ArgAlias>::const_iterator it = _aliases.begin();
646 it != _aliases.end(); ++it) {
647 if (_aliasConflictsWithDialect(*it, delimiter, flagPrefix, namePrefix))
648 throw SpecificationException("Alias conflicts with parser dialect",
649 toString());
650 _validateAliasToken(it->flag, flagPrefix, tokens);
651 _validateAliasToken(it->name, namePrefix, tokens);
652 }
653}
654
655inline bool Arg::_aliasConflictsWithDialect(
656 const ArgAlias &alias, char delimiter, const std::string &flagPrefix,
657 const std::string &namePrefix) const {
658 return (!alias.flag.empty() &&
659 (alias.flag == flagPrefix || alias.flag == namePrefix)) ||
660 (!alias.name.empty() &&
661 ((!flagPrefix.empty() && alias.name.find(flagPrefix) == 0) ||
662 (!namePrefix.empty() && alias.name.find(namePrefix) == 0))) ||
664 (alias.flag.find(delimiter) != std::string::npos ||
665 alias.name.find(delimiter) != std::string::npos));
666}
667
668inline void Arg::_validateAliasToken(const std::string &label,
669 const std::string &prefix,
670 std::vector<std::string> &tokens) const {
671 if (label.empty()) return;
672 const std::string token = prefix + label;
673 for (std::vector<std::string>::const_iterator it = tokens.begin();
674 it != tokens.end(); ++it)
675 if (*it == token)
676 throw SpecificationException("Duplicate argument alias token",
677 toString());
678 tokens.push_back(token);
679}
680
681inline bool Arg::matchesShortFlag(const std::string &flag) const {
682 if (flag.empty()) return false;
683 if (flag == _flag) return true;
684 for (std::vector<ArgAlias>::const_iterator it = _aliases.begin();
685 it != _aliases.end(); ++it)
686 if (flag == it->flag) return true;
687 return false;
688}
689
690inline bool Arg::matchesLongName(const std::string &name) const {
691 if (name.empty()) return false;
692 if (name == _name) return true;
693 for (std::vector<ArgAlias>::const_iterator it = _aliases.begin();
694 it != _aliases.end(); ++it)
695 if (name == it->name) return true;
696 return false;
697}
698
699inline Arg &Arg::addAlias(const std::string &flag, const std::string &name) {
700 if (_parserDelimiter)
701 throw SpecificationException("Aliases must be added before registration", toString());
702 if (!hasLabel())
703 throw SpecificationException("Positional arguments cannot have aliases", toString());
704 _validateAliasLabels(flag, name);
705 if (matchesShortFlag(flag) || matchesLongName(name))
706 throw SpecificationException("Duplicate argument alias", toString());
707 _aliases.push_back(ArgAlias(flag, name));
708 return *this;
709}
710
711inline void Arg::_validateAliasLabels(const std::string &flag,
712 const std::string &name) const {
713 if ((flag.empty() && name.empty()) || flag.size() > 1 ||
714 flag == flagStartString() || flag == nameStartString() ||
715 flag.find_first_of(" \t\r\n\v\f\a") != std::string::npos ||
716 flag.find('\0') != std::string::npos ||
717 name.find_first_of(" \t\r\n\v\f") != std::string::npos ||
718 name.find('\0') != std::string::npos ||
719 (!name.empty() && (name.find(flagStartString()) == 0 ||
720 name.find(nameStartString()) == 0)))
721 throw SpecificationException("Invalid argument alias", toString());
722 const std::string labels = flag + name;
723 for (std::string::const_iterator it = labels.begin(); it != labels.end();
724 ++it)
725 if (static_cast<unsigned char>(*it) < 0x20 || *it == '\x7f')
726 throw SpecificationException("Control byte in argument alias",
727 toString());
728}
729
730inline bool Arg::conflictsWith(const Arg &a) const {
731 if (this == &a || _name == a._name || matchesLongName(a._name) || matchesShortFlag(a._flag))
732 return true;
733 for (std::vector<ArgAlias>::const_iterator it = a._aliases.begin();
734 it != a._aliases.end(); ++it)
735 if (matchesShortFlag(it->flag) || matchesLongName(it->name)) return true;
736 return false;
737}
738
739inline bool Arg::operator==(const Arg &a) const {
740 return (_flag != "" && _flag == a._flag) || _name == a._name;
741}
742
743inline const std::string &Arg::getFlag() const { return _flag; }
744
745inline const std::string &Arg::getName() const { return _name; }
746
747inline bool Arg::isRequired() const { return _required; }
748
749inline bool Arg::isValueRequired() const { return _valueRequired; }
750
751inline bool Arg::isSet() const { return _alreadySet; }
752
753inline bool Arg::isIgnoreable() const { return _ignoreable; }
754
755inline bool Arg::argMatches(const std::string &argFlag) const {
756 const std::string shortPrefix = flagStartString();
757 const std::string longPrefix = nameStartString();
758 return argFlag == longPrefix + _name ||
759 (argFlag.find(shortPrefix) == 0 &&
760 matchesShortFlag(argFlag.substr(shortPrefix.size()))) ||
761 (argFlag.find(longPrefix) == 0 &&
762 matchesLongName(argFlag.substr(longPrefix.size())));
763}
764
765inline std::string Arg::toString() const {
766 std::string s = "";
767
768 if (_flag != "") s += Arg::flagStartString() + _flag + " ";
769
770 s += "(" + Arg::nameStartString() + _name + ")";
771
772 return s;
773}
774
775inline void Arg::_checkWithVisitor() const {
776 if (_visitor != NULL) _visitor->visit();
777}
778
782inline void Arg::trimFlag(std::string &flag, std::string &value) const {
783 int stop = 0;
784 for (int i = 0; static_cast<unsigned int>(i) < flag.length(); i++)
785 if (flag[i] == getDelimiter()) {
786 stop = i;
787 break;
788 }
789
790 if (stop > 1) {
791 value = flag.substr(stop + 1);
792 flag = flag.substr(0, stop);
793 }
794}
795
799inline bool Arg::_hasBlanks(const std::string &s) const {
800 for (int i = 1; static_cast<unsigned int>(i) < s.length(); i++)
801 if (s[i] == Arg::blankChar()) return true;
802
803 return false;
804}
805
809inline void Arg::addToList(std::list<Arg *> &argList) const {
810 argList.push_front(const_cast<Arg *>(this));
811}
812
813inline bool Arg::allowMore() { return false; }
814
816
817inline void Arg::reset() { _alreadySet = false; }
818
820// END Arg.cpp
822
823} // namespace TCLAP
824
825#endif // TCLAP_ARG_H
#define TCLAP_FLAGSTARTSTRING
The sting that indicates the beginning of a flag.
Definition Arg.h:264
#define TCLAP_FLAGSTARTCHAR
The char that indicates the beginning of a flag.
Definition Arg.h:254
#define TCLAP_NAMESTARTSTRING
The sting that indicates the beginning of a name.
Definition Arg.h:273
Thrown from within the child Arg classes when it fails to properly parse the argument it has been pas...
A virtual base class that defines the essential data for all arguments.
Definition Arg.h:66
static char blankChar()
The char used as a place holder when SwitchArgs are combined.
Definition Arg.h:247
void _checkWithVisitor() const
Performs the special handling described by the Visitor.
Definition Arg.h:775
bool _acceptsMultipleValues
Definition Arg.h:177
const std::string & setBy() const
Returns the value specified to set this flag (like -a or –all).
Definition Arg.h:364
Arg & addAlias(const std::string &flag, const std::string &name="")
Add equivalent spellings before registration.
Definition Arg.h:699
virtual ~Arg()
Destructor.
Definition Arg.h:566
bool _visibleInHelp
Indicates if the argument is visible in the help output (e.g., when specifying –help).
Definition Arg.h:183
bool isSet() const
Indicates whether the argument has already been set.
Definition Arg.h:751
virtual std::string longID(const std::string &valueId="val") const
Returns a long ID for the usage.
Definition Arg.h:581
static const std::string nameStartString()
Definition Arg.h:275
std::string _setBy
Indicates the value specified to set this flag (like -a or –all).
Definition Arg.h:162
std::string getDescription(bool required) const
Returns the argument description.
Definition Arg.h:341
std::string _requireLabel
Label to be used in usage description.
Definition Arg.h:144
bool _hasBlanks(const std::string &s) const
Checks whether a given string has blank chars, indicating that it is a combined SwitchArg.
Definition Arg.h:799
bool matchesLongName(const std::string &name) const
Definition Arg.h:690
bool conflictsWith(const Arg &a) const
Checks declared registration conflicts: the same object, the same name, or the same nonempty short fl...
Definition Arg.h:730
bool isIgnoreable() const
Indicates whether the argument can be ignored, if desired.
Definition Arg.h:753
const bool _required
Indicating whether the argument is required.
Definition Arg.h:138
virtual bool processArg(int *i, std::vector< std::string > &args)=0
Pure virtual method meant to handle the parsing and value assignment of the string on the command lin...
const std::string & getFlag() const
Returns the argument flag.
Definition Arg.h:743
static const std::string ignoreNameString()
The name used to identify the ignore rest argument.
Definition Arg.h:280
bool _valueRequired
Indicates whether a value is required for the argument.
Definition Arg.h:151
bool isValueRequired() const
Indicates whether a value must be specified for argument.
Definition Arg.h:749
static char flagStartChar()
Definition Arg.h:256
bool _alreadySet
Indicates whether the argument has been set.
Definition Arg.h:158
bool _ignoreable
Whether this argument can be ignored, if desired.
Definition Arg.h:175
std::string _description
Description of the argument.
Definition Arg.h:133
virtual void addToList(std::list< Arg * > &argList) const
Adds this to the specified list of Args.
Definition Arg.h:809
virtual bool allowMore()
Used for MultiArgs to determine whether args can still be set.
Definition Arg.h:813
const std::string & getName() const
Returns the argument name.
Definition Arg.h:745
Visitor * _visitor
A pointer to a visitor object.
Definition Arg.h:170
virtual void hideFromHelp(bool hide=true)
Hide this argument from the help output (e.g., when specifying the –help flag or on error.
Definition Arg.h:438
static char delimiter()
The delimiter that separates an argument flag/name from the value.
Definition Arg.h:234
std::string getDescription() const
Returns the argument description.
Definition Arg.h:328
virtual void reset()
Clears the Arg object and allows it to be reused by new command lines.
Definition Arg.h:817
bool matchesShortFlag(const std::string &flag) const
Definition Arg.h:681
std::string _name
A single word namd identifying the argument.
Definition Arg.h:128
virtual bool argMatches(const std::string &s) const
A method that tests whether a string matches this argument.
Definition Arg.h:755
static void setDelimiter(char c)
Sets the legacy delimiter for unregistered arguments and static callers.
Definition Arg.h:287
virtual bool acceptsMultipleValues()
Use by output classes to determine whether an Arg accepts multiple values.
Definition Arg.h:815
virtual void trimFlag(std::string &flag, std::string &value) const
Trims a value off of the flag.
Definition Arg.h:782
virtual std::string toString() const
Returns a simple string representation of the argument.
Definition Arg.h:765
char getDelimiter() const
Returns this argument's parser delimiter, or the legacy default.
Definition Arg.h:239
virtual bool hasLabel() const
Definition Arg.h:445
std::string _flag
The single char flag used to identify the argument.
Definition Arg.h:119
virtual bool visibleInHelp() const
Returns true if this Arg is visible in the help output.
Definition Arg.h:443
virtual bool isRequired() const
Indicates whether the argument is required.
Definition Arg.h:747
virtual std::string shortID(const std::string &valueId="val") const
Returns a short ID for the usage.
Definition Arg.h:568
virtual void setDescription(const std::string &desc)
Updates the argument description.
Definition Arg.h:333
virtual bool operator==(const Arg &a) const
Operator ==.
Definition Arg.h:739
static const std::string flagStartString()
Definition Arg.h:266
const std::vector< ArgAlias > & aliases() const
Alias spellings in insertion order; no prefixes are stored.
Definition Arg.h:217
The base class that manages the command line definition and passes along the parsing to the appropria...
Definition CmdLine.h:85
Thrown from Arg and CmdLine when an Arg is improperly specified, e.g.
A base class that defines the interface for visitors.
Definition Visitor.h:32
virtual void visit()=0
This method (to implemented by children) will be called when the visitor is visited.
Definition Arg.h:52
std::vector< Arg * >::const_iterator ArgVectorIterator
Typedef of an Arg vector iterator.
Definition Arg.h:456
std::istringstream istringstream
Definition sstream.h:37
std::list< Arg * >::const_iterator ArgListIterator
Typedef of an Arg list iterator.
Definition Arg.h:451
std::list< Visitor * >::const_iterator VisitorListIterator
Typedef of a Visitor list iterator.
Definition Arg.h:461
void SetString(T &dst, const std::string &src)
void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl)
Definition Arg.h:470
An additional short flag and/or long name for the same argument.
Definition Arg.h:55
std::string name
Definition Arg.h:57
std::string flag
Definition Arg.h:56
ArgAlias(const std::string &f, const std::string &n)
Definition Arg.h:58
A string like argument value type is a value that can be set using operator=(string).
Definition ArgTraits.h:49
A value like argument value type is a value that can be set using operator>>.
Definition ArgTraits.h:39