diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 031be3c..0f733c0 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -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 + int main() + { + std::istringstream sstream; + return 0; + } + " + HAVE_SSTREAM +) + +check_cxx_source_compiles( + " + #include + 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( ) diff --git a/config.h.cmake b/config.h.cmake index 61ede3a..33d4bd8 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -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 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f338fa..8be71d9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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} ) diff --git a/src/tclap/Arg.h b/src/tclap/Arg.h index a65822b..cd98886 100644 --- a/src/tclap/Arg.h +++ b/src/tclap/Arg.h @@ -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 -#include -#include #include +#include #include +#include namespace TCLAP { @@ -425,21 +423,18 @@ namespace TCLAP void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl) { static_cast(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 diff --git a/src/tclap/ArgException.h b/src/tclap/ArgException.h index be0b817..ea08bd6 100644 --- a/src/tclap/ArgException.h +++ b/src/tclap/ArgException.h @@ -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 diff --git a/src/tclap/ArgTraits.h b/src/tclap/ArgTraits.h index 7a4a892..297f166 100644 --- a/src/tclap/ArgTraits.h +++ b/src/tclap/ArgTraits.h @@ -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 diff --git a/src/tclap/CmdLine.h b/src/tclap/CmdLine.h index 7bc9835..02c6efe 100644 --- a/src/tclap/CmdLine.h +++ b/src/tclap/CmdLine.h @@ -1,5 +1,3 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - /****************************************************************************** * * file: CmdLine.h @@ -46,7 +44,7 @@ #include #include #include -#include // Needed for exit(), which isn't defined in some envs. +#include // 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(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 diff --git a/src/tclap/CmdLineInterface.h b/src/tclap/CmdLineInterface.h index 369ade8..fd6f454 100644 --- a/src/tclap/CmdLineInterface.h +++ b/src/tclap/CmdLineInterface.h @@ -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 diff --git a/src/tclap/CmdLineOutput.h b/src/tclap/CmdLineOutput.h index 909bf25..3b269c1 100644 --- a/src/tclap/CmdLineOutput.h +++ b/src/tclap/CmdLineOutput.h @@ -65,6 +65,6 @@ namespace TCLAP */ virtual void failure(CmdLineInterface &c, ArgException &e) = 0; }; -} //namespace TCLAP +} #endif diff --git a/src/tclap/Constraint.h b/src/tclap/Constraint.h index e99418b..7148430 100644 --- a/src/tclap/Constraint.h +++ b/src/tclap/Constraint.h @@ -63,6 +63,6 @@ namespace TCLAP { } }; -} //namespace TCLAP +} #endif diff --git a/src/tclap/DocBookOutput.h b/src/tclap/DocBookOutput.h index f4ff822..8416e53 100644 --- a/src/tclap/DocBookOutput.h +++ b/src/tclap/DocBookOutput.h @@ -1,5 +1,3 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - /****************************************************************************** * * file: DocBookOutput.h @@ -300,6 +298,6 @@ namespace TCLAP std::cout << "" << std::endl; } -} //namespace TCLAP +} #endif diff --git a/src/tclap/HelpVisitor.h b/src/tclap/HelpVisitor.h index 1afc148..286337e 100644 --- a/src/tclap/HelpVisitor.h +++ b/src/tclap/HelpVisitor.h @@ -21,6 +21,7 @@ #ifndef TCLAP_HELP_VISITOR_H #define TCLAP_HELP_VISITOR_H +#include #include #include #include diff --git a/src/tclap/Makefile.am b/src/tclap/Makefile.am deleted file mode 100755 index 0e247bf..0000000 --- a/src/tclap/Makefile.am +++ /dev/null @@ -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 - diff --git a/src/tclap/MultiArg.h b/src/tclap/MultiArg.h index 467edd4..31c39c0 100644 --- a/src/tclap/MultiArg.h +++ b/src/tclap/MultiArg.h @@ -219,8 +219,7 @@ namespace TCLAP template MultiArg::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 diff --git a/src/tclap/MultiSwitchArg.h b/src/tclap/MultiSwitchArg.h index 33cd144..5736cc5 100644 --- a/src/tclap/MultiSwitchArg.h +++ b/src/tclap/MultiSwitchArg.h @@ -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 diff --git a/src/tclap/OptionalUnlabeledTracker.h b/src/tclap/OptionalUnlabeledTracker.h index 1ac8220..8ebdf6f 100644 --- a/src/tclap/OptionalUnlabeledTracker.h +++ b/src/tclap/OptionalUnlabeledTracker.h @@ -22,6 +22,8 @@ #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H +#include + #include namespace TCLAP @@ -63,6 +65,6 @@ namespace TCLAP OptionalUnlabeledTracker::gotOptional(); } } -} // namespace TCLAP +} #endif diff --git a/src/tclap/StandardTraits.h b/src/tclap/StandardTraits.h index 4129c7e..664969d 100644 --- a/src/tclap/StandardTraits.h +++ b/src/tclap/StandardTraits.h @@ -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 // To check for long long #endif +#include + +#include + namespace TCLAP { // ====================================================================== @@ -195,6 +197,6 @@ namespace TCLAP { dst = src; } -} // namespace +} #endif diff --git a/src/tclap/StdOutput.h b/src/tclap/StdOutput.h index 98272f3..24b90ed 100644 --- a/src/tclap/StdOutput.h +++ b/src/tclap/StdOutput.h @@ -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 diff --git a/src/tclap/SwitchArg.h b/src/tclap/SwitchArg.h index 78b8c0c..874bcf6 100644 --- a/src/tclap/SwitchArg.h +++ b/src/tclap/SwitchArg.h @@ -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 diff --git a/src/tclap/ValueArg.h b/src/tclap/ValueArg.h index e80f649..f015c29 100644 --- a/src/tclap/ValueArg.h +++ b/src/tclap/ValueArg.h @@ -371,6 +371,6 @@ namespace TCLAP Arg::reset(); _value = _default; } -} // namespace TCLAP +} #endif diff --git a/src/tclap/ValuesConstraint.h b/src/tclap/ValuesConstraint.h index 882f762..24532d6 100644 --- a/src/tclap/ValuesConstraint.h +++ b/src/tclap/ValuesConstraint.h @@ -142,6 +142,6 @@ namespace TCLAP { return _typeDesc; } -} //namespace TCLAP +} #endif diff --git a/src/tclap/VersionVisitor.h b/src/tclap/VersionVisitor.h index d6c02bc..f658688 100644 --- a/src/tclap/VersionVisitor.h +++ b/src/tclap/VersionVisitor.h @@ -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 #include #include #include diff --git a/src/tclap/XorHandler.h b/src/tclap/XorHandler.h index ae3cd5c..7ac6fe3 100644 --- a/src/tclap/XorHandler.h +++ b/src/tclap/XorHandler.h @@ -87,9 +87,6 @@ namespace TCLAP std::vector>& getXorList(); }; - ////////////////////////////////////////////////////////////////////// - //BEGIN XOR.cpp - ////////////////////////////////////////////////////////////////////// inline void XorHandler::add(std::vector &ors) { _orList.push_back(ors); @@ -159,10 +156,6 @@ namespace TCLAP { return _orList; } - - ////////////////////////////////////////////////////////////////////// - //END XOR.cpp - ////////////////////////////////////////////////////////////////////// -} //namespace TCLAP +} #endif diff --git a/src/tclap/ZshCompletionOutput.h b/src/tclap/ZshCompletionOutput.h index ba28306..81508f8 100644 --- a/src/tclap/ZshCompletionOutput.h +++ b/src/tclap/ZshCompletionOutput.h @@ -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