Formatted and fixed TCLAP headers

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 2 years ago
parent 430373ae38
commit 509cd0aa50
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -23,3 +23,34 @@ tde_setup_largefiles( )
if( WITH_GCC_VISIBILITY ) if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( ) tde_setup_gcc_visibility( )
endif( WITH_GCC_VISIBILITY ) endif( WITH_GCC_VISIBILITY )
##### check for stream support
check_cxx_source_compiles(
"
#include <sstream>
int main()
{
std::istringstream sstream;
return 0;
}
"
HAVE_SSTREAM
)
check_cxx_source_compiles(
"
#include <strstream>
int main()
{
std::istrstream strstream;
return 0;
}
"
HAVE_STRSTREAM
)
if( NOT HAVE_SSTREAM AND NOT HAVE_STRSTREAM )
message(FATAL_ERROR "\nsstream or strstream support is required, but not found on your system." )
endif( )

@ -6,3 +6,9 @@
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */ significant byte first (like Motorola and SPARC, unlike Intel). */
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ #cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
// sstream support
#cmakedefine HAVE_SSTREAM
// strstream support
#cmakedefine HAVE_STRSTREAM

@ -7,10 +7,10 @@
################################################# #################################################
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src
${CMAKE_SOURCE_DIR}/src
) )
link_directories( link_directories(
@ -31,5 +31,6 @@ set( ${target}_SRCS
tde_add_executable( ${target} AUTOMOC tde_add_executable( ${target} AUTOMOC
SOURCES ${${target}_SRCS} SOURCES ${${target}_SRCS}
LINK ${TQT_LIBRARIES}
DESTINATION ${BIN_INSTALL_DIR} DESTINATION ${BIN_INSTALL_DIR}
) )

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: Arg.h * file: Arg.h
@ -49,10 +47,10 @@ typedef std::istrstream istringstream;
#endif #endif
#include <tclap/ArgException.h> #include <tclap/ArgException.h>
#include <tclap/Visitor.h>
#include <tclap/CmdLineInterface.h>
#include <tclap/ArgTraits.h> #include <tclap/ArgTraits.h>
#include <tclap/CmdLineInterface.h>
#include <tclap/StandardTraits.h> #include <tclap/StandardTraits.h>
#include <tclap/Visitor.h>
namespace TCLAP namespace TCLAP
{ {
@ -425,21 +423,18 @@ namespace TCLAP
void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl) void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl)
{ {
static_cast<void>(vl); // Avoid warning about unused vl static_cast<void>(vl); // Avoid warning about unused vl
std::istringstream is(strVal); istringstream is(strVal);
int valuesRead = 0; int valuesRead = 0;
while (is.good()) while (is.good())
{ {
if (is.peek() != EOF) if (is.peek() != EOF)
#ifdef TCLAP_SETBASE_ZERO
{
is >> std::setbase(0) >> destVal;
}
#else
{ {
#ifdef TCLAP_SETBASE_ZERO
is >> std::setbase(0);
#endif
is >> destVal; is >> destVal;
} }
#endif
else else
{ {
break; break;
@ -474,10 +469,6 @@ namespace TCLAP
SetString(destVal, strVal); SetString(destVal, strVal);
} }
//////////////////////////////////////////////////////////////////////
//BEGIN Arg.cpp
//////////////////////////////////////////////////////////////////////
inline Arg::Arg(const std::string &flag, const std::string &name, const std::string &desc, inline Arg::Arg(const std::string &flag, const std::string &name, const std::string &desc,
bool req, bool valreq, Visitor *v) : bool req, bool valreq, Visitor *v) :
_flag(flag), _name(name), _description(desc), _required(req), _requireLabel("required"), _flag(flag), _name(name), _description(desc), _required(req), _requireLabel("required"),
@ -490,10 +481,8 @@ namespace TCLAP
"Argument flag can only be one character long", toString())); "Argument flag can only be one character long", toString()));
} }
if (_name != ignoreNameString() && if (_name != ignoreNameString() && (_flag == Arg::flagStartString() ||
(_flag == Arg::flagStartString() || _flag == Arg::nameStartString() || _flag == " "))
_flag == Arg::nameStartString() ||
_flag == " "))
{ {
throw (SpecificationException("Argument flag cannot be either '" + Arg::flagStartString() + throw (SpecificationException("Argument flag cannot be either '" + Arg::flagStartString() +
"' or '" + Arg::nameStartString() + "' or a space.", toString())); "' or '" + Arg::nameStartString() + "' or a space.", toString()));
@ -584,9 +573,6 @@ namespace TCLAP
desc = "(" + _requireLabel + ") "; desc = "(" + _requireLabel + ") ";
} }
// if ( _valueRequired )
// desc += "(value required) ";
desc += _description; desc += _description;
return desc; return desc;
} }
@ -740,10 +726,6 @@ namespace TCLAP
_xorSet = false; _xorSet = false;
_alreadySet = false; _alreadySet = false;
} }
}
//////////////////////////////////////////////////////////////////////
//END Arg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif #endif

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: ArgException.h * file: ArgException.h
@ -131,10 +129,8 @@ namespace TCLAP
* of the exception. * of the exception.
*/ */
ArgParseException(const std::string &text = "undefined exception", ArgParseException(const std::string &text = "undefined exception",
const std::string &id = "undefined") : const std::string &id = "undefined") :
ArgException(text, ArgException(text, id, std::string("Exception found while parsing ") +
id,
std::string("Exception found while parsing ") +
std::string("the value the Arg has been passed.")) std::string("the value the Arg has been passed."))
{ {
} }
@ -154,10 +150,8 @@ namespace TCLAP
* of the exception. * of the exception.
*/ */
CmdLineParseException(const std::string &text = "undefined exception", CmdLineParseException(const std::string &text = "undefined exception",
const std::string &id = "undefined") : const std::string &id = "undefined") :
ArgException(text, ArgException(text, id, std::string("Exception found when the values ") +
id,
std::string("Exception found when the values ") +
std::string("on the command line do not meet ") + std::string("on the command line do not meet ") +
std::string("the requirements of the defined ") + std::string("Args.")) std::string("the requirements of the defined ") + std::string("Args."))
{ {
@ -178,10 +172,8 @@ namespace TCLAP
* of the exception. * of the exception.
*/ */
SpecificationException(const std::string &text = "undefined exception", SpecificationException(const std::string &text = "undefined exception",
const std::string &id = "undefined") : const std::string &id = "undefined") :
ArgException(text, ArgException(text, id, std::string("Exception found when an Arg object ") +
id,
std::string("Exception found when an Arg object ") +
std::string("is improperly defined by the ") + std::string("developer.")) std::string("is improperly defined by the ") + std::string("developer."))
{ {
} }
@ -203,6 +195,6 @@ namespace TCLAP
private: private:
int _estat; int _estat;
}; };
} // namespace TCLAP }
#endif #endif

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: ArgTraits.h * file: ArgTraits.h
@ -20,12 +18,12 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef TCLAP_ARGTRAITS_H
#define TCLAP_ARGTRAITS_H
// This is an internal tclap file, you should probably not have to // This is an internal tclap file, you should probably not have to
// include this directly // include this directly
#ifndef TCLAP_ARGTRAITS_H
#define TCLAP_ARGTRAITS_H
namespace TCLAP namespace TCLAP
{ {
// We use two empty structs to get compile type specialization // We use two empty structs to get compile type specialization
@ -46,7 +44,8 @@ namespace TCLAP
* will be broken up into individual tokens by operator>>. * will be broken up into individual tokens by operator>>.
*/ */
struct StringLike struct StringLike
{}; {
};
/** /**
* A class can inherit from this object to make it have string like * A class can inherit from this object to make it have string like
@ -78,8 +77,7 @@ namespace TCLAP
struct ArgTraits struct ArgTraits
{ {
typedef typename T::ValueCategory ValueCategory; typedef typename T::ValueCategory ValueCategory;
//typedef ValueLike ValueCategory;
}; };
}
#endif #endif
} // namespace

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: CmdLine.h * file: CmdLine.h
@ -46,7 +44,7 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <algorithm> #include <algorithm>
#include <stdlib.h> // Needed for exit(), which isn't defined in some envs. #include <cstdlib> // Needed for exit(), which isn't defined in some envs.
namespace TCLAP namespace TCLAP
{ {
@ -229,7 +227,7 @@ namespace TCLAP
* \param argc - Number of arguments. * \param argc - Number of arguments.
* \param argv - Array of arguments. * \param argv - Array of arguments.
*/ */
void parse(int argc, const char*const *argv); void parse(int argc, const char* const *argv);
/** /**
* Parses the command line. * Parses the command line.
@ -304,11 +302,6 @@ namespace TCLAP
void reset(); void reset();
}; };
///////////////////////////////////////////////////////////////////////////////
//Begin CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
inline CmdLine::CmdLine(const std::string &m, char delim, const std::string &v, bool help) : inline CmdLine::CmdLine(const std::string &m, char delim, const std::string &v, bool help) :
_progName("not_set_yet"), _message(m), _version(v), _numRequired(0), _delimiter(delim), _progName("not_set_yet"), _message(m), _version(v), _numRequired(0), _delimiter(delim),
_handleExceptions(true), _userSetOutput(false), _helpAndVersion(help) _handleExceptions(true), _userSetOutput(false), _helpAndVersion(help)
@ -354,9 +347,8 @@ namespace TCLAP
} }
v = new IgnoreRestVisitor(); v = new IgnoreRestVisitor();
SwitchArg *ignore = new SwitchArg(Arg::flagStartString(), SwitchArg *ignore = new SwitchArg(Arg::flagStartString(), Arg::ignoreNameString(),
Arg::ignoreNameString(), "Ignores the rest of the labeled arguments following this flag.", false, "Ignores the rest of the labeled arguments following this flag.", false, v);
v);
add(ignore); add(ignore);
deleteOnExit(ignore); deleteOnExit(ignore);
deleteOnExit(v); deleteOnExit(v);
@ -394,8 +386,7 @@ namespace TCLAP
{ {
if (*a == *(*it)) if (*a == *(*it))
{ {
throw (SpecificationException( throw (SpecificationException("Argument with same flag/name already exists!", a->longID()));
"Argument with same flag/name already exists!", a->longID()));
} }
} }
@ -407,7 +398,7 @@ namespace TCLAP
} }
} }
inline void CmdLine::parse(int argc, const char*const *argv) inline void CmdLine::parse(int argc, const char* const *argv)
{ {
// this step is necessary so that we have easy access to // this step is necessary so that we have easy access to
// mutable strings. // mutable strings.
@ -435,8 +426,7 @@ namespace TCLAP
for (int i = 0; static_cast<unsigned int>(i) < args.size(); i++) for (int i = 0; static_cast<unsigned int>(i) < args.size(); i++)
{ {
bool matched = false; bool matched = false;
for (ArgListIterator it = _argList.begin(); for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++)
it != _argList.end(); it++)
{ {
if ((*it)->processArg(&i, args)) if ((*it)->processArg(&i, args))
{ {
@ -455,8 +445,7 @@ namespace TCLAP
if (!matched && !Arg::ignoreRest()) if (!matched && !Arg::ignoreRest())
{ {
throw (CmdLineParseException("Couldn't find match " throw (CmdLineParseException("Couldn't find match for argument", args[i]));
"for argument", args[i]));
} }
} }
@ -630,10 +619,6 @@ namespace TCLAP
_progName.clear(); _progName.clear();
} }
}
///////////////////////////////////////////////////////////////////////////////
//End CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif #endif

@ -82,7 +82,7 @@ namespace TCLAP
* \param argc - Number of arguments. * \param argc - Number of arguments.
* \param argv - Array of arguments. * \param argv - Array of arguments.
*/ */
virtual void parse(int argc, const char*const *argv) = 0; virtual void parse(int argc, const char* const *argv) = 0;
/** /**
* Parses the command line. * Parses the command line.
@ -143,7 +143,6 @@ namespace TCLAP
*/ */
virtual void reset() = 0; virtual void reset() = 0;
}; };
} //namespace }
#endif #endif

@ -65,6 +65,6 @@ namespace TCLAP
*/ */
virtual void failure(CmdLineInterface &c, ArgException &e) = 0; virtual void failure(CmdLineInterface &c, ArgException &e) = 0;
}; };
} //namespace TCLAP }
#endif #endif

@ -63,6 +63,6 @@ namespace TCLAP
{ {
} }
}; };
} //namespace TCLAP }
#endif #endif

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: DocBookOutput.h * file: DocBookOutput.h
@ -300,6 +298,6 @@ namespace TCLAP
std::cout << "</varlistentry>" << std::endl; std::cout << "</varlistentry>" << std::endl;
} }
} //namespace TCLAP }
#endif #endif

@ -21,6 +21,7 @@
#ifndef TCLAP_HELP_VISITOR_H #ifndef TCLAP_HELP_VISITOR_H
#define TCLAP_HELP_VISITOR_H #define TCLAP_HELP_VISITOR_H
#include <tclap/ArgException.h>
#include <tclap/CmdLineInterface.h> #include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h> #include <tclap/CmdLineOutput.h>
#include <tclap/Visitor.h> #include <tclap/Visitor.h>

@ -1,28 +0,0 @@
libtclapincludedir = $(includedir)/tclap
libtclapinclude_HEADERS = \
CmdLineInterface.h \
ArgException.h \
CmdLine.h \
XorHandler.h \
MultiArg.h \
UnlabeledMultiArg.h \
ValueArg.h \
UnlabeledValueArg.h \
Visitor.h Arg.h \
HelpVisitor.h \
SwitchArg.h \
MultiSwitchArg.h \
VersionVisitor.h \
IgnoreRestVisitor.h \
CmdLineOutput.h \
StdOutput.h \
DocBookOutput.h \
ZshCompletionOutput.h \
OptionalUnlabeledTracker.h \
Constraint.h \
ValuesConstraint.h \
ArgTraits.h \
StandardTraits.h

@ -219,8 +219,7 @@ namespace TCLAP
template<class T> template<class T>
MultiArg<T>::MultiArg(const std::string &flag, const std::string &name, const std::string &desc, MultiArg<T>::MultiArg(const std::string &flag, const std::string &name, const std::string &desc,
bool req, const std::string &typeDesc, CmdLineInterface &parser, bool req, const std::string &typeDesc, CmdLineInterface &parser, Visitor *v) :
Visitor *v) :
Arg(flag, name, desc, req, true, v), _typeDesc(typeDesc), _constraint(NULL), _allowMore(false) Arg(flag, name, desc, req, true, v), _typeDesc(typeDesc), _constraint(NULL), _allowMore(false)
{ {
parser.add(this); parser.add(this);
@ -277,8 +276,7 @@ namespace TCLAP
{ {
if (Arg::delimiter() != ' ' && value == "") if (Arg::delimiter() != ' ' && value == "")
{ {
throw (ArgParseException( throw (ArgParseException("Couldn't find delimiter for this argument!", toString()));
"Couldn't find delimiter for this argument!", toString()));
} }
// always take the first one, regardless of start string // always take the first one, regardless of start string
@ -400,6 +398,6 @@ namespace TCLAP
Arg::reset(); Arg::reset();
_values.clear(); _values.clear();
} }
} // namespace TCLAP }
#endif #endif

@ -113,9 +113,6 @@ namespace TCLAP
void reset(); void reset();
}; };
//////////////////////////////////////////////////////////////////////
//BEGIN MultiSwitchArg.cpp
//////////////////////////////////////////////////////////////////////
inline MultiSwitchArg::MultiSwitchArg(const std::string &flag, const std::string &name, inline MultiSwitchArg::MultiSwitchArg(const std::string &flag, const std::string &name,
const std::string &desc, int init, Visitor *v) : const std::string &desc, int init, Visitor *v) :
SwitchArg(flag, name, desc, false, v), _value(init), _default(init) SwitchArg(flag, name, desc, false, v), _value(init), _default(init)
@ -192,10 +189,6 @@ namespace TCLAP
{ {
MultiSwitchArg::_value = MultiSwitchArg::_default; MultiSwitchArg::_value = MultiSwitchArg::_default;
} }
}
//////////////////////////////////////////////////////////////////////
//END MultiSwitchArg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif #endif

@ -22,6 +22,8 @@
#ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
#define TCLAP_OPTIONAL_UNLABELED_TRACKER_H #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
#include <tclap/ArgException.h>
#include <string> #include <string>
namespace TCLAP namespace TCLAP
@ -63,6 +65,6 @@ namespace TCLAP
OptionalUnlabeledTracker::gotOptional(); OptionalUnlabeledTracker::gotOptional();
} }
} }
} // namespace TCLAP }
#endif #endif

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: StandardTraits.h * file: StandardTraits.h
@ -20,16 +18,20 @@
* *
*****************************************************************************/ *****************************************************************************/
// This is an internal tclap file, you should probably not have to
// include this directly
#ifndef TCLAP_STANDARD_TRAITS_H #ifndef TCLAP_STANDARD_TRAITS_H
#define TCLAP_STANDARD_TRAITS_H #define TCLAP_STANDARD_TRAITS_H
// This is an internal tclap file, you should probably not have to
// include this directly
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> // To check for long long #include <config.h> // To check for long long
#endif #endif
#include <tclap/ArgTraits.h>
#include <string>
namespace TCLAP namespace TCLAP
{ {
// ====================================================================== // ======================================================================
@ -195,6 +197,6 @@ namespace TCLAP
{ {
dst = src; dst = src;
} }
} // namespace }
#endif #endif

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: StdOutput.h * file: StdOutput.h
@ -303,6 +301,6 @@ namespace TCLAP
os << s << std::endl; os << s << std::endl;
} }
} }
} //namespace TCLAP }
#endif #endif

@ -107,9 +107,6 @@ namespace TCLAP
virtual void reset(); virtual void reset();
}; };
//////////////////////////////////////////////////////////////////////
//BEGIN SwitchArg.cpp
//////////////////////////////////////////////////////////////////////
inline SwitchArg::SwitchArg(const std::string &flag, const std::string &name, inline SwitchArg::SwitchArg(const std::string &flag, const std::string &name,
const std::string &desc, bool default_val, Visitor *v) : const std::string &desc, bool default_val, Visitor *v) :
Arg(flag, name, desc, false, false, v), _value(default_val), _default(default_val) Arg(flag, name, desc, false, false, v), _value(default_val), _default(default_val)
@ -220,10 +217,6 @@ namespace TCLAP
Arg::reset(); Arg::reset();
_value = _default; _value = _default;
} }
}
//////////////////////////////////////////////////////////////////////
//End SwitchArg.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif #endif

@ -371,6 +371,6 @@ namespace TCLAP
Arg::reset(); Arg::reset();
_value = _default; _value = _default;
} }
} // namespace TCLAP }
#endif #endif

@ -142,6 +142,6 @@ namespace TCLAP
{ {
return _typeDesc; return _typeDesc;
} }
} //namespace TCLAP }
#endif #endif

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: VersionVisitor.h * file: VersionVisitor.h
@ -24,6 +22,7 @@
#ifndef TCLAP_VERSION_VISITOR_H #ifndef TCLAP_VERSION_VISITOR_H
#define TCLAP_VERSION_VISITOR_H #define TCLAP_VERSION_VISITOR_H
#include <tclap/ArgException.h>
#include <tclap/CmdLineInterface.h> #include <tclap/CmdLineInterface.h>
#include <tclap/CmdLineOutput.h> #include <tclap/CmdLineOutput.h>
#include <tclap/Visitor.h> #include <tclap/Visitor.h>

@ -87,9 +87,6 @@ namespace TCLAP
std::vector<std::vector<Arg*>>& getXorList(); std::vector<std::vector<Arg*>>& getXorList();
}; };
//////////////////////////////////////////////////////////////////////
//BEGIN XOR.cpp
//////////////////////////////////////////////////////////////////////
inline void XorHandler::add(std::vector<Arg*> &ors) inline void XorHandler::add(std::vector<Arg*> &ors)
{ {
_orList.push_back(ors); _orList.push_back(ors);
@ -159,10 +156,6 @@ namespace TCLAP
{ {
return _orList; return _orList;
} }
}
//////////////////////////////////////////////////////////////////////
//END XOR.cpp
//////////////////////////////////////////////////////////////////////
} //namespace TCLAP
#endif #endif

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/****************************************************************************** /******************************************************************************
* *
* file: ZshCompletionOutput.h * file: ZshCompletionOutput.h
@ -79,7 +77,7 @@ namespace TCLAP
char theDelimiter; char theDelimiter;
}; };
ZshCompletionOutput::ZshCompletionOutput() inline ZshCompletionOutput::ZshCompletionOutput()
{ {
common["host"] = "_hosts"; common["host"] = "_hosts";
common["hostname"] = "_hosts"; common["hostname"] = "_hosts";
@ -337,6 +335,6 @@ namespace TCLAP
return list.str(); return list.str();
} }
} //namespace TCLAP }
#endif #endif

Loading…
Cancel
Save