190 const std::string aLongName,
191 const std::string aValueName,
192 const std::string aDescription,
194 :
CmdArg(aShortName, aLongName, aValueName, aDescription,
213 const std::string aValueName,
214 const std::string aDescription,
216 :
CmdArg(aValueName, aDescription,
251 bool temp=pCompiler.compile(arg, endptr, pValue);
255 se <<
"parsing error: " << pCompiler.errorMsg();
316 std::ostringstream os;
357 std::stringstream ret;
364 T pValue, pDefaultValue;
436 const std::string aLongName,
437 const std::string aValueName,
438 const std::string aDescription,
440 :
CmdArg(aShortName, aLongName, aValueName,
460 const std::string aValueName,
461 const std::string aDescription,
463 :
CmdArg(aValueName, aDescription,
489 std::vector<T>::operator=(v);
517 std::ostringstream os;
519 for (
typename std::vector<T>::const_iterator p=pDefaultValue.begin();
520 p!=pDefaultValue.end();
553 bool temp=pCompiler.compile(arg, endptr, value);
557 se <<
"parsing error: " << pCompiler.errorMsg();
564 std::vector<T>::clear();
566 this->push_back(value);
595 std::stringstream ret;
597 const_iterator it = this->begin();
598 if( it != this->end())
604 for( ; it != this->end(); ++it)
614 std::vector<T> pDefaultValue;
651 const std::string aLongName,
652 const std::string aValueName,
653 const std::string aDescription,
654 unsigned int aFixedSize,
656 :
CmdArg(aShortName, aLongName, aValueName,
659 pFixedSize(aFixedSize),
665 se <<
"syntax error: size of fixed vector is 0";
687 const std::string aValueName,
688 const std::string aDescription,
689 unsigned int aFixedSize,
691 :
CmdArg(aValueName, aDescription,
693 pFixedSize(aFixedSize),
699 se <<
"syntax error: size of fixed vector is 0";
725 if (pFixedSize!=v.size())
728 se <<
"syntax error: size of default vector does not match fixed size";
733 std::vector<T>::operator=(v);
761 std::ostringstream os;
763 for (
typename std::vector<T>::const_iterator p=pDefaultValue.begin();
764 p!=pDefaultValue.end();
797 bool temp=pCompiler.compile(arg, endptr, value);
801 se <<
"parsing error: " << pCompiler.errorMsg();
818 se <<
"syntax error: too many values for fixed vector";
822 this->push_back(value);
891 std::stringstream ret;
893 const_iterator it = this->begin();
894 if( it != this->end())
900 for( ; it != this->end(); ++it)
910 unsigned int pFixedSize;
911 std::vector<T> pDefaultValue;
942 const std::string aLongName,
943 const std::string aDescription,
945 :
CmdArg(aShortName, aLongName, aDescription,
1073 template<
typename E>
1093 const std::string aLongName,
1094 const std::string aDescription,
1096 :
CmdArg(aShortName, aLongName, aDescription,
virtual std::string valueTypeAsString() const
Return the value type as a std::string.
virtual bool parse(const char *arg, const char *&endptr, CmdLine &)
Parse value string.
virtual bool parse(const char *, const char *&, CmdLine &)
Set the value to true.
CmdArgTypeVector< T >::const_iterator const_iterator
virtual void setDefaultValue(const std::vector< T > &v)
Specify default value.
CmdArgTypeVector(char aShortName, const std::string aLongName, const std::string aValueName, const std::string aDescription, Syntax aSyntax=Syntax(isOPTVALREQ|isLIST))
Constructor.
virtual void setDefaultValue(const T &v)
Specify default value.
virtual std::string valueTypeAsString() const
Return the value type as a std::string.
virtual std::string getDefaultValueString() const
Returns the default value as a string.
virtual unsigned int fixedSize() const
Return the fixed size of the vector.
The CmdArgTypeFixedVector<T> class is a CmdArg that takes a fixed size list of values of type T...
virtual std::string valueTypeAsString() const
Return the value type as a std::string.
virtual ~CmdArgType()
Destructor.
virtual T & value()
Return the reference to the value of the argument.
virtual std::string valueAsString() const
Return the value as a std::string.
Syntax
Flags that define the argument syntax.
bool modified() const
Returns true if the argument was parsed at the last parsing run.
std::string typeToString(const std::string &)
The CmdArgSwitch class is a CmdArg that behaves like a switch: if it was specified on the command lin...
The CmdArg class is the abstract base class for all command line arguments.
virtual unsigned int fixedSize() const
Return fixed size if this CmdArg is a fixed list, return 0 otherwise.
virtual void clearFixedList()
Clear all values.
virtual std::string getDefaultValueString() const
Returns the default value as a string.
virtual std::string valueTypeAsString() const
Return the value type as a std::string.
virtual const T & value() const
Return the const reference to the value of the argument.
void adjustSyntax()
Adjust and correct specified syntax flags.
virtual ~CmdArgSwitch()
Destructor.
virtual std::string valueTypeAsString() const
Return the value type as a std::string.
CmdArgType(char aShortName, const std::string aLongName, const std::string aValueName, const std::string aDescription, Syntax aSyntax=isOPTVALREQ)
Constructor.
CmdArgTypeFixedVector< T >::const_iterator const_iterator
virtual bool hasDefaultValue() const
Returns true if a default value was specified.
argument value is a list of fixed size
bool & value()
Return the reference to the value of the argument.
bool toggled() const
Returns true if the argument was specified on the command line.
virtual bool hasDefaultValue() const
Returns true if a default value was specified.
CmdArgTypeVector(const std::string aValueName, const std::string aDescription, Syntax aSyntax=Syntax(isPOSVALREQ|isLIST))
Constructor.
Syntax Error. Is thrown when an syntax error occurs.
The CmdLine class is a parser for command line arguments.
virtual bool parse(const char *, const char *&, CmdLine &)
Throw exception E.
CmdArgTypeFixedVector(char aShortName, const std::string aLongName, const std::string aValueName, const std::string aDescription, unsigned int aFixedSize, Syntax aSyntax=Syntax(isOPTVALREQ|isFIXEDLIST))
Constructor.
virtual ~CmdArgTypeVector()
Destructor.
virtual std::string valueAsString() const
Return the value as a std::string.
virtual std::string getDefaultValueString() const
Returns the default value as a string.
CmdArgType(const std::string aValueName, const std::string aDescription, Syntax aSyntax=isPOSVALREQ)
Constructor.
virtual bool hasDefaultValue() const
Returns true if a default value was specified.
virtual std::string valueAsString() const
Return the value as a std::string.
virtual bool parse(const char *arg, const char *&endptr, CmdLine &)
Parse value string and append it to the vector.
void reset()
Reset status (set value to false).
virtual std::string valueAsString() const
Return the value as a std::string.
virtual unsigned int remainingSize() const
Return number of remaining values if this CmdArg is a fixed list, return 0 otherwise.
CmdArgThrow(char aShortName, const std::string aLongName, const std::string aDescription, Syntax aSyntax=isOPT)
Constructor.
The CmdArgType<T> class is a CmdArg that takes one value of type T.
CmdArgTypeFixedVector(const std::string aValueName, const std::string aDescription, unsigned int aFixedSize, Syntax aSyntax=Syntax(isPOSVALREQ|isFIXEDLIST))
Constructor.
The Compiler class is used by CmdArg classes to convert strings into desired datatypes.
virtual unsigned int remainingSize() const
Return the number of remaining values.
The CmdArgTypeVector<T> class is a CmdArg that takes a list of values of type T.
const bool & value() const
Return the const reference to the value of the argument.
virtual std::string valueAsString() const
Return the value as a std::string.
CmdArgSwitch(char aShortName, const std::string aLongName, const std::string aDescription, Syntax aSyntax=Syntax(isOPT))
Constructor.
virtual void setDefaultValue(const std::vector< T > &v)
Specify default value.
virtual ~CmdArgTypeFixedVector()
Destructor.
The CmdArgThrow<E> class is a CmdArg that throws an exception of type E when specified on the command...
virtual bool parse(const char *arg, const char *&endptr, CmdLine &)
Parse value string and append it to the vector.
virtual ~CmdArgThrow()
Destructor.