now optionally required

This commit is contained in:
mes5k 2005-01-24 01:54:06 +00:00
parent 00e2f3eb7e
commit 46328568c4

View File

@ -55,14 +55,12 @@ class UnlabeledValueArg : public ValueArg<T>
/** /**
* UnlabeledValueArg constructor. * UnlabeledValueArg constructor.
* Note that this constructor does not have a required flag. Any
* unlabeled argument added to the CmdLine is by default required.
* If you want optional, unlabeled arguments then use an
* UnlabeledMultiArg.
* \param name - A one word name for the argument. Can be * \param name - A one word name for the argument. Can be
* used as a long flag on the command line. * used as a long flag on the command line.
* \param desc - A description of what the argument is for or * \param desc - A description of what the argument is for or
* does. * does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it * \param value - The default value assigned to this argument if it
* is not present on the command line. * is not present on the command line.
* \param typeDesc - A short, human readable description of the * \param typeDesc - A short, human readable description of the
@ -78,6 +76,7 @@ class UnlabeledValueArg : public ValueArg<T>
*/ */
UnlabeledValueArg( const std::string& name, UnlabeledValueArg( const std::string& name,
const std::string& desc, const std::string& desc,
bool req,
T value, T value,
const std::string& typeDesc, const std::string& typeDesc,
bool ignoreable = false, bool ignoreable = false,
@ -85,14 +84,12 @@ class UnlabeledValueArg : public ValueArg<T>
/** /**
* UnlabeledValueArg constructor. * UnlabeledValueArg constructor.
* Note that this constructor does not have a required flag. Any
* unlabeled argument added to the CmdLine is by default required.
* If you want optional, unlabeled arguments then use an
* UnlabeledMultiArg.
* \param name - A one word name for the argument. Can be * \param name - A one word name for the argument. Can be
* used as a long flag on the command line. * used as a long flag on the command line.
* \param desc - A description of what the argument is for or * \param desc - A description of what the argument is for or
* does. * does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it * \param value - The default value assigned to this argument if it
* is not present on the command line. * is not present on the command line.
* \param typeDesc - A short, human readable description of the * \param typeDesc - A short, human readable description of the
@ -109,6 +106,7 @@ class UnlabeledValueArg : public ValueArg<T>
*/ */
UnlabeledValueArg( const std::string& name, UnlabeledValueArg( const std::string& name,
const std::string& desc, const std::string& desc,
bool req,
T value, T value,
const std::string& typeDesc, const std::string& typeDesc,
CmdLineInterface& parser, CmdLineInterface& parser,
@ -117,14 +115,12 @@ class UnlabeledValueArg : public ValueArg<T>
/** /**
* UnlabeledValueArg constructor. * UnlabeledValueArg constructor.
* Note that this constructor does not have a required flag. Any
* unlabeled argument added to the CmdLine is by default required.
* If you want optional, unlabeled arguments then use an
* UnlabeledMultiArg.
* \param name - A one word name for the argument. Can be * \param name - A one word name for the argument. Can be
* used as a long flag on the command line. * used as a long flag on the command line.
* \param desc - A description of what the argument is for or * \param desc - A description of what the argument is for or
* does. * does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it * \param value - The default value assigned to this argument if it
* is not present on the command line. * is not present on the command line.
* \param constraint - A pointer to a Constraint object used * \param constraint - A pointer to a Constraint object used
@ -138,6 +134,7 @@ class UnlabeledValueArg : public ValueArg<T>
*/ */
UnlabeledValueArg( const std::string& name, UnlabeledValueArg( const std::string& name,
const std::string& desc, const std::string& desc,
bool req,
T value, T value,
Constraint<T>* constraint, Constraint<T>* constraint,
bool ignoreable = false, bool ignoreable = false,
@ -146,14 +143,12 @@ class UnlabeledValueArg : public ValueArg<T>
/** /**
* UnlabeledValueArg constructor. * UnlabeledValueArg constructor.
* Note that this constructor does not have a required flag. Any
* unlabeled argument added to the CmdLine is by default required.
* If you want optional, unlabeled arguments then use an
* UnlabeledMultiArg.
* \param name - A one word name for the argument. Can be * \param name - A one word name for the argument. Can be
* used as a long flag on the command line. * used as a long flag on the command line.
* \param desc - A description of what the argument is for or * \param desc - A description of what the argument is for or
* does. * does.
* \param req - Whether the argument is required on the command
* line.
* \param value - The default value assigned to this argument if it * \param value - The default value assigned to this argument if it
* is not present on the command line. * is not present on the command line.
* \param constraint - A pointer to a Constraint object used * \param constraint - A pointer to a Constraint object used
@ -168,6 +163,7 @@ class UnlabeledValueArg : public ValueArg<T>
*/ */
UnlabeledValueArg( const std::string& name, UnlabeledValueArg( const std::string& name,
const std::string& desc, const std::string& desc,
bool req,
T value, T value,
Constraint<T>* constraint, Constraint<T>* constraint,
CmdLineInterface& parser, CmdLineInterface& parser,
@ -212,11 +208,12 @@ class UnlabeledValueArg : public ValueArg<T>
template<class T> template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name, UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc, const std::string& desc,
bool req,
T val, T val,
const std::string& typeDesc, const std::string& typeDesc,
bool ignoreable, bool ignoreable,
Visitor* v) Visitor* v)
: ValueArg<T>("", name, desc, true, val, typeDesc, v) : ValueArg<T>("", name, desc, req, val, typeDesc, v)
{ {
_ignoreable = ignoreable; _ignoreable = ignoreable;
} }
@ -224,12 +221,13 @@ UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
template<class T> template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name, UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc, const std::string& desc,
bool req,
T val, T val,
const std::string& typeDesc, const std::string& typeDesc,
CmdLineInterface& parser, CmdLineInterface& parser,
bool ignoreable, bool ignoreable,
Visitor* v) Visitor* v)
: ValueArg<T>("", name, desc, true, val, typeDesc, v) : ValueArg<T>("", name, desc, req, val, typeDesc, v)
{ {
_ignoreable = ignoreable; _ignoreable = ignoreable;
parser.add( this ); parser.add( this );
@ -241,11 +239,12 @@ UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
template<class T> template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name, UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc, const std::string& desc,
bool req,
T val, T val,
Constraint<T>* constraint, Constraint<T>* constraint,
bool ignoreable, bool ignoreable,
Visitor* v) Visitor* v)
: ValueArg<T>("", name, desc, true, val, constraint, v) : ValueArg<T>("", name, desc, req, val, constraint, v)
{ {
_ignoreable = ignoreable; _ignoreable = ignoreable;
} }
@ -253,12 +252,13 @@ UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
template<class T> template<class T>
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name, UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
const std::string& desc, const std::string& desc,
bool req,
T val, T val,
Constraint<T>* constraint, Constraint<T>* constraint,
CmdLineInterface& parser, CmdLineInterface& parser,
bool ignoreable, bool ignoreable,
Visitor* v) Visitor* v)
: ValueArg<T>("", name, desc, true, val, constraint, v) : ValueArg<T>("", name, desc, req, val, constraint, v)
{ {
_ignoreable = ignoreable; _ignoreable = ignoreable;
parser.add( this ); parser.add( this );