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