/usr/include/cppunit/tools/StringHelper.h is in libcppunit-dev 1.14.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #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
|