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 )
tde_setup_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
significant byte first (like Motorola and SPARC, unlike Intel). */
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
// sstream support
#cmakedefine HAVE_SSTREAM
// strstream support
#cmakedefine HAVE_STRSTREAM

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

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

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

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* 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
// include this directly
#ifndef TCLAP_ARGTRAITS_H
#define TCLAP_ARGTRAITS_H
namespace TCLAP
{
// 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>>.
*/
struct StringLike
{};
{
};
/**
* A class can inherit from this object to make it have string like
@ -78,8 +77,7 @@ namespace TCLAP
struct ArgTraits
{
typedef typename T::ValueCategory ValueCategory;
//typedef ValueLike ValueCategory;
};
}
#endif
} // namespace

@ -1,5 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
* file: CmdLine.h
@ -46,7 +44,7 @@
#include <iostream>
#include <iomanip>
#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
{
@ -229,7 +227,7 @@ namespace TCLAP
* \param argc - Number 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.
@ -304,11 +302,6 @@ namespace TCLAP
void reset();
};
///////////////////////////////////////////////////////////////////////////////
//Begin CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
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),
_handleExceptions(true), _userSetOutput(false), _helpAndVersion(help)
@ -354,9 +347,8 @@ namespace TCLAP
}
v = new IgnoreRestVisitor();
SwitchArg *ignore = new SwitchArg(Arg::flagStartString(),
Arg::ignoreNameString(), "Ignores the rest of the labeled arguments following this flag.", false,
v);
SwitchArg *ignore = new SwitchArg(Arg::flagStartString(), Arg::ignoreNameString(),
"Ignores the rest of the labeled arguments following this flag.", false, v);
add(ignore);
deleteOnExit(ignore);
deleteOnExit(v);
@ -394,8 +386,7 @@ namespace TCLAP
{
if (*a == *(*it))
{
throw (SpecificationException(
"Argument with same flag/name already exists!", a->longID()));
throw (SpecificationException("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
// mutable strings.
@ -435,8 +426,7 @@ namespace TCLAP
for (int i = 0; static_cast<unsigned int>(i) < args.size(); i++)
{
bool matched = false;
for (ArgListIterator it = _argList.begin();
it != _argList.end(); it++)
for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++)
{
if ((*it)->processArg(&i, args))
{
@ -455,8 +445,7 @@ namespace TCLAP
if (!matched && !Arg::ignoreRest())
{
throw (CmdLineParseException("Couldn't find match "
"for argument", args[i]));
throw (CmdLineParseException("Couldn't find match for argument", args[i]));
}
}
@ -630,10 +619,6 @@ namespace TCLAP
_progName.clear();
}
///////////////////////////////////////////////////////////////////////////////
//End CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
} //namespace TCLAP
}
#endif

@ -82,7 +82,7 @@ namespace TCLAP
* \param argc - Number 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.
@ -143,7 +143,6 @@ namespace TCLAP
*/
virtual void reset() = 0;
};
} //namespace
}
#endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save