CppUnit project page FAQ CppUnit home page

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

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 
00038 
00039 /* perform portability hacks */
00040 
00041 
00042 /* Define CPPUNIT_SSTREAM as a stream with a "std::string str()"
00043  * method.
00044  */
00045 #if CPPUNIT_HAVE_SSTREAM
00046 #   include <sstream>
00047     namespace CppUnit {
00048         typedef std::ostringstream  OStringStream;
00049     }
00050 #else 
00051 #if CPPUNIT_HAVE_CLASS_STRSTREAM
00052 #   include <string>
00053 #   if CPPUNIT_HAVE_STRSTREAM
00054 #       include <strstream>
00055 #   else
00056 #       include <strstream.h>
00057 #   endif
00058 
00059     namespace CppUnit {
00060         class OStringStream : public std::ostrstream 
00061         {
00062         public:
00063             std::string str()
00064             {
00065                 (*this) << '\0';
00066                 std::string msg(std::ostrstream::str());
00067                 std::ostrstream::freeze(false);
00068                 return msg;
00069             }
00070         };
00071     }
00072 #else
00073 #   error Cannot define CppUnit::OStringStream.
00074 #endif
00075 #endif
00076 
00077 
00078 #endif // CPPUNIT_PORTABILITY_H

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