mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-14 22:54:45 -04:00
changed namespace std handling
This commit is contained in:
parent
4e311b2219
commit
a01538d7ba
@ -2,6 +2,7 @@
|
||||
#include <tclap/CmdLine.h>
|
||||
|
||||
using namespace TCLAP;
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
|
||||
using namespace TCLAP;
|
||||
using namespace std;
|
||||
|
||||
int _intTest;
|
||||
float _floatTest;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
|
||||
using namespace TCLAP;
|
||||
using namespace std;
|
||||
|
||||
bool _boolTestB;
|
||||
string _stringTest;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
|
||||
using namespace TCLAP;
|
||||
using namespace std;
|
||||
|
||||
bool _boolTestB;
|
||||
bool _boolTestA;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
|
||||
using namespace TCLAP;
|
||||
using namespace std;
|
||||
|
||||
string _orTest;
|
||||
string _orTest2;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <tclap/CmdLine.h>
|
||||
|
||||
using namespace TCLAP;
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include <tclap/ArgException.h>
|
||||
#include <tclap/Visitor.h>
|
||||
|
||||
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<Arg*>& argList ) const;
|
||||
virtual void addToList( std::list<Arg*>& 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<string>& args);
|
||||
virtual bool processArg(int *i, std::vector<std::string>& 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<Arg*>::iterator ArgIterator;
|
||||
typedef vector<Arg*>::iterator ArgVectorIterator;
|
||||
typedef std::list<Arg*>::iterator ArgIterator;
|
||||
typedef std::vector<Arg*>::iterator ArgVectorIterator;
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
@ -44,8 +44,6 @@
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
/**
|
||||
@ -60,22 +58,22 @@ class CmdLine
|
||||
* The list of arguments that will be tested against the
|
||||
* command line.
|
||||
*/
|
||||
list<Arg*> _argList;
|
||||
std::list<Arg*> _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<Arg*>& xors );
|
||||
void xorAdd( std::vector<Arg*>& xors );
|
||||
|
||||
/**
|
||||
* Prints the usage to stdout and exits.
|
||||
|
@ -28,8 +28,6 @@
|
||||
#include <sstream>
|
||||
#include <tclap/Visitor.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
/**
|
||||
@ -45,7 +43,7 @@ class MultiArg : public Arg
|
||||
/**
|
||||
* The list of values parsed from the CmdLine.
|
||||
*/
|
||||
vector<T> _values;
|
||||
std::vector<T> _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<T> _allowed;
|
||||
std::vector<T> _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<T>& allowed,
|
||||
const std::vector<T>& 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<string>& args);
|
||||
virtual bool processArg(int* i, std::vector<std::string>& args);
|
||||
|
||||
/**
|
||||
* Returns a vector of type T containing the values parsed from
|
||||
* the command line.
|
||||
*/
|
||||
const vector<T>& getValue() ;
|
||||
const std::vector<T>& 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<class T>
|
||||
MultiArg<T>::MultiArg(const string& flag,
|
||||
const string& name,
|
||||
const string& desc,
|
||||
MultiArg<T>::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<T>::MultiArg(const string& flag,
|
||||
*
|
||||
*/
|
||||
template<class T>
|
||||
MultiArg<T>::MultiArg(const string& flag,
|
||||
const string& name,
|
||||
const string& desc,
|
||||
MultiArg<T>::MultiArg(const std::string& flag,
|
||||
const std::string& name,
|
||||
const std::string& desc,
|
||||
bool req,
|
||||
const vector<T>& allowed,
|
||||
const std::vector<T>& 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<T>::~MultiArg() { };
|
||||
*
|
||||
*/
|
||||
template<class T>
|
||||
const vector<T>& MultiArg<T>::getValue() { return _values; };
|
||||
const std::vector<T>& MultiArg<T>::getValue() { return _values; };
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
template<class T>
|
||||
bool MultiArg<T>::processArg(int *i, vector<string>& args)
|
||||
bool MultiArg<T>::processArg(int *i, std::vector<std::string>& args)
|
||||
{
|
||||
if ( _ignoreable && Arg::ignoreRest() )
|
||||
return false;
|
||||
@ -230,8 +228,8 @@ bool MultiArg<T>::processArg(int *i, vector<string>& 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<T>::processArg(int *i, vector<string>& args)
|
||||
*
|
||||
*/
|
||||
template<class T>
|
||||
void MultiArg<T>::_extractValue( const string& val )
|
||||
void MultiArg<T>::_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<T>::_extractValue( const string& val )
|
||||
* because there is no way to tell operator>> to ignore spaces.
|
||||
*/
|
||||
template<>
|
||||
void MultiArg<string>::_extractValue( const string& val )
|
||||
void MultiArg<std::string>::_extractValue( const std::string& val )
|
||||
{
|
||||
_values.push_back( val );
|
||||
|
||||
@ -311,7 +309,7 @@ void MultiArg<string>::_extractValue( const string& val )
|
||||
* Checks to see if the value parsed is in the allowed list.
|
||||
*/
|
||||
template<class T>
|
||||
void MultiArg<T>::_checkAllowed( const string& val )
|
||||
void MultiArg<T>::_checkAllowed( const std::string& val )
|
||||
{
|
||||
if ( _allowed.size() > 0 )
|
||||
if ( find(_allowed.begin(),_allowed.end(),_values.back())
|
||||
@ -324,9 +322,9 @@ void MultiArg<T>::_checkAllowed( const string& val )
|
||||
*
|
||||
*/
|
||||
template<class T>
|
||||
string MultiArg<T>::shortID(const string& val) const
|
||||
std::string MultiArg<T>::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<T>::shortID(const string& val) const
|
||||
*
|
||||
*/
|
||||
template<class T>
|
||||
string MultiArg<T>::longID(const string& val) const
|
||||
std::string MultiArg<T>::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;
|
||||
}
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
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 );
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include <tclap/Arg.h>
|
||||
#include <tclap/ArgException.h>
|
||||
|
||||
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<string>& args);
|
||||
virtual bool processArg(int* i, std::vector<std::string>& 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.
|
||||
|
@ -30,8 +30,6 @@
|
||||
|
||||
#include <tclap/Arg.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
/**
|
||||
@ -42,6 +40,7 @@ namespace TCLAP {
|
||||
template<class T>
|
||||
class UnlabeledMultiArg : public MultiArg<T>
|
||||
{
|
||||
|
||||
#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<T>
|
||||
* \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<T>
|
||||
* \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<T>& allowed,
|
||||
UnlabeledMultiArg( const std::string& name,
|
||||
const std::string& desc,
|
||||
const std::vector<T>& allowed,
|
||||
bool ignoreable = false,
|
||||
Visitor* v = NULL );
|
||||
|
||||
@ -103,19 +102,19 @@ class UnlabeledMultiArg : public MultiArg<T>
|
||||
* \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<string>& args);
|
||||
virtual bool processArg(int* i, std::vector<std::string>& 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<T>
|
||||
* Pushes this to back of list rather than front.
|
||||
* \param argList - The list this should be added to.
|
||||
*/
|
||||
virtual void addToList( list<Arg*>& argList ) const;
|
||||
virtual void addToList( std::list<Arg*>& argList ) const;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
UnlabeledMultiArg<T>::UnlabeledMultiArg(const string& name,
|
||||
const string& desc,
|
||||
const string& typeDesc,
|
||||
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
|
||||
const std::string& desc,
|
||||
const std::string& typeDesc,
|
||||
bool ignoreable,
|
||||
Visitor* v)
|
||||
: MultiArg<T>("", name, desc, false, typeDesc, v)
|
||||
@ -142,9 +141,9 @@ UnlabeledMultiArg<T>::UnlabeledMultiArg(const string& name,
|
||||
};
|
||||
|
||||
template<class T>
|
||||
UnlabeledMultiArg<T>::UnlabeledMultiArg(const string& name,
|
||||
const string& desc,
|
||||
const vector<T>& allowed,
|
||||
UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
|
||||
const std::string& desc,
|
||||
const std::vector<T>& allowed,
|
||||
bool ignoreable,
|
||||
Visitor* v)
|
||||
: MultiArg<T>("", name, desc, false, allowed, v)
|
||||
@ -153,7 +152,7 @@ UnlabeledMultiArg<T>::UnlabeledMultiArg(const string& name,
|
||||
};
|
||||
|
||||
template<class T>
|
||||
bool UnlabeledMultiArg<T>::processArg(int *i, vector<string>& args)
|
||||
bool UnlabeledMultiArg<T>::processArg(int *i, std::vector<std::string>& args)
|
||||
{
|
||||
|
||||
if ( _hasBlanks( args[*i] ) )
|
||||
@ -166,17 +165,17 @@ bool UnlabeledMultiArg<T>::processArg(int *i, vector<string>& args)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
string UnlabeledMultiArg<T>::shortID(const string& val) const
|
||||
std::string UnlabeledMultiArg<T>::shortID(const std::string& val) const
|
||||
{
|
||||
string id = "<" + _typeDesc + "> ...";
|
||||
std::string id = "<" + _typeDesc + "> ...";
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
string UnlabeledMultiArg<T>::longID(const string& val) const
|
||||
std::string UnlabeledMultiArg<T>::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<T>::operator==(const Arg& a) const
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void UnlabeledMultiArg<T>::addToList( list<Arg*>& argList ) const
|
||||
void UnlabeledMultiArg<T>::addToList( std::list<Arg*>& argList ) const
|
||||
{
|
||||
argList.push_back( (Arg*)this );
|
||||
}
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include <tclap/Arg.h>
|
||||
#include <tclap/ValueArg.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
/**
|
||||
@ -81,10 +79,10 @@ class UnlabeledValueArg : public ValueArg<T>
|
||||
* \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<T>
|
||||
* \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<T>& allowed,
|
||||
const std::vector<T>& allowed,
|
||||
bool ignoreable = false,
|
||||
Visitor* v = NULL);
|
||||
|
||||
@ -124,17 +122,17 @@ class UnlabeledValueArg : public ValueArg<T>
|
||||
* \param i - Pointer the the current argument in the list.
|
||||
* \param args - Mutable list of strings.
|
||||
*/
|
||||
virtual bool processArg(int* i, vector<string>& args);
|
||||
virtual bool processArg(int* i, std::vector<std::string>& 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<T>
|
||||
* Instead of pushing to the front of list, push to the back.
|
||||
* \param argList - The list to add this to.
|
||||
*/
|
||||
virtual void addToList( list<Arg*>& argList ) const;
|
||||
virtual void addToList( std::list<Arg*>& argList ) const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor implemenation.
|
||||
*/
|
||||
template<class T>
|
||||
UnlabeledValueArg<T>::UnlabeledValueArg(const string& name,
|
||||
const string& desc,
|
||||
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
|
||||
const std::string& desc,
|
||||
T val,
|
||||
const string& typeDesc,
|
||||
const std::string& typeDesc,
|
||||
bool ignoreable,
|
||||
Visitor* v)
|
||||
: ValueArg<T>("", name, desc, true, val, typeDesc, v)
|
||||
@ -167,10 +165,10 @@ UnlabeledValueArg<T>::UnlabeledValueArg(const string& name,
|
||||
* Constructor implemenation.
|
||||
*/
|
||||
template<class T>
|
||||
UnlabeledValueArg<T>::UnlabeledValueArg(const string& name,
|
||||
const string& desc,
|
||||
UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
|
||||
const std::string& desc,
|
||||
T val,
|
||||
const vector<T>& allowed,
|
||||
const std::vector<T>& allowed,
|
||||
bool ignoreable,
|
||||
Visitor* v)
|
||||
: ValueArg<T>("", name, desc, true, val, allowed, v)
|
||||
@ -182,7 +180,7 @@ UnlabeledValueArg<T>::UnlabeledValueArg(const string& name,
|
||||
* Implementation of processArg().
|
||||
*/
|
||||
template<class T>
|
||||
bool UnlabeledValueArg<T>::processArg(int *i, vector<string>& args)
|
||||
bool UnlabeledValueArg<T>::processArg(int *i, std::vector<std::string>& args)
|
||||
{
|
||||
|
||||
if ( _alreadySet )
|
||||
@ -202,9 +200,9 @@ bool UnlabeledValueArg<T>::processArg(int *i, vector<string>& args)
|
||||
* Overriding shortID for specific output.
|
||||
*/
|
||||
template<class T>
|
||||
string UnlabeledValueArg<T>::shortID(const string& val) const
|
||||
std::string UnlabeledValueArg<T>::shortID(const std::string& val) const
|
||||
{
|
||||
string id = "<" + _typeDesc + ">";
|
||||
std::string id = "<" + _typeDesc + ">";
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -213,12 +211,12 @@ string UnlabeledValueArg<T>::shortID(const string& val) const
|
||||
* Overriding longID for specific output.
|
||||
*/
|
||||
template<class T>
|
||||
string UnlabeledValueArg<T>::longID(const string& val) const
|
||||
std::string UnlabeledValueArg<T>::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<T>::operator==(const Arg& a ) const
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void UnlabeledValueArg<T>::addToList( list<Arg*>& argList ) const
|
||||
void UnlabeledValueArg<T>::addToList( std::list<Arg*>& argList ) const
|
||||
{
|
||||
argList.push_back( (Arg*)this );
|
||||
}
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include <tclap/Visitor.h>
|
||||
#include <tclap/Arg.h>
|
||||
|
||||
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<T> _allowed;
|
||||
std::vector<T> _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<T>& allowed,
|
||||
const std::vector<T>& 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<string>& args);
|
||||
virtual bool processArg(int* i, std::vector<std::string>& 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<class T>
|
||||
ValueArg<T>::ValueArg(const string& flag,
|
||||
const string& name,
|
||||
const string& desc,
|
||||
ValueArg<T>::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<T>::ValueArg(const string& flag,
|
||||
* Constructor with allowed list.
|
||||
*/
|
||||
template<class T>
|
||||
ValueArg<T>::ValueArg(const string& flag,
|
||||
const string& name,
|
||||
const string& desc,
|
||||
ValueArg<T>::ValueArg(const std::string& flag,
|
||||
const std::string& name,
|
||||
const std::string& desc,
|
||||
bool req,
|
||||
T val,
|
||||
const vector<T>& allowed,
|
||||
const std::vector<T>& allowed,
|
||||
Visitor* v)
|
||||
: Arg(flag, name, desc, req, true, v),
|
||||
_value( val ),
|
||||
@ -215,10 +213,10 @@ ValueArg<T>::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<T>::getValue() { return _value; };
|
||||
* Implementation of processArg().
|
||||
*/
|
||||
template<class T>
|
||||
bool ValueArg<T>::processArg(int *i, vector<string>& args)
|
||||
bool ValueArg<T>::processArg(int *i, std::vector<std::string>& args)
|
||||
{
|
||||
if ( _ignoreable && Arg::ignoreRest() )
|
||||
return false;
|
||||
@ -251,9 +249,9 @@ bool ValueArg<T>::processArg(int *i, vector<string>& 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<T>::processArg(int *i, vector<string>& args)
|
||||
* Implementation of _extractValue.
|
||||
*/
|
||||
template<class T>
|
||||
void ValueArg<T>::_extractValue( const string& val )
|
||||
void ValueArg<T>::_extractValue( const std::string& val )
|
||||
{
|
||||
istringstream is(val);
|
||||
std::istringstream is(val);
|
||||
|
||||
int valuesRead = 0;
|
||||
while ( is.good() )
|
||||
@ -320,7 +318,7 @@ void ValueArg<T>::_extractValue( const string& val )
|
||||
* read 'X'... and thus the specialization.
|
||||
*/
|
||||
template<>
|
||||
void ValueArg<string>::_extractValue( const string& val )
|
||||
void ValueArg<std::string>::_extractValue( const std::string& val )
|
||||
{
|
||||
_value = val;
|
||||
_checkAllowed( val );
|
||||
@ -330,7 +328,7 @@ void ValueArg<string>::_extractValue( const string& val )
|
||||
* Checks to see if the value parsed is in the allowed list.
|
||||
*/
|
||||
template<class T>
|
||||
void ValueArg<T>::_checkAllowed( const string& val )
|
||||
void ValueArg<T>::_checkAllowed( const std::string& val )
|
||||
{
|
||||
if ( _allowed.size() > 0 )
|
||||
if ( find(_allowed.begin(),_allowed.end(),_value) == _allowed.end() )
|
||||
@ -342,7 +340,7 @@ void ValueArg<T>::_checkAllowed( const string& val )
|
||||
* Implementation of shortID.
|
||||
*/
|
||||
template<class T>
|
||||
string ValueArg<T>::shortID(const string& val) const
|
||||
std::string ValueArg<T>::shortID(const std::string& val) const
|
||||
{
|
||||
return Arg::shortID( _typeDesc );
|
||||
}
|
||||
@ -351,7 +349,7 @@ string ValueArg<T>::shortID(const string& val) const
|
||||
* Implementation of longID.
|
||||
*/
|
||||
template<class T>
|
||||
string ValueArg<T>::longID(const string& val) const
|
||||
std::string ValueArg<T>::longID(const std::string& val) const
|
||||
{
|
||||
return Arg::longID( _typeDesc );
|
||||
}
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include <algorithm>
|
||||
#include <ostream>
|
||||
|
||||
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<Arg*> > _orList;
|
||||
std::vector< std::vector<Arg*> > _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<Arg*>& ors );
|
||||
void add( std::vector<Arg*>& 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
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include <tclap/Arg.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
// defaults
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include <tclap/CommandLine.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
CmdLine::CmdLine(const string& n, const string& m, const string& v )
|
||||
|
@ -22,8 +22,9 @@
|
||||
|
||||
#include <tclap/PrintSensibly.h>
|
||||
|
||||
namespace TCLAP {
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
void spacePrint( ostream& os,
|
||||
const string& s,
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include <tclap/SwitchArg.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
SwitchArg::SwitchArg(const string& flag,
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include <tclap/XorHandler.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
XorHandler::XorHandler( )
|
||||
|
Loading…
x
Reference in New Issue
Block a user