diff --git a/include/tclap/Arg.h b/include/tclap/Arg.h index 06dc59a..95f993e 100644 --- a/include/tclap/Arg.h +++ b/include/tclap/Arg.h @@ -87,6 +87,12 @@ class Arg */ bool _required; + /** + * Label to be used in usage description. Normally set to + * "required", but can be changed when necessary. + */ + string _requireLabel; + /** * Indicates whether a value is required for the argument. * Note that the value may be required but the argument/value @@ -114,6 +120,12 @@ class Arg */ bool _ignoreable; + /** + * Indicates that the arg was set as part of an XOR and not on the + * command line. + */ + bool _xorSet; + /** * Performs the special handling described by the Vistitor. */ @@ -242,15 +254,28 @@ class Arg */ bool isRequired() const; + /** + * Sets _required to true. This is used by the XorHandler. + * You really have no reason to ever use it. + */ + void forceRequired(); + + /** + * Sets the _alreadySet value to true. This is used by the XorHandler. + * You really have no reason to ever use it. + */ + void xorSet(); + /** * Indicates whether a value must be specified for argument. */ bool isValueRequired() const; /** - * Indicates whether the argument has already been set. + * Indicates whether the argument has already been set. Only true + * if the arg has been matched on the command line. */ - bool isAlreadySet() const; + bool isSet() const; /** * Indicates whether the argument can be ignored, if desired. @@ -298,9 +323,16 @@ class Arg * Checks whether a given string has blank chars, indicating that * it is a combined SwitchArg. If so, return true, otherwise return * false. + * \param s - string to be checked. */ bool _hasBlanks( const string& s ) const; + /** + * Sets the requireLabel. Used by XorHandler. You shouldn't ever + * use this. + * \param s - Set the requireLabel to this value. + */ + void setRequireLabel( const string& s ); }; @@ -308,6 +340,7 @@ class Arg * Typedef of a list iterator. */ typedef list::iterator ArgIterator; +typedef vector::iterator ArgVectorIterator; } diff --git a/include/tclap/CmdLine.h b/include/tclap/CmdLine.h index 0a44780..3aca7b2 100644 --- a/include/tclap/CmdLine.h +++ b/include/tclap/CmdLine.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #endif diff --git a/include/tclap/CommandLine.h b/include/tclap/CommandLine.h index 695f82c..fe0b9b0 100644 --- a/include/tclap/CommandLine.h +++ b/include/tclap/CommandLine.h @@ -22,14 +22,17 @@ #ifndef __COMMANDLINE_HH__ #define __COMMANDLINE_HH__ +// +// Explanation of dumb naming. Originally this file was used as the generic +// include to use the tclap library. However, this introduced a few weird +// bugs related to g++. Thus, this file has been renamed, and CmdLine.h +// just contains the files needed to use the lib. +// + #include #include -//#include -//#include -//#include -//#include #include -#include +#include #include #include #include @@ -43,6 +46,10 @@ using namespace std; namespace TCLAP { +/** + * The base class that manages the command line definition and passes + * along the parsing to the appropriate Arg classes. + */ class CmdLine { protected: @@ -81,7 +88,10 @@ class CmdLine */ char _delimiter; - OrHandler _xorHandler; + /** + * The handler that manages xoring lists of args. + */ + XorHandler _xorHandler; /** * Checks whether a name/flag string matches entirely matches @@ -134,9 +144,27 @@ class CmdLine * \param a - Argument to be added. */ void add( Arg& a ); + + /** + * An alternative add. Functionally identical. + * \param a - Argument to be added. + */ void add( Arg* a ); + + /** + * Add two Args that will be xor'd. If this method is used, add does + * not need to be called. + * \param a - Argument to be added and xor'd. + * \param b - Argument to be added and xor'd. + */ void xorAdd( Arg& a, Arg& b ); - void xorAdd( vector& ors ); + + /** + * Add a list of Args that will be xor'd. If this method is used, + * add does not need to be called. + * \param xors - List of Args to be added and xor'd. + */ + void xorAdd( vector& xors ); /** * Prints the usage to stdout and exits.