My Project
Loading...
Searching...
No Matches
Data Structures | Namespaces | Macros | Functions | Variables
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)   CxxTest::traits(x).asString()
 
#define CXXTEST_COPY_TRAITS(CXXTEST_NEW_CLASS, CXXTEST_OLD_CLASS)
 
#define CXXTEST_COPY_CONST_TRAITS(CXXTEST_CLASS)   CXXTEST_COPY_TRAITS(CXXTEST_CLASS, const CXXTEST_CLASS)
 
#define CXXTEST_NON_NEGATIVE(Type)
 
#define CXXTEST_ENUM_TRAITS(TYPE, VALUES)
 
#define CXXTEST_ENUM_MEMBER(MEMBER)    case MEMBER: return #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)    CXXTEST_COPY_TRAITS(CXXTEST_CLASS, const CXXTEST_CLASS)

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.

◆ CXXTEST_ENUM_MEMBER

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

Definition at line 374 of file ValueTraits.h.

◆ 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; \
} \
} \
}; \
}
char * copyString(char *dst, const char *src)
Definition: ValueTraits.cpp:30

Definition at line 350 of file ValueTraits.h.

◆ 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; }

Definition at line 122 of file ValueTraits.h.

◆ CXXTEST_TEMPLATE_INSTANTIATION

#define CXXTEST_TEMPLATE_INSTANTIATION   template<>

Definition at line 18 of file ValueTraits.h.

◆ TS_AS_STRING

#define TS_AS_STRING (   x)    CxxTest::traits(x).asString()

Definition at line 26 of file ValueTraits.h.