My Project
Loading...
Searching...
No Matches
ValueTraits.h File Reference
#include <cxxtest/Flags.h>

Go to the source code of this file.

Data Structures

class  CxxTest::ValueTraits< T >
 
class  CxxTest::ValueTraits< const bool >
 
class  CxxTest::ValueTraits< const signed long int >
 
class  CxxTest::ValueTraits< const unsigned long int >
 
class  CxxTest::ValueTraits< const char >
 
class  CxxTest::ValueTraits< const double >
 

Namespaces

namespace  CxxTest
 

Macros

#define CXXTEST_TEMPLATE_INSTANTIATION   template<>
 
#define TS_AS_STRING(x)
 
#define CXXTEST_COPY_TRAITS(CXXTEST_NEW_CLASS, CXXTEST_OLD_CLASS)
 
#define CXXTEST_COPY_CONST_TRAITS(CXXTEST_CLASS)
 
#define CXXTEST_NON_NEGATIVE(Type)
 
#define CXXTEST_ENUM_TRAITS(TYPE, VALUES)
 
#define CXXTEST_ENUM_MEMBER(MEMBER)
 

Functions

char CxxTest::digitToChar (unsigned digit)
 
const char * CxxTest::byteToHex (unsigned char byte)
 
char * CxxTest::bytesToString (const unsigned char *bytes, unsigned numBytes, unsigned maxBytes, char *s)
 
char * CxxTest::copyString (char *dst, const char *src)
 
bool CxxTest::stringsEqual (const char *s1, const char *s2)
 
char * CxxTest::charToString (unsigned long c, char *s)
 
char * CxxTest::charToString (char c, char *s)
 
template<class T>
ValueTraits< TCxxTest::traits (T t)
 
template<class N>
bool CxxTest::negative (N n)
 
template<class N>
N CxxTest::abs (N n)
 
 CxxTest::CXXTEST_NON_NEGATIVE (bool) CXXTEST_NON_NEGATIVE(unsigned char) CXXTEST_NON_NEGATIVE(unsigned short int) CXXTEST_NON_NEGATIVE(unsigned int) CXXTEST_NON_NEGATIVE(unsigned long int) template< class N > char *numberToString(N n
 
 CxxTest::CXXTEST_COPY_TRAITS (const char *, const char *const &)
 
 CxxTest::CXXTEST_COPY_TRAITS (char *, const char *const &)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (bool)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (signed long int)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (unsigned long int)
 
 CxxTest::CXXTEST_COPY_TRAITS (const signed int, const signed long int)
 
 CxxTest::CXXTEST_COPY_TRAITS (const unsigned int, const unsigned long int)
 
 CxxTest::CXXTEST_COPY_TRAITS (const signed short int, const signed long int)
 
 CxxTest::CXXTEST_COPY_TRAITS (const unsigned short int, const unsigned long int)
 
 CxxTest::CXXTEST_COPY_TRAITS (const unsigned char, const unsigned long int)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (signed int)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (unsigned int)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (signed short int)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (unsigned short int)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (unsigned char)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (char)
 
 CxxTest::CXXTEST_COPY_TRAITS (const signed char, const char)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (signed char)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (double)
 
 CxxTest::CXXTEST_COPY_TRAITS (const float, const double)
 
 CxxTest::CXXTEST_COPY_CONST_TRAITS (float)
 

Variables

char * CxxTest::s
 
char N CxxTest::base = 10
 
char N unsigned CxxTest::skipDigits = 0
 
char N unsigned unsigned CxxTest::maxDigits
 

Macro Definition Documentation

◆ CXXTEST_COPY_CONST_TRAITS

#define CXXTEST_COPY_CONST_TRAITS ( CXXTEST_CLASS)
Value:
CXXTEST_COPY_TRAITS(CXXTEST_CLASS, const CXXTEST_CLASS)
#define CXXTEST_COPY_TRAITS(CXXTEST_NEW_CLASS, CXXTEST_OLD_CLASS)
Definition ValueTraits.h:97

Definition at line 113 of file ValueTraits.h.

◆ CXXTEST_COPY_TRAITS

#define CXXTEST_COPY_TRAITS ( CXXTEST_NEW_CLASS,
CXXTEST_OLD_CLASS )
Value:
CXXTEST_TEMPLATE_INSTANTIATION \
class ValueTraits< CXXTEST_NEW_CLASS > \
{ \
ValueTraits< CXXTEST_OLD_CLASS > _old; \
public: \
ValueTraits( CXXTEST_NEW_CLASS n ) : _old( (CXXTEST_OLD_CLASS)n ) {} \
const char *asString( void ) const { return _old.asString(); } \
}

Definition at line 97 of file ValueTraits.h.

97# define CXXTEST_COPY_TRAITS(CXXTEST_NEW_CLASS, CXXTEST_OLD_CLASS) \
98 CXXTEST_TEMPLATE_INSTANTIATION \
99 class ValueTraits< CXXTEST_NEW_CLASS > \
100 { \
101 ValueTraits< CXXTEST_OLD_CLASS > _old; \
102 public: \
103 ValueTraits( CXXTEST_NEW_CLASS n ) : _old( (CXXTEST_OLD_CLASS)n ) {} \
104 const char *asString( void ) const { return _old.asString(); } \
105 }

◆ CXXTEST_ENUM_MEMBER

#define CXXTEST_ENUM_MEMBER ( MEMBER)
Value:
case MEMBER: return #MEMBER;

Definition at line 374 of file ValueTraits.h.

374#define CXXTEST_ENUM_MEMBER( MEMBER ) \
375 case MEMBER: return #MEMBER;

◆ CXXTEST_ENUM_TRAITS

#define CXXTEST_ENUM_TRAITS ( TYPE,
VALUES )
Value:
namespace CxxTest \
{ \
CXXTEST_TEMPLATE_INSTANTIATION \
class ValueTraits<TYPE> \
{ \
TYPE _value; \
char _fallback[sizeof("(" #TYPE ")") + 3 * sizeof(TYPE)]; \
public: \
ValueTraits( TYPE value ) { \
_value = value; \
numberToString<unsigned long int>( _value, copyString( _fallback, "(" #TYPE ")" ) ); \
} \
const char *asString( void ) const \
{ \
switch ( _value ) \
{ \
VALUES \
default: return _fallback; \
} \
} \
}; \
}

Definition at line 350 of file ValueTraits.h.

350#define CXXTEST_ENUM_TRAITS( TYPE, VALUES ) \
351 namespace CxxTest \
352 { \
353 CXXTEST_TEMPLATE_INSTANTIATION \
354 class ValueTraits<TYPE> \
355 { \
356 TYPE _value; \
357 char _fallback[sizeof("(" #TYPE ")") + 3 * sizeof(TYPE)]; \
358 public: \
359 ValueTraits( TYPE value ) { \
360 _value = value; \
361 numberToString<unsigned long int>( _value, copyString( _fallback, "(" #TYPE ")" ) ); \
362 } \
363 const char *asString( void ) const \
364 { \
365 switch ( _value ) \
366 { \
367 VALUES \
368 default: return _fallback; \
369 } \
370 } \
371 }; \
372 }

◆ CXXTEST_NON_NEGATIVE

#define CXXTEST_NON_NEGATIVE ( Type)
Value:
CXXTEST_TEMPLATE_INSTANTIATION \
inline bool negative<Type>( Type ) { return false; } \
CXXTEST_TEMPLATE_INSTANTIATION \
inline Type abs<Type>( Type value ) { return value; }
Rational abs(const Rational &a)
Definition GMPrat.cc:436

Definition at line 122 of file ValueTraits.h.

122# define CXXTEST_NON_NEGATIVE(Type) \
123 CXXTEST_TEMPLATE_INSTANTIATION \
124 inline bool negative<Type>( Type ) { return false; } \
125 CXXTEST_TEMPLATE_INSTANTIATION \
126 inline Type abs<Type>( Type value ) { return value; }

◆ CXXTEST_TEMPLATE_INSTANTIATION

#define CXXTEST_TEMPLATE_INSTANTIATION   template<>

Definition at line 18 of file ValueTraits.h.

◆ TS_AS_STRING

#define TS_AS_STRING ( x)
Value:
CxxTest::traits(x).asString()
Variable x
Definition cfModGcd.cc:4090
ValueTraits< T > traits(T t)
Definition ValueTraits.h:89

Definition at line 26 of file ValueTraits.h.