CppUnit project page FAQ CppUnit home page

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Portability.h

Go to the documentation of this file.
00001 #ifndef CPPUNIT_PORTABILITY_H
00002 #define CPPUNIT_PORTABILITY_H
00003 
00004 /* include platform specific config */
00005 #if defined(__BORLANDC__)
00006 #    include <cppunit/config-bcb5.h>
00007 #elif defined (_MSC_VER)
00008 #    include <cppunit/config-msvc6.h>
00009 #else
00010 #    include <cppunit/config-auto.h>
00011 #endif
00012 
00013 
00014 /* Options that the library user may switch on or off.
00015  * If the user has not done so, we chose default values.
00016  */
00017 
00018 
00019 /* Define to 1 if you wish to have the old-style macros
00020    assert(), assertEqual(), assertDoublesEqual(), and assertLongsEqual() */
00021 #ifndef CPPUNIT_ENABLE_NAKED_ASSERT
00022 #define CPPUNIT_ENABLE_NAKED_ASSERT          0
00023 #endif
00024 
00025 /* Define to 1 if you wish to have the old-style CU_TEST family
00026    of macros. */
00027 #ifndef CPPUNIT_ENABLE_CU_TEST_MACROS
00028 #define CPPUNIT_ENABLE_CU_TEST_MACROS        0
00029 #endif
00030 
00031 /* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.) 
00032    I don't think there is any C preprocess that does NOT support this! */
00033 #ifndef CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION
00034 #define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION   1
00035 #endif
00036 
00037 // CPPUNIT_API is defined in <config_msvc6.h> if required (building or using as dll)
00038 #ifndef CPPUNIT_API
00039 #define CPPUNIT_API
00040 #undef CPPUNIT_NEED_DLL_DECL
00041 #define CPPUNIT_NEED_DLL_DECL 0
00042 #endif
00043 
00044 
00045 /* perform portability hacks */
00046 
00047 
00048 /* Define CPPUNIT_SSTREAM as a stream with a "std::string str()"
00049  * method.
00050  */
00051 #if CPPUNIT_HAVE_SSTREAM
00052 #   include <sstream>
00053     namespace CppUnit {
00054       class OStringStream : public std::ostringstream 
00055       {
00056       };
00057     }
00058 #else 
00059 #if CPPUNIT_HAVE_CLASS_STRSTREAM
00060 #   include <string>
00061 #   if CPPUNIT_HAVE_STRSTREAM
00062 #       include <strstream>
00063 #   else
00064 #       include <strstream.h>
00065 #   endif
00066 
00067     namespace CppUnit {
00068       class OStringStream : public std::ostrstream 
00069       {
00070       public:
00071           std::string str()
00072           {
00073             (*this) << '\0';
00074             std::string msg(std::ostrstream::str());
00075             std::ostrstream::freeze(false);
00076             return msg;
00077           }
00078       };
00079     }
00080 #else
00081 #   error Cannot define CppUnit::OStringStream.
00082 #endif
00083 #endif
00084 
00085 #endif // CPPUNIT_PORTABILITY_H

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