00001
#ifndef CPPUNIT_PORTABILITY_H
00002
#define CPPUNIT_PORTABILITY_H
00003
00004
#if defined(_WIN32) && !defined(WIN32)
00005
# define WIN32 1
00006
#endif
00007
00008
00009
#if defined(__BORLANDC__)
00010
# include <cppunit/config/config-bcb5.h>
00011
#elif defined (_MSC_VER)
00012
# include <cppunit/config/config-msvc6.h>
00013
#else
00014
# include <cppunit/config-auto.h>
00015
#endif
00016
00017
00018
#ifndef CPPUNIT_VERSION
00019 #define CPPUNIT_VERSION "1.10.2"
00020
#endif
00021
00022
#include <cppunit/config/CppUnitApi.h>
00023
#include <cppunit/config/SelectDllLoader.h>
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
#if !defined(CPPUNIT_ENABLE_NAKED_ASSERT)
00034 # define CPPUNIT_ENABLE_NAKED_ASSERT 0
00035
#endif
00036
00037
00038
00039
#if !defined(CPPUNIT_ENABLE_CU_TEST_MACROS)
00040 # define CPPUNIT_ENABLE_CU_TEST_MACROS 0
00041
#endif
00042
00043
00044
00045
#if !defined(CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION)
00046
# define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION 1
00047
#endif
00048
00049
00050
00051
#if !defined(CPPUNIT_HAVE_NAMESPACES)
00052
# if !defined(CPPUNIT_NO_NAMESPACE)
00053
# define CPPUNIT_NO_NAMESPACE 1
00054
# endif // !defined(CPPUNIT_NO_NAMESPACE)
00055
# if !defined(CPPUNIT_NO_STD_NAMESPACE)
00056
# define CPPUNIT_NO_STD_NAMESPACE 1
00057
# endif // !defined(CPPUNIT_NO_STD_NAMESPACE)
00058
#endif // !defined(CPPUNIT_HAVE_NAMESPACES)
00059
00060
00061
00062
00063
00064
00065
00066
00067
#if CPPUNIT_STD_NEED_ALLOCATOR
00068
# if !defined(CPPUNIT_STD_ALLOCATOR)
00069
# define CPPUNIT_STD_ALLOCATOR std::allocator
00070
# endif // !defined(CPPUNIT_STD_ALLOCATOR)
00071
#endif // defined(CPPUNIT_STD_NEED_ALLOCATOR)
00072
00073
00074
00075
00076
00077
#if !defined(CPPUNIT_COMPILER_LOCATION_FORMAT)
00078 # define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:"
00079
#endif
00080
00081
00082
00083
#if defined( CPPUNIT_HAVE_CPP_CAST )
00084
# define CPPUNIT_CONST_CAST( TargetType, pointer ) \
00085
const_cast<TargetType>( pointer )
00086
00087
# define CPPUNIT_STATIC_CAST( TargetType, pointer ) \
00088
static_cast<TargetType>( pointer )
00089
#else // defined( CPPUNIT_HAVE_CPP_CAST )
00090 # define CPPUNIT_CONST_CAST( TargetType, pointer ) \
00091
((TargetType)( pointer ))
00092 # define CPPUNIT_STATIC_CAST( TargetType, pointer ) \
00093
((TargetType)( pointer ))
00094
#endif // defined( CPPUNIT_HAVE_CPP_CAST )
00095
00096
00097
00098
#if defined(CPPUNIT_NO_STD_NAMESPACE)
00099
# undef std
00100
# define std
00101
#endif // defined(CPPUNIT_NO_STD_NAMESPACE)
00102
00103
00104
00105
#if defined(CPPUNIT_NO_NAMESPACE)
00106
# define CPPUNIT_NS_BEGIN
00107
# define CPPUNIT_NS_END
00108
# define CPPUNIT_NS
00109
#else // defined(CPPUNIT_NO_NAMESPACE)
00110 # define CPPUNIT_NS_BEGIN namespace CppUnit {
00111 # define CPPUNIT_NS_END }
00112 # define CPPUNIT_NS CppUnit
00113
#endif // defined(CPPUNIT_NO_NAMESPACE)
00114
00125 #define CPPUNIT_STRINGIZE( symbol ) _CPPUNIT_DO_STRINGIZE( symbol )
00126
00128 #define _CPPUNIT_DO_STRINGIZE( symbol ) #symbol
00129
00148 #define CPPUNIT_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN( symbol1, symbol2 )
00149
00151 #define _CPPUNIT_DO_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN2( symbol1, symbol2 )
00152
00154 #define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2
00155
00160 #define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, __LINE__ )
00161
00164
#if !defined(CPPUNIT_WRAP_COLUMN)
00165 # define CPPUNIT_WRAP_COLUMN 79
00166
#endif
00167
00168
00169
00170
00171
00172
00173
00174
00175
#if CPPUNIT_HAVE_SSTREAM
00176
# include <sstream>
00177
CPPUNIT_NS_BEGIN
00178
00179
typedef std::ostringstream OStringStream;
00180
00181
CPPUNIT_NS_END
00182
#elif CPPUNIT_HAVE_CLASS_STRSTREAM
00183
# include <string>
00184
# if CPPUNIT_HAVE_STRSTREAM
00185
# include <strstream>
00186
# else // CPPUNIT_HAVE_STRSTREAM
00187
# include <strstream.h>
00188
# endif // CPPUNIT_HAVE_CLASS_STRSTREAM
00189
00190
CPPUNIT_NS_BEGIN
00191
00192
class OStringStream :
public std::ostrstream
00193 {
00194
public:
00195 std::string str()
00196 {
00197
00198
00199
00200
00201
00202
00203
return std::string( std::ostrstream::str(), pcount() );
00204 }
00205 };
00206
00207
CPPUNIT_NS_END
00208
#else // CPPUNIT_HAVE_CLASS_STRSTREAM
00209
# error Cannot define CppUnit::OStringStream.
00210
#endif // CPPUNIT_HAVE_SSTREAM
00211
00212
00213
#endif // CPPUNIT_PORTABILITY_H