CppUnit project page CppUnit home page

config.h File Reference

#include <utility>
#include <assert.h>

Include dependency graph for config.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  CppTL

Classes

struct  CppTL::Type< T >
class  CppTL::NonCopyable
 Base class for non copyable class. More...

Defines

#define CPPTL_HAS_INT64   1
#define CPPTL_HAS__SNPRINTF   1
#define CPPTL_USE_WIN32_ATOMIC   1
#define CPPTL_USE_WIN32_THREAD   1
#define CPPTL_TYPENAME   typename
 CPPTL_TYPENAME is defined as 'typename' if the compiler requires deduced typename in template.
#define CPPTL_STATIC_CONSTANT(type, assignment)   enum { assignment }
 CPPTL_STATIC_CONSTANT is defined to declare a static constant in a class struct A { CPPTL_STATIC_CONSTANT( x, 1 ) }; // A::x = 1.
#define CPPTL_TYPE_DEFAULT_ARG(aType)   = ::CppTL::Type<aType>()
 CPPTL_NO_VECTOR_ITERATOR_VALUE_TYPE_DEDUCTION is defined if it not possible to deduced the value_type of std::vector<>::iterator (it is a pointer and there is no partial specialization support).
#define CPPTL_AT(container, index)   (container).at(index)
#define CPPTL_HAS_THREAD   1
#define CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER   1
#define CPPTL_API
#define CPPTL_JOIN(symbol1, symbol2)   _CPPTL_DO_JOIN( symbol1, symbol2 )
#define _CPPTL_DO_JOIN(symbol1, symbol2)   _CPPTL_DO_JOIN2( symbol1, symbol2 )
#define _CPPTL_DO_JOIN2(symbol1, symbol2)   symbol1##symbol2
#define CPPTL_MAKE_UNIQUE_NAME(prefix)   CPPTL_JOIN( prefix, __LINE__ )
#define CPPTL_MIN(a, b)   ((a) < (b) ? a : b)
#define CPPTL_MAX(a, b)   ((a) > (b) ? a : b)
#define CPPTL_CHECK_TYPE_COMPLETE(Type)
#define CPPTL_ARRAY_SIZE(array)   (sizeof(array)/sizeof((array)[0]))
 Evaluates to the number of elements in the array.
#define CPPTL_ASSERT_MESSAGE(cond, message)   assert( (cond) && message )
#define CPPTL_DEBUG_ASSERT_UNREACHABLE   assert( false && "unreachable code" )
#define CPPTL_CHECKED_CAST(TargetType, pointer)   ::CppTL::checkedCast( pointer, ::CppTL::Type<TargetType>() )

Typedefs

typedef __int64 CppTL::int64_t
typedef unsigned __int64 CppTL::uint64_t
typedef CppTL::int64_t CppTL::LargestInt
typedef CppTL::uint64_t CppTL::LargestUnsignedInt
typedef unsigned int CppTL::size_type

Functions

template<class T>
void CppTL::swap (T &left, T &right)
template<class T>
void CppTL::checkedDelete (T *p)
template<class T>
void CppTL::checkedArrayDelete (T *p)
template<class TargetType, class SourceType>
TargetType CppTL::checkedCast (SourceType *pointer, Type< TargetType >)


Define Documentation

#define _CPPTL_DO_JOIN ( symbol1,
symbol2   )     _CPPTL_DO_JOIN2( symbol1, symbol2 )

#define _CPPTL_DO_JOIN2 ( symbol1,
symbol2   )     symbol1##symbol2

#define CPPTL_API

#define CPPTL_ARRAY_SIZE ( array   )     (sizeof(array)/sizeof((array)[0]))

Evaluates to the number of elements in the array.

#define CPPTL_ASSERT_MESSAGE ( cond,
message   )     assert( (cond) && message )

#define CPPTL_AT ( container,
index   )     (container).at(index)

#define CPPTL_CHECK_TYPE_COMPLETE ( Type   ) 

Value:

{                                                            \
       typedef char typeMustBeComplete[ sizeof(Type) ? 1 : -1 ]; \
       (void)sizeof(typeMustBeComplete);                         \
    }
Cause a compilation error if a type is not complete. Typical use if before call to delete operator (ScopedPtr, SharedPtr...). (based on boost.checked_delete)

Referenced by CppTL::checkedArrayDelete(), and CppTL::checkedDelete().

#define CPPTL_CHECKED_CAST ( TargetType,
pointer   )     ::CppTL::checkedCast( pointer, ::CppTL::Type<TargetType>() )

#define CPPTL_DEBUG_ASSERT_UNREACHABLE   assert( false && "unreachable code" )

#define CPPTL_HAS__SNPRINTF   1

#define CPPTL_HAS_INT64   1

#define CPPTL_HAS_THREAD   1

#define CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER   1

#define CPPTL_JOIN ( symbol1,
symbol2   )     _CPPTL_DO_JOIN( symbol1, symbol2 )

Joins to symbol after expanding them into string.

Use this macro to join two symbols. Example of usage:

 #define MAKE_UNIQUE_NAME(prefix) CPPTL_JOIN( prefix, __LINE__ )

The macro defined in the example concatenate a given prefix with the line number to obtain a 'unique' identifier.

#define CPPTL_MAKE_UNIQUE_NAME ( prefix   )     CPPTL_JOIN( prefix, __LINE__ )

Adds the line number to the specified string to create a unique identifier.

Parameters:
prefix Prefix added to the line number to create a unique identifier.
See also:
CPPUT_TEST_SUITE_REGISTRATION for an example of usage.

#define CPPTL_MAX ( a,
 )     ((a) > (b) ? a : b)

#define CPPTL_MIN ( a,
 )     ((a) < (b) ? a : b)

#define CPPTL_STATIC_CONSTANT ( type,
assignment   )     enum { assignment }

CPPTL_STATIC_CONSTANT is defined to declare a static constant in a class struct A { CPPTL_STATIC_CONSTANT( x, 1 ) }; // A::x = 1.

#define CPPTL_TYPE_DEFAULT_ARG ( aType   )     = ::CppTL::Type<aType>()

CPPTL_NO_VECTOR_ITERATOR_VALUE_TYPE_DEDUCTION is defined if it not possible to deduced the value_type of std::vector<>::iterator (it is a pointer and there is no partial specialization support).

CPPTL_NO_TYPE_DEFAULT_ARG is defined if the compiler does not support the following construct: template<class ValueType> void doSomething( CppTL::Type<ValueType> type = CppTL::Type<ValueType>() ); With allow for the following usage: doSomething<int>(); Some compiler can not deduce type correctly or may cause silent linker error (all function instantion for different type being recognized as a single one). If this construct is not supported, the portable call syntax should be use: doSomething( CppTL::Type<int>() );

Todo:
Should this be kept. It is not used at the time...

#define CPPTL_TYPENAME   typename

#define CPPTL_USE_WIN32_ATOMIC   1

#define CPPTL_USE_WIN32_THREAD   1


SourceForge Logo hosts this site. Send comments to:
CppUnit Developers