Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::Detail Namespace Reference

Classes

class  Approx
 
struct  EnumInfo
 
class  EnumValuesRegistry
 
class  IsStreamInsertable
 

Functions

std::vector< std::string > parseEnums (StringRef enums)
 
std::unique_ptr< EnumInfomakeEnumInfo (StringRef enumName, StringRef allValueNames, std::vector< int > const &values)
 
std::string getAnnotation (Class cls, std::string const &annotationName, std::string const &testCaseName)
 
std::string rawMemoryToString (const void *object, std::size_t size)
 
template<typename T >
std::string rawMemoryToString (const T &object)
 
template<typename E >
std::string convertUnknownEnumToString (E e)
 
template<typename T >
std::enable_if<!std::is_enum< T >::value &&!std::is_base_of< std::exception, T >::value, std::string >::type convertUnstreamable (T const &)
 
template<typename T >
std::enable_if<!std::is_enum< T >::value &&std::is_base_of< std::exception, T >::value, std::string >::type convertUnstreamable (T const &ex)
 
template<typename T >
std::enable_if< std::is_enum< T >::value, std::string >::type convertUnstreamable (T const &value)
 
template<typename T >
std::string stringify (const T &e)
 
template<typename InputIterator >
std::string rangeToString (InputIterator first, InputIterator last)
 

Variables

const std::string unprintableString = "{?}"
 

Function Documentation

◆ convertUnknownEnumToString()

template<typename E >
std::string Catch::Detail::convertUnknownEnumToString ( E e)

Definition at line 133 of file catch_tostring.h.

133 {
134 return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e));
135 }
Here is the caller graph for this function:

◆ convertUnstreamable() [1/3]

template<typename T >
std::enable_if<!std::is_enum< T >::value &&!std::is_base_of< std::exception, T >::value, std::string >::type Catch::Detail::convertUnstreamable ( T const & )

Definition at line 64 of file catch_tostring.h.

64 {
65 return Detail::unprintableString;
66 }
Here is the caller graph for this function:

◆ convertUnstreamable() [2/3]

template<typename T >
std::enable_if<!std::is_enum< T >::value &&std::is_base_of< std::exception, T >::value, std::string >::type Catch::Detail::convertUnstreamable ( T const & ex)

Definition at line 70 of file catch_tostring.h.

70 {
71 return ex.what();
72 }

◆ convertUnstreamable() [3/3]

template<typename T >
std::enable_if< std::is_enum< T >::value, std::string >::type Catch::Detail::convertUnstreamable ( T const & value)

Definition at line 78 of file catch_tostring.h.

78 {
80 }
std::string convertUnknownEnumToString(E e)
#define value
Definition pkcs11.h:157
Here is the call graph for this function:

◆ getAnnotation()

std::string Catch::Detail::getAnnotation ( Class cls,
std::string const & annotationName,
std::string const & testCaseName )
inline

Definition at line 62 of file catch_objc.hpp.

64 {
65 NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()];
66 SEL sel = NSSelectorFromString( selStr );
67 arcSafeRelease( selStr );
68 id value = performOptionalSelector( cls, sel );
69 if( value )
70 return [(NSString*)value UTF8String];
71 return "";
72 }
void arcSafeRelease(NSObject *obj)
id performOptionalSelector(id obj, SEL sel)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeEnumInfo()

std::unique_ptr< EnumInfo > Catch::Detail::makeEnumInfo ( StringRef enumName,
StringRef allValueNames,
std::vector< int > const & values )

Definition at line 42 of file catch_enum_values_registry.cpp.

42 {
43 std::unique_ptr<EnumInfo> enumInfo( new EnumInfo );
44 enumInfo->m_name = enumName;
45 enumInfo->m_values.reserve( values.size() );
46
47 const auto valueNames = Catch::Detail::parseEnums( allValueNames );
48 assert( valueNames.size() == values.size() );
49 std::size_t i = 0;
50 for( auto value : values )
51 enumInfo->m_values.push_back({ value, valueNames[i++] });
52
53 return enumInfo;
54 }
std::vector< std::string > parseEnums(StringRef enums)
Here is the call graph for this function:

◆ parseEnums()

std::vector< std::string > Catch::Detail::parseEnums ( StringRef enums)

Definition at line 21 of file catch_enum_values_registry.cpp.

21 {
22 auto enumValues = splitStringRef( enums, ',' );
23 std::vector<std::string> parsed;
24 parsed.reserve( enumValues.size() );
25 for( auto const& enumValue : enumValues ) {
26 auto identifiers = splitStringRef( enumValue, ':' );
27 parsed.push_back( Catch::trim( identifiers.back() ) );
28 }
29 return parsed;
30 }
std::string trim(std::string const &str)
std::vector< StringRef > splitStringRef(StringRef str, char delimiter)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rangeToString()

template<typename InputIterator >
std::string Catch::Detail::rangeToString ( InputIterator first,
InputIterator last )

Definition at line 304 of file catch_tostring.h.

304 {
306 rss << "{ ";
307 if (first != last) {
308 rss << ::Catch::Detail::stringify(*first);
309 for (++first; first != last; ++first)
310 rss << ", " << ::Catch::Detail::stringify(*first);
311 }
312 rss << " }";
313 return rss.str();
314 }
auto str() const -> std::string
std::string stringify(const T &e)
Here is the call graph for this function:

◆ rawMemoryToString() [1/2]

template<typename T >
std::string Catch::Detail::rawMemoryToString ( const T & object)

Definition at line 41 of file catch_tostring.h.

41 {
42 return rawMemoryToString( &object, sizeof(object) );
43 }
std::string rawMemoryToString(const void *object, std::size_t size)
Here is the call graph for this function:

◆ rawMemoryToString() [2/2]

std::string Catch::Detail::rawMemoryToString ( const void * object,
std::size_t size )

Definition at line 52 of file catch_tostring.cpp.

52 {
53 // Reverse order for little endian architectures
54 int i = 0, end = static_cast<int>( size ), inc = 1;
55 if( Endianness::which() == Endianness::Little ) {
56 i = end-1;
57 end = inc = -1;
58 }
59
60 unsigned char const *bytes = static_cast<unsigned char const *>(object);
62 rss << "0x" << std::setfill('0') << std::hex;
63 for( ; i != end; i += inc )
64 rss << std::setw(2) << static_cast<unsigned>(bytes[i]);
65 return rss.str();
66 }
void inc(const Operand &op)
yh_object_descriptor object
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stringify()

template<typename T >
std::string Catch::Detail::stringify ( const T & e)

Definition at line 128 of file catch_tostring.h.

128 {
129 return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e);
130 }

Variable Documentation

◆ unprintableString

const std::string Catch::Detail::unprintableString = "{?}"

Definition at line 32 of file catch_tostring.cpp.