diff options
author | Tobias Markmann <tobias.markmann@isode.com> | 2019-11-14 21:08:53 (GMT) |
---|---|---|
committer | Tobias Markmann <tobias.markmann@isode.com> | 2019-11-15 11:58:11 (GMT) |
commit | 8230b23238b4d0ef0fcde01a799758558d502fa1 (patch) | |
tree | 849251b42e457357b86a2ba91e9b78f635cc55a3 /3rdParty/CppUnit/src/include/cppunit/tools | |
parent | caca46ceedddd43c707e7eda9b4c765d61730ccb (diff) | |
download | swift-8230b23238b4d0ef0fcde01a799758558d502fa1.zip swift-8230b23238b4d0ef0fcde01a799758558d502fa1.tar.bz2 |
Update 3rdParty/CppUnit to version 1.14.0
This gets rid of std::auto_ptr usage and its deprecation
warnings.
Test-Information:
Builds and tests pass on macOS.
Change-Id: I299a0a8d9aa2ead15c933e83a2e3e53f84a4f5b7
Diffstat (limited to '3rdParty/CppUnit/src/include/cppunit/tools')
3 files changed, 50 insertions, 5 deletions
diff --git a/3rdParty/CppUnit/src/include/cppunit/tools/StringHelper.h b/3rdParty/CppUnit/src/include/cppunit/tools/StringHelper.h new file mode 100644 index 0000000..3301045 --- /dev/null +++ b/3rdParty/CppUnit/src/include/cppunit/tools/StringHelper.h @@ -0,0 +1,45 @@ +#ifndef CPPUNIT_TOOLS_STRINGHELPER_H +#define CPPUNIT_TOOLS_STRINGHELPER_H + +#include <cppunit/Portability.h> +#include <cppunit/portability/Stream.h> +#include <string> +#include <type_traits> + + +CPPUNIT_NS_BEGIN + + +/*! \brief Methods for converting values to strings. Replaces CPPUNIT_NS::StringTools::toString + */ +namespace StringHelper +{ + +// work around to handle C++11 enum class correctly. We need an own conversion to std::string +// as there is no implicit coversion to int for enum class. + +template<typename T> +typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x) +{ + OStringStream ost; + ost << x; + + return ost.str(); +} + +template<typename T> +typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x) +{ + OStringStream ost; + ost << static_cast<typename std::underlying_type<T>::type>(x); + + return ost.str(); +} + +} + + +CPPUNIT_NS_END + +#endif // CPPUNIT_TOOLS_STRINGHELPER_H + diff --git a/3rdParty/CppUnit/src/include/cppunit/tools/StringTools.h b/3rdParty/CppUnit/src/include/cppunit/tools/StringTools.h index 7a6b6d7..d08c6e0 100644 --- a/3rdParty/CppUnit/src/include/cppunit/tools/StringTools.h +++ b/3rdParty/CppUnit/src/include/cppunit/tools/StringTools.h @@ -3,7 +3,7 @@ #include <cppunit/Portability.h> #include <string> -#include <cppunit/portability/CppUnitVector.h> +#include <vector> CPPUNIT_NS_BEGIN @@ -14,7 +14,7 @@ CPPUNIT_NS_BEGIN struct StringTools { - typedef CppUnitVector<std::string> Strings; + typedef std::vector<std::string> Strings; static std::string CPPUNIT_API toString( int value ); diff --git a/3rdParty/CppUnit/src/include/cppunit/tools/XmlElement.h b/3rdParty/CppUnit/src/include/cppunit/tools/XmlElement.h index 0b36bd2..70e21f8 100644 --- a/3rdParty/CppUnit/src/include/cppunit/tools/XmlElement.h +++ b/3rdParty/CppUnit/src/include/cppunit/tools/XmlElement.h @@ -8,7 +8,7 @@ #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z #endif -#include <cppunit/portability/CppUnitDeque.h> +#include <deque> #include <string> @@ -131,10 +131,10 @@ private: std::string m_name; std::string m_content; - typedef CppUnitDeque<Attribute> Attributes; + typedef std::deque<Attribute> Attributes; Attributes m_attributes; - typedef CppUnitDeque<XmlElement *> Elements; + typedef std::deque<XmlElement *> Elements; Elements m_elements; }; |