From a01538d7ba56240d3788610f0c2e2a7028a60858 Mon Sep 17 00:00:00 2001 From: mes5k Date: Tue, 7 Sep 2004 18:24:48 +0000 Subject: [PATCH] changed namespace std handling --- examples/test1.cpp | 1 + examples/test2.cpp | 1 + examples/test3.cpp | 1 + examples/test4.cpp | 1 + examples/test5.cpp | 1 + examples/test6.cpp | 1 + include/tclap/Arg.h | 50 ++++++++++--------- include/tclap/ArgException.h | 14 +++--- include/tclap/CommandLine.h | 28 +++++------ include/tclap/MultiArg.h | 80 +++++++++++++++---------------- include/tclap/PrintSensibly.h | 6 +-- include/tclap/SwitchArg.h | 12 ++--- include/tclap/UnlabeledMultiArg.h | 47 +++++++++--------- include/tclap/UnlabeledValueArg.h | 46 +++++++++--------- include/tclap/ValueArg.h | 70 +++++++++++++-------------- include/tclap/XorHandler.h | 10 ++-- src/Arg.cpp | 2 + src/CmdLine.cpp | 2 + src/PrintSensibly.cpp | 3 +- src/SwitchArg.cpp | 2 + src/XorHandler.cpp | 2 + 21 files changed, 188 insertions(+), 192 deletions(-) diff --git a/examples/test1.cpp b/examples/test1.cpp index 036de63..fecb57b 100644 --- a/examples/test1.cpp +++ b/examples/test1.cpp @@ -2,6 +2,7 @@ #include using namespace TCLAP; +using namespace std; int main(int argc, char** argv) { diff --git a/examples/test2.cpp b/examples/test2.cpp index f209df1..8d12ee9 100644 --- a/examples/test2.cpp +++ b/examples/test2.cpp @@ -5,6 +5,7 @@ #include using namespace TCLAP; +using namespace std; int _intTest; float _floatTest; diff --git a/examples/test3.cpp b/examples/test3.cpp index afb184d..ad2cfc6 100644 --- a/examples/test3.cpp +++ b/examples/test3.cpp @@ -5,6 +5,7 @@ #include using namespace TCLAP; +using namespace std; bool _boolTestB; string _stringTest; diff --git a/examples/test4.cpp b/examples/test4.cpp index 6cceca7..84ae6b9 100644 --- a/examples/test4.cpp +++ b/examples/test4.cpp @@ -5,6 +5,7 @@ #include using namespace TCLAP; +using namespace std; bool _boolTestB; bool _boolTestA; diff --git a/examples/test5.cpp b/examples/test5.cpp index a313a6a..0f77a57 100644 --- a/examples/test5.cpp +++ b/examples/test5.cpp @@ -5,6 +5,7 @@ #include using namespace TCLAP; +using namespace std; string _orTest; string _orTest2; diff --git a/examples/test6.cpp b/examples/test6.cpp index d7aef1b..388b363 100644 --- a/examples/test6.cpp +++ b/examples/test6.cpp @@ -2,6 +2,7 @@ #include using namespace TCLAP; +using namespace std; int main(int argc, char** argv) { diff --git a/include/tclap/Arg.h b/include/tclap/Arg.h index 59f3f42..32562b4 100644 --- a/include/tclap/Arg.h +++ b/include/tclap/Arg.h @@ -30,8 +30,6 @@ #include #include -using namespace std; - namespace TCLAP { /** @@ -66,7 +64,7 @@ class Arg * override appropriate functions to get correct handling. Note * that the _flag does NOT include the dash as part of the flag. */ - string _flag; + std::string _flag; /** * A single work namd indentifying the argument. @@ -75,12 +73,12 @@ class Arg * _name does NOT include the two dashes as part of the _name. The * _name cannot be blank. */ - string _name; + std::string _name; /** * Description of the argument. */ - string _description; + std::string _description; /** * Indicating whether the argument is required. @@ -91,7 +89,7 @@ class Arg * Label to be used in usage description. Normally set to * "required", but can be changed when necessary. */ - string _requireLabel; + std::string _requireLabel; /** * Indicates whether a value is required for the argument. @@ -137,7 +135,7 @@ class Arg * Adds this to the specified list of Args. * \param argList - The list to add this to. */ - virtual void addToList( list& argList ) const; + virtual void addToList( std::list& argList ) const; /** * Begin ignoring arguments since the "--" argument was specified. @@ -165,18 +163,18 @@ class Arg * The sting that indicates the beginning of a flag. Currently "-". * Should be identical to flagStartChar. */ - static const string flagStartString; + static const std::string flagStartString; /** * The sting that indicates the beginning of a name. Currently "--". * Should be flagStartChar twice. */ - static const string nameStartString; + static const std::string nameStartString; /** * The name used to identify the ignore rest argument. */ - static const string ignoreNameString; + static const std::string ignoreNameString; /** * Sets the delimiter for all arguments. @@ -193,9 +191,9 @@ class Arg * \param valreq - Whether the a value is required for the argument. * \param v - The visitor checked by the argument. Defaults to NULL. */ - Arg(const string& flag, - const string& name, - const string& desc, + Arg(const std::string& flag, + const std::string& name, + const std::string& desc, bool req, bool valreq, Visitor* v = NULL); @@ -235,7 +233,7 @@ class Arg * \param args - Mutable list of strings. What is * passed in from main. */ - virtual bool processArg(int *i, vector& args); + virtual bool processArg(int *i, std::vector& args); /** @@ -248,17 +246,17 @@ class Arg /** * Returns the argument flag. */ - const string& getFlag() const; + const std::string& getFlag() const; /** * Returns the argument name. */ - const string& getName() const; + const std::string& getName() const; /** * Returns the argument description. */ - string getDescription() const; + std::string getDescription() const; /** * Indicates whether the argument is required. @@ -301,25 +299,25 @@ class Arg * \param s - The string to be compared to the flag/name to determine * whether the arg matches. */ - virtual bool argMatches( const string& s ) const; + virtual bool argMatches( const std::string& s ) const; /** * Returns a simple string representation of the argument. * Primarily for debugging. */ - virtual string toString() const; + virtual std::string toString() const; /** * Returns a short ID for the usage. * \param valueId - The value used in the id. */ - virtual string shortID( const string& valueId = "val" ) const; + virtual std::string shortID( const std::string& valueId = "val" ) const; /** * Returns a long ID for the usage. * \param valueId - The value used in the id. */ - virtual string longID( const string& valueId = "val" ) const; + virtual std::string longID( const std::string& valueId = "val" ) const; /** * Trims a value off of the flag. @@ -328,7 +326,7 @@ class Arg * \param value - Where the value trimmed from the string will * be stored. */ - virtual void trimFlag( string& flag, string& value ) const; + virtual void trimFlag( std::string& flag, std::string& value ) const; /** * Checks whether a given string has blank chars, indicating that @@ -336,22 +334,22 @@ class Arg * false. * \param s - string to be checked. */ - bool _hasBlanks( const string& s ) const; + bool _hasBlanks( const std::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 ); + void setRequireLabel( const std::string& s ); }; /** * Typedef of a list iterator. */ -typedef list::iterator ArgIterator; -typedef vector::iterator ArgVectorIterator; +typedef std::list::iterator ArgIterator; +typedef std::vector::iterator ArgVectorIterator; } diff --git a/include/tclap/ArgException.h b/include/tclap/ArgException.h index ab675c2..14e38e5 100644 --- a/include/tclap/ArgException.h +++ b/include/tclap/ArgException.h @@ -25,8 +25,6 @@ #include -using namespace std; - namespace TCLAP { /** @@ -43,8 +41,8 @@ class ArgException * \param id - The text identifying the argument source * of the exception. */ - ArgException( const string& text = "undefined exception", - const string& id = "undefined" ) + ArgException( const std::string& text = "undefined exception", + const std::string& id = "undefined" ) : _errorText(text), _argId( id ) {}; /** @@ -78,12 +76,12 @@ class ArgException /** * Returns the error text. */ - string error() { return ( _errorText ); }; + std::string error() { return ( _errorText ); }; /** * Returns the argument id. */ - string argId() + std::string argId() { if ( _argId == "undefined" ) return " "; @@ -96,12 +94,12 @@ class ArgException /** * The text of the exception message. */ - string _errorText; + std::string _errorText; /** * The argument related to this exception. */ - string _argId; + std::string _argId; }; diff --git a/include/tclap/CommandLine.h b/include/tclap/CommandLine.h index a87e6ba..a3fefae 100644 --- a/include/tclap/CommandLine.h +++ b/include/tclap/CommandLine.h @@ -44,8 +44,6 @@ #include #include -using namespace std; - namespace TCLAP { /** @@ -60,22 +58,22 @@ class CmdLine * The list of arguments that will be tested against the * command line. */ - list _argList; + std::list _argList; /** * The name of the program. Set to argv[0]. */ - string _progName; + std::string _progName; /** * A message used to describe the program. Used in the usage output. */ - string _message; + std::string _message; /** * The version to be displayed with the --version switch. */ - string _version; + std::string _version; /** * The number of arguments that are required to be present on @@ -101,20 +99,20 @@ class CmdLine * into a single argument. * \param s - The message to be used in the usage. */ - bool _emptyCombined(const string& s); + bool _emptyCombined(const std::string& s); /** * Writes a brief usage message with short args. * \param os - The stream to write the message to. */ - void _shortUsage( ostream& os ); + void _shortUsage( std::ostream& os ); /** * Writes a longer usage message with long and short args, * provides descriptions and prints message. * \param os - The stream to write the message to. */ - void _longUsage( ostream& os ); + void _longUsage( std::ostream& os ); private: @@ -136,9 +134,9 @@ class CmdLine * \param version - The version number to be used in the * --version switch. */ - CmdLine(const string& name, - const string& message, - const string& version = "none" ); + CmdLine(const std::string& name, + const std::string& message, + const std::string& version = "none" ); /** * Command line constructor. Defines how the arguments will be @@ -150,9 +148,9 @@ class CmdLine * \param version - The version number to be used in the * --version switch. */ - CmdLine(const string& message, + CmdLine(const std::string& message, const char delimiter = ' ', - const string& version = "none" ); + const std::string& version = "none" ); /** * Adds an argument to the list of arguments to be parsed. @@ -179,7 +177,7 @@ class CmdLine * add does not need to be called. * \param xors - List of Args to be added and xor'd. */ - void xorAdd( vector& xors ); + void xorAdd( std::vector& xors ); /** * Prints the usage to stdout and exits. diff --git a/include/tclap/MultiArg.h b/include/tclap/MultiArg.h index 01edd3c..a58c1b1 100644 --- a/include/tclap/MultiArg.h +++ b/include/tclap/MultiArg.h @@ -28,8 +28,6 @@ #include #include -using namespace std; - namespace TCLAP { /** @@ -45,7 +43,7 @@ class MultiArg : public Arg /** * The list of values parsed from the CmdLine. */ - vector _values; + std::vector _values; /** * A list of allowed values. @@ -53,12 +51,12 @@ class MultiArg : public Arg * for this arg is not found in this list, then an exception is * thrown. If the list is empty, then any value is allowed. */ - vector _allowed; + std::vector _allowed; /** * The description of type T to be used in the usage. */ - string _typeDesc; + std::string _typeDesc; /** * Extracts the value from the string. @@ -67,13 +65,13 @@ class MultiArg : public Arg * \param val - The string to be read. */ - void _extractValue( const string& val ); + void _extractValue( const std::string& val ); /** * Checks to see if parsed value is in allowed list. * \param val - value parsed (only used in output). */ - void _checkAllowed( const string& val ); + void _checkAllowed( const std::string& val ); public: @@ -94,11 +92,11 @@ class MultiArg : public Arg * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ - MultiArg( const string& flag, - const string& name, - const string& desc, + MultiArg( const std::string& flag, + const std::string& name, + const std::string& desc, bool req, - const string& typeDesc, + const std::string& typeDesc, Visitor* v = NULL); /** @@ -116,11 +114,11 @@ class MultiArg : public Arg * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ - MultiArg( const string& flag, - const string& name, - const string& desc, + MultiArg( const std::string& flag, + const std::string& name, + const std::string& desc, bool req, - const vector& allowed, + const std::vector& allowed, Visitor* v = NULL); /** @@ -136,25 +134,25 @@ class MultiArg : public Arg * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. Passed from main(). */ - virtual bool processArg(int* i, vector& args); + virtual bool processArg(int* i, std::vector& args); /** * Returns a vector of type T containing the values parsed from * the command line. */ - const vector& getValue() ; + const std::vector& getValue() ; /** * Returns the a short id string. Used in the usage. * \param val - value to be used. */ - virtual string shortID(const string& val="val") const; + virtual std::string shortID(const std::string& val="val") const; /** * Returns the a long id string. Used in the usage. * \param val - value to be used. */ - virtual string longID(const string& val="val") const; + virtual std::string longID(const std::string& val="val") const; /** * Once we've matched the first value, then the arg is no longer @@ -168,11 +166,11 @@ class MultiArg : public Arg * */ template -MultiArg::MultiArg(const string& flag, - const string& name, - const string& desc, +MultiArg::MultiArg(const std::string& flag, + const std::string& name, + const std::string& desc, bool req, - const string& typeDesc, + const std::string& typeDesc, Visitor* v) : Arg( flag, name, desc, req, true, v ), _typeDesc( typeDesc ) @@ -183,21 +181,21 @@ MultiArg::MultiArg(const string& flag, * */ template -MultiArg::MultiArg(const string& flag, - const string& name, - const string& desc, +MultiArg::MultiArg(const std::string& flag, + const std::string& name, + const std::string& desc, bool req, - const vector& allowed, + const std::vector& allowed, Visitor* v) : Arg( flag, name, desc, req, true, v ), _allowed( allowed ) { for ( unsigned int i = 0; i < _allowed.size(); i++ ) { - ostringstream os; + std::ostringstream os; os << _allowed[i]; - string temp( os.str() ); + std::string temp( os.str() ); if ( i > 0 ) _typeDesc += "|"; @@ -216,13 +214,13 @@ MultiArg::~MultiArg() { }; * */ template -const vector& MultiArg::getValue() { return _values; }; +const std::vector& MultiArg::getValue() { return _values; }; /** * */ template -bool MultiArg::processArg(int *i, vector& args) +bool MultiArg::processArg(int *i, std::vector& args) { if ( _ignoreable && Arg::ignoreRest() ) return false; @@ -230,8 +228,8 @@ bool MultiArg::processArg(int *i, vector& args) if ( _hasBlanks( args[*i] ) ) return false; - string flag = args[*i]; - string value = ""; + std::string flag = args[*i]; + std::string value = ""; trimFlag( flag, value ); @@ -264,10 +262,10 @@ bool MultiArg::processArg(int *i, vector& args) * */ template -void MultiArg::_extractValue( const string& val ) +void MultiArg::_extractValue( const std::string& val ) { T temp; - istringstream is(val); + std::istringstream is(val); int valuesRead = 0; while ( is.good() ) @@ -300,7 +298,7 @@ void MultiArg::_extractValue( const string& val ) * because there is no way to tell operator>> to ignore spaces. */ template<> -void MultiArg::_extractValue( const string& val ) +void MultiArg::_extractValue( const std::string& val ) { _values.push_back( val ); @@ -311,7 +309,7 @@ void MultiArg::_extractValue( const string& val ) * Checks to see if the value parsed is in the allowed list. */ template -void MultiArg::_checkAllowed( const string& val ) +void MultiArg::_checkAllowed( const std::string& val ) { if ( _allowed.size() > 0 ) if ( find(_allowed.begin(),_allowed.end(),_values.back()) @@ -324,9 +322,9 @@ void MultiArg::_checkAllowed( const string& val ) * */ template -string MultiArg::shortID(const string& val) const +std::string MultiArg::shortID(const std::string& val) const { - string id = Arg::shortID(_typeDesc) + " ... "; + std::string id = Arg::shortID(_typeDesc) + " ... "; return id; } @@ -335,9 +333,9 @@ string MultiArg::shortID(const string& val) const * */ template -string MultiArg::longID(const string& val) const +std::string MultiArg::longID(const std::string& val) const { - string id = Arg::longID(_typeDesc) + " (accepted multiple times)"; + std::string id = Arg::longID(_typeDesc) + " (accepted multiple times)"; return id; } diff --git a/include/tclap/PrintSensibly.h b/include/tclap/PrintSensibly.h index f9623b5..15b2692 100644 --- a/include/tclap/PrintSensibly.h +++ b/include/tclap/PrintSensibly.h @@ -26,8 +26,6 @@ #include #include -using namespace std; - namespace TCLAP { /** @@ -40,8 +38,8 @@ namespace TCLAP { * \param secondLineOffset - The number of spaces to indent the second * and all subsequent lines in addition to indentSpaces. */ -void spacePrint( ostream& os, - const string& s, +void spacePrint( std::ostream& os, + const std::string& s, int maxWidth, int indentSpaces=0, int secondLineOffset=0 ); diff --git a/include/tclap/SwitchArg.h b/include/tclap/SwitchArg.h index 7bf064f..63dbb3f 100644 --- a/include/tclap/SwitchArg.h +++ b/include/tclap/SwitchArg.h @@ -29,8 +29,6 @@ #include #include -using namespace std; - namespace TCLAP { /** @@ -62,9 +60,9 @@ class SwitchArg : public Arg * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ - SwitchArg(const string& flag, - const string& name, - const string& desc, + SwitchArg(const std::string& flag, + const std::string& name, + const std::string& desc, bool def, Visitor* v = NULL); @@ -81,13 +79,13 @@ class SwitchArg : public Arg * \param args - Mutable list of strings. Passed * in from main(). */ - virtual bool processArg(int* i, vector& args); + virtual bool processArg(int* i, std::vector& args); /** * Checks a string to see if any of the chars in the string * match the flag for this Switch. */ - bool combinedSwitchesMatch(string& combined); + bool combinedSwitchesMatch(std::string& combined); /** * Returns bool, whether or not the switch has been set. diff --git a/include/tclap/UnlabeledMultiArg.h b/include/tclap/UnlabeledMultiArg.h index b6988f7..2afec70 100644 --- a/include/tclap/UnlabeledMultiArg.h +++ b/include/tclap/UnlabeledMultiArg.h @@ -30,8 +30,6 @@ #include -using namespace std; - namespace TCLAP { /** @@ -42,6 +40,7 @@ namespace TCLAP { template class UnlabeledMultiArg : public MultiArg { + #ifdef TWO_STAGE_NAME_LOOKUP //If compiler has two stage name lookup (as gcc >= 3.4 does) //this is requried to prevent undef. symbols @@ -70,9 +69,9 @@ class UnlabeledMultiArg : public MultiArg * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ - UnlabeledMultiArg( const string& name, - const string& desc, - const string& typeDesc, + UnlabeledMultiArg( const std::string& name, + const std::string& desc, + const std::string& typeDesc, bool ignoreable = false, Visitor* v = NULL ); @@ -89,9 +88,9 @@ class UnlabeledMultiArg : public MultiArg * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ - UnlabeledMultiArg( const string& name, - const string& desc, - const vector& allowed, + UnlabeledMultiArg( const std::string& name, + const std::string& desc, + const std::vector& allowed, bool ignoreable = false, Visitor* v = NULL ); @@ -103,19 +102,19 @@ class UnlabeledMultiArg : public MultiArg * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. Passed from main(). */ - virtual bool processArg(int* i, vector& args); + virtual bool processArg(int* i, std::vector& args); /** * Returns the a short id string. Used in the usage. * \param val - value to be used. */ - virtual string shortID(const string& val="val") const; + virtual std::string shortID(const std::string& val="val") const; /** * Returns the a long id string. Used in the usage. * \param val - value to be used. */ - virtual string longID(const string& val="val") const; + virtual std::string longID(const std::string& val="val") const; /** * Opertor ==. @@ -127,13 +126,13 @@ class UnlabeledMultiArg : public MultiArg * Pushes this to back of list rather than front. * \param argList - The list this should be added to. */ - virtual void addToList( list& argList ) const; + virtual void addToList( std::list& argList ) const; }; template -UnlabeledMultiArg::UnlabeledMultiArg(const string& name, - const string& desc, - const string& typeDesc, +UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, + const std::string& desc, + const std::string& typeDesc, bool ignoreable, Visitor* v) : MultiArg("", name, desc, false, typeDesc, v) @@ -142,9 +141,9 @@ UnlabeledMultiArg::UnlabeledMultiArg(const string& name, }; template -UnlabeledMultiArg::UnlabeledMultiArg(const string& name, - const string& desc, - const vector& allowed, +UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, + const std::string& desc, + const std::vector& allowed, bool ignoreable, Visitor* v) : MultiArg("", name, desc, false, allowed, v) @@ -153,7 +152,7 @@ UnlabeledMultiArg::UnlabeledMultiArg(const string& name, }; template -bool UnlabeledMultiArg::processArg(int *i, vector& args) +bool UnlabeledMultiArg::processArg(int *i, std::vector& args) { if ( _hasBlanks( args[*i] ) ) @@ -166,17 +165,17 @@ bool UnlabeledMultiArg::processArg(int *i, vector& args) } template -string UnlabeledMultiArg::shortID(const string& val) const +std::string UnlabeledMultiArg::shortID(const std::string& val) const { - string id = "<" + _typeDesc + "> ..."; + std::string id = "<" + _typeDesc + "> ..."; return id; } template -string UnlabeledMultiArg::longID(const string& val) const +std::string UnlabeledMultiArg::longID(const std::string& val) const { - string id = "<" + _typeDesc + "> (accepted multiple times)"; + std::string id = "<" + _typeDesc + "> (accepted multiple times)"; return id; } @@ -191,7 +190,7 @@ bool UnlabeledMultiArg::operator==(const Arg& a) const } template -void UnlabeledMultiArg::addToList( list& argList ) const +void UnlabeledMultiArg::addToList( std::list& argList ) const { argList.push_back( (Arg*)this ); } diff --git a/include/tclap/UnlabeledValueArg.h b/include/tclap/UnlabeledValueArg.h index 0f74994..6d55845 100644 --- a/include/tclap/UnlabeledValueArg.h +++ b/include/tclap/UnlabeledValueArg.h @@ -30,8 +30,6 @@ #include #include -using namespace std; - namespace TCLAP { /** @@ -81,10 +79,10 @@ class UnlabeledValueArg : public ValueArg * \param v - Optional Vistor. You should leave this blank unless * you have a very good reason. */ - UnlabeledValueArg(const string& name, - const string& desc, + UnlabeledValueArg(const std::string& name, + const std::string& desc, T value, - const string& typeDesc, + const std::string& typeDesc, bool ignoreable = false, Visitor* v = NULL); @@ -109,10 +107,10 @@ class UnlabeledValueArg : public ValueArg * \param v - Optional Vistor. You should leave this blank unless * you have a very good reason. */ - UnlabeledValueArg(const string& name, - const string& desc, + UnlabeledValueArg(const std::string& name, + const std::string& desc, T value, - const vector& allowed, + const std::vector& allowed, bool ignoreable = false, Visitor* v = NULL); @@ -124,17 +122,17 @@ class UnlabeledValueArg : public ValueArg * \param i - Pointer the the current argument in the list. * \param args - Mutable list of strings. */ - virtual bool processArg(int* i, vector& args); + virtual bool processArg(int* i, std::vector& args); /** * Overrides shortID for specific behavior. */ - virtual string shortID(const string& val="val") const; + virtual std::string shortID(const std::string& val="val") const; /** * Overrides longID for specific behavior. */ - virtual string longID(const string& val="val") const; + virtual std::string longID(const std::string& val="val") const; /** * Overrides operator== for specific behavior. @@ -145,17 +143,17 @@ class UnlabeledValueArg : public ValueArg * Instead of pushing to the front of list, push to the back. * \param argList - The list to add this to. */ - virtual void addToList( list& argList ) const; + virtual void addToList( std::list& argList ) const; }; /** * Constructor implemenation. */ template -UnlabeledValueArg::UnlabeledValueArg(const string& name, - const string& desc, +UnlabeledValueArg::UnlabeledValueArg(const std::string& name, + const std::string& desc, T val, - const string& typeDesc, + const std::string& typeDesc, bool ignoreable, Visitor* v) : ValueArg("", name, desc, true, val, typeDesc, v) @@ -167,10 +165,10 @@ UnlabeledValueArg::UnlabeledValueArg(const string& name, * Constructor implemenation. */ template -UnlabeledValueArg::UnlabeledValueArg(const string& name, - const string& desc, +UnlabeledValueArg::UnlabeledValueArg(const std::string& name, + const std::string& desc, T val, - const vector& allowed, + const std::vector& allowed, bool ignoreable, Visitor* v) : ValueArg("", name, desc, true, val, allowed, v) @@ -182,7 +180,7 @@ UnlabeledValueArg::UnlabeledValueArg(const string& name, * Implementation of processArg(). */ template -bool UnlabeledValueArg::processArg(int *i, vector& args) +bool UnlabeledValueArg::processArg(int *i, std::vector& args) { if ( _alreadySet ) @@ -202,9 +200,9 @@ bool UnlabeledValueArg::processArg(int *i, vector& args) * Overriding shortID for specific output. */ template -string UnlabeledValueArg::shortID(const string& val) const +std::string UnlabeledValueArg::shortID(const std::string& val) const { - string id = "<" + _typeDesc + ">"; + std::string id = "<" + _typeDesc + ">"; return id; } @@ -213,12 +211,12 @@ string UnlabeledValueArg::shortID(const string& val) const * Overriding longID for specific output. */ template -string UnlabeledValueArg::longID(const string& val) const +std::string UnlabeledValueArg::longID(const std::string& val) const { // Ideally we would like to be able to use RTTI to return the name // of the type required for this argument. However, g++ at least, // doesn't appear to return terribly useful "names" of the types. - string id = "<" + _typeDesc + ">"; + std::string id = "<" + _typeDesc + ">"; return id; } @@ -236,7 +234,7 @@ bool UnlabeledValueArg::operator==(const Arg& a ) const } template -void UnlabeledValueArg::addToList( list& argList ) const +void UnlabeledValueArg::addToList( std::list& argList ) const { argList.push_back( (Arg*)this ); } diff --git a/include/tclap/ValueArg.h b/include/tclap/ValueArg.h index 8e28627..ecec527 100644 --- a/include/tclap/ValueArg.h +++ b/include/tclap/ValueArg.h @@ -29,8 +29,6 @@ #include #include -using namespace std; - namespace TCLAP { /** @@ -59,7 +57,7 @@ class ValueArg : public Arg * for this arg is not found in this list, then an exception is * thrown. If the list is empty, then any value is allowed. */ - vector _allowed; + std::vector _allowed; /** * A human readable description of the type to be parsed. @@ -68,7 +66,7 @@ class ValueArg : public Arg * consistent support for human readable names, we are left to our * own devices. */ - string _typeDesc; + std::string _typeDesc; /** * Extracts the value from the string. @@ -76,13 +74,13 @@ class ValueArg : public Arg * is thrown. * \param val - value to be parsed. */ - void _extractValue( const string& val ); + void _extractValue( const std::string& val ); /** * Checks to see if parsed value is in allowed list. * \param val - value parsed (only used in output). */ - void _checkAllowed( const string& val ); + void _checkAllowed( const std::string& val ); public: @@ -109,12 +107,12 @@ class ValueArg : public Arg * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ - ValueArg(const string& flag, - const string& name, - const string& desc, + ValueArg(const std::string& flag, + const std::string& name, + const std::string& desc, bool req, T value, - const string& typeDesc, + const std::string& typeDesc, Visitor* v = NULL); /** @@ -138,12 +136,12 @@ class ValueArg : public Arg * \param v - An optional visitor. You probably should not * use this unless you have a very good reason. */ - ValueArg(const string& flag, - const string& name, - const string& desc, + ValueArg(const std::string& flag, + const std::string& name, + const std::string& desc, bool req, T value, - const vector& allowed, + const std::vector& allowed, Visitor* v = NULL); /** @@ -160,7 +158,7 @@ class ValueArg : public Arg * \param args - Mutable list of strings. Passed * in from main(). */ - virtual bool processArg(int* i, vector& args); + virtual bool processArg(int* i, std::vector& args); /** * Returns the value of the argument. @@ -171,13 +169,13 @@ class ValueArg : public Arg * Specialization of shortID. * \param val - value to be used. */ - virtual string shortID(const string& val = "val") const; + virtual std::string shortID(const std::string& val = "val") const; /** * Specialization of longID. * \param val - value to be used. */ - virtual string longID(const string& val = "val") const; + virtual std::string longID(const std::string& val = "val") const; }; @@ -186,12 +184,12 @@ class ValueArg : public Arg * Constructor implementation. */ template -ValueArg::ValueArg(const string& flag, - const string& name, - const string& desc, +ValueArg::ValueArg(const std::string& flag, + const std::string& name, + const std::string& desc, bool req, T val, - const string& typeDesc, + const std::string& typeDesc, Visitor* v) : Arg(flag, name, desc, req, true, v), _value( val ), @@ -202,12 +200,12 @@ ValueArg::ValueArg(const string& flag, * Constructor with allowed list. */ template -ValueArg::ValueArg(const string& flag, - const string& name, - const string& desc, +ValueArg::ValueArg(const std::string& flag, + const std::string& name, + const std::string& desc, bool req, T val, - const vector& allowed, + const std::vector& allowed, Visitor* v) : Arg(flag, name, desc, req, true, v), _value( val ), @@ -215,10 +213,10 @@ ValueArg::ValueArg(const string& flag, { for ( unsigned int i = 0; i < _allowed.size(); i++ ) { - ostringstream os; + std::ostringstream os; os << _allowed[i]; - string temp( os.str() ); + std::string temp( os.str() ); if ( i > 0 ) _typeDesc += "|"; @@ -243,7 +241,7 @@ T& ValueArg::getValue() { return _value; }; * Implementation of processArg(). */ template -bool ValueArg::processArg(int *i, vector& args) +bool ValueArg::processArg(int *i, std::vector& args) { if ( _ignoreable && Arg::ignoreRest() ) return false; @@ -251,9 +249,9 @@ bool ValueArg::processArg(int *i, vector& args) if ( _hasBlanks( args[*i] ) ) return false; - string flag = args[*i]; + std::string flag = args[*i]; - string value = ""; + std::string value = ""; trimFlag( flag, value ); if ( argMatches( flag ) ) @@ -289,9 +287,9 @@ bool ValueArg::processArg(int *i, vector& args) * Implementation of _extractValue. */ template -void ValueArg::_extractValue( const string& val ) +void ValueArg::_extractValue( const std::string& val ) { - istringstream is(val); + std::istringstream is(val); int valuesRead = 0; while ( is.good() ) @@ -320,7 +318,7 @@ void ValueArg::_extractValue( const string& val ) * read 'X'... and thus the specialization. */ template<> -void ValueArg::_extractValue( const string& val ) +void ValueArg::_extractValue( const std::string& val ) { _value = val; _checkAllowed( val ); @@ -330,7 +328,7 @@ void ValueArg::_extractValue( const string& val ) * Checks to see if the value parsed is in the allowed list. */ template -void ValueArg::_checkAllowed( const string& val ) +void ValueArg::_checkAllowed( const std::string& val ) { if ( _allowed.size() > 0 ) if ( find(_allowed.begin(),_allowed.end(),_value) == _allowed.end() ) @@ -342,7 +340,7 @@ void ValueArg::_checkAllowed( const string& val ) * Implementation of shortID. */ template -string ValueArg::shortID(const string& val) const +std::string ValueArg::shortID(const std::string& val) const { return Arg::shortID( _typeDesc ); } @@ -351,7 +349,7 @@ string ValueArg::shortID(const string& val) const * Implementation of longID. */ template -string ValueArg::longID(const string& val) const +std::string ValueArg::longID(const std::string& val) const { return Arg::longID( _typeDesc ); } diff --git a/include/tclap/XorHandler.h b/include/tclap/XorHandler.h index ef4f3e9..567f68d 100644 --- a/include/tclap/XorHandler.h +++ b/include/tclap/XorHandler.h @@ -29,8 +29,6 @@ #include #include -using namespace std; - namespace TCLAP { /** @@ -44,7 +42,7 @@ class XorHandler /** * The list of of lists of Arg's to be or'd together. */ - vector< vector > _orList; + std::vector< std::vector > _orList; public: @@ -57,7 +55,7 @@ class XorHandler * Add a list of Arg*'s that will be orred together. * \param ors - list of Arg* that will be xor'd. */ - void add( vector& ors ); + void add( std::vector& ors ); /** * Checks whether the specified Arg is in one of the xor lists and @@ -71,13 +69,13 @@ class XorHandler /** * Returns the XOR specific short usage. */ - string shortUsage(); + std::string shortUsage(); /** * Prints the XOR specific long usage. * \param os - Stream to print to. */ - void printLongUsage(ostream& os); + void printLongUsage(std::ostream& os); /** * Simply checks whether the Arg is contained in one of the arg diff --git a/src/Arg.cpp b/src/Arg.cpp index 92cb82f..86cecd5 100644 --- a/src/Arg.cpp +++ b/src/Arg.cpp @@ -22,6 +22,8 @@ #include +using namespace std; + namespace TCLAP { // defaults diff --git a/src/CmdLine.cpp b/src/CmdLine.cpp index 607b6da..8858dec 100644 --- a/src/CmdLine.cpp +++ b/src/CmdLine.cpp @@ -22,6 +22,8 @@ #include +using namespace std; + namespace TCLAP { CmdLine::CmdLine(const string& n, const string& m, const string& v ) diff --git a/src/PrintSensibly.cpp b/src/PrintSensibly.cpp index f9487dd..85afbeb 100644 --- a/src/PrintSensibly.cpp +++ b/src/PrintSensibly.cpp @@ -22,8 +22,9 @@ #include -namespace TCLAP { +using namespace std; +namespace TCLAP { void spacePrint( ostream& os, const string& s, diff --git a/src/SwitchArg.cpp b/src/SwitchArg.cpp index de00d3f..0171c4b 100644 --- a/src/SwitchArg.cpp +++ b/src/SwitchArg.cpp @@ -22,6 +22,8 @@ #include +using namespace std; + namespace TCLAP { SwitchArg::SwitchArg(const string& flag, diff --git a/src/XorHandler.cpp b/src/XorHandler.cpp index b72dd6e..2638326 100644 --- a/src/XorHandler.cpp +++ b/src/XorHandler.cpp @@ -22,6 +22,8 @@ #include +using namespace std; + namespace TCLAP { XorHandler::XorHandler( )