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/StringHelper.h | |
| 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/StringHelper.h')
| -rw-r--r-- | 3rdParty/CppUnit/src/include/cppunit/tools/StringHelper.h | 45 |
1 files changed, 45 insertions, 0 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 @@ | |||
| 1 | #ifndef CPPUNIT_TOOLS_STRINGHELPER_H | ||
| 2 | #define CPPUNIT_TOOLS_STRINGHELPER_H | ||
| 3 | |||
| 4 | #include <cppunit/Portability.h> | ||
| 5 | #include <cppunit/portability/Stream.h> | ||
| 6 | #include <string> | ||
| 7 | #include <type_traits> | ||
| 8 | |||
| 9 | |||
| 10 | CPPUNIT_NS_BEGIN | ||
| 11 | |||
| 12 | |||
| 13 | /*! \brief Methods for converting values to strings. Replaces CPPUNIT_NS::StringTools::toString | ||
| 14 | */ | ||
| 15 | namespace StringHelper | ||
| 16 | { | ||
| 17 | |||
| 18 | // work around to handle C++11 enum class correctly. We need an own conversion to std::string | ||
| 19 | // as there is no implicit coversion to int for enum class. | ||
| 20 | |||
| 21 | template<typename T> | ||
| 22 | typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x) | ||
| 23 | { | ||
| 24 | OStringStream ost; | ||
| 25 | ost << x; | ||
| 26 | |||
| 27 | return ost.str(); | ||
| 28 | } | ||
| 29 | |||
| 30 | template<typename T> | ||
| 31 | typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x) | ||
| 32 | { | ||
| 33 | OStringStream ost; | ||
| 34 | ost << static_cast<typename std::underlying_type<T>::type>(x); | ||
| 35 | |||
| 36 | return ost.str(); | ||
| 37 | } | ||
| 38 | |||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | CPPUNIT_NS_END | ||
| 43 | |||
| 44 | #endif // CPPUNIT_TOOLS_STRINGHELPER_H | ||
| 45 | |||
Swift