summaryrefslogtreecommitdiff
path: root/include/cppunit/Portability.h
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-04-15 14:33:11 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-04-15 14:33:11 +0000
commit1b4bcf6f703248cb397587fe08635a1491d460ec (patch)
treee0ae81d803807027d7b4a6f14d9c39da2321dd47 /include/cppunit/Portability.h
parent5f5af41d52c01c8320baffea21cd60ebbb16380b (diff)
downloadcppunit-1b4bcf6f703248cb397587fe08635a1491d460ec.tar.gz
NEWS: updated.
NEWS: updated. * configure.in: added include/cppunit/config/Makefile and include/cppunit/plugin/Makefile to the list of target. * doc/CppUnit-win.dox: enabled generation of HTML Help documentation. * include/cppunit/config/Makefile.am: * include/cppunit/plugin/Makefile.am: added. * include/cppunit/config-bcb5.h: * include/cppunit/config-msvc6.h: * include/cppunit/config-mac.h: moved to include/cppunit/config/. * include/cppunit/Portability.h: updated config files location. Added macros CPPUNIT_STRINGIZE and CPPUNIT_JOIN (implementation adapted from boost.org). Added macro CPPUNIT_MAKE_UNIQUE_NAME. * include/cppunit/Test.h: modified methods order. * include/cppunit/extensions/HelperMacros.h: renamed macro __CPPUNIT_MAKE_UNIQUE_NAME to CPPUNIT_MAKE_UNIQUE_NAME and moved its definition to include/cppunit/Portability.h. * include/cppunit/extensions/TestDecorator.h: Inherits Test instead of TestLeaf. * include/cppunit/plugin/DynamicLibraryManager.h: * src/cppunit/DynamicLibraryManager.cpp: added. DLL manager (load & lookup symbol). * src/cppunit/BeOsDynamicLibraryManager.cpp: * src/cppunit/UnixDynamicLibraryManager.cpp: * src/cppunit/Win32DynamicLibraryManager.cpp: added. Implementation of platform dependent methods of DynamicLibraryManager. * include/cppunit/plugin/DynamicLibraryManagerException.h: * src/cppunit/DynamicLibraryManagerException.cpp: added. Exception thrown by DynamicLibraryManager. * include/cppunit/plugin/TestPlugIn.h: added. CppUnitTestPlugIn interface definition. Helper macros to implements plug-in. * include/cppunit/plugin/TestPlugInSuite.h: * src/cppunit/plugin/TestPlugInSuite.cpp: added. A suite to wrap a test plug-in. * include/cppunit/plugin/TestPlugInDefaultImpl.h: * src/cppunit/TestPlugInDefaultImpl.cpp: added. A default implementation of the test plug-in interface. * src/msvc6/DllPlugInTester/DllPlugInTester.cpp: updated to use the new TestPlugIn. * examples/cppunittest/TestResultCollectorTest.cpp: fixed typo.
Diffstat (limited to 'include/cppunit/Portability.h')
-rw-r--r--include/cppunit/Portability.h56
1 files changed, 54 insertions, 2 deletions
diff --git a/include/cppunit/Portability.h b/include/cppunit/Portability.h
index 1661da0..2584934 100644
--- a/include/cppunit/Portability.h
+++ b/include/cppunit/Portability.h
@@ -3,13 +3,15 @@
/* include platform specific config */
#if defined(__BORLANDC__)
-# include <cppunit/config-bcb5.h>
+# include <cppunit/config/config-bcb5.h>
#elif defined (_MSC_VER)
-# include <cppunit/config-msvc6.h>
+# include <cppunit/config/config-msvc6.h>
#else
# include <cppunit/config-auto.h>
#endif
+#include <cppunit/config/SelectDllLoader.h>
+
/* Options that the library user may switch on or off.
* If the user has not done so, we chose default values.
@@ -49,6 +51,55 @@
#define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:"
#endif
+
+/*! Stringize a symbol.
+ *
+ * Use this macro to convert a preprocessor symbol to a string.
+ *
+ * Example of usage:
+ * \code
+ * #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn
+ * const char *name = CPPUNIT_STRINGIZE( CPPUNIT_PLUGIN_EXPORTED_NAME );
+ * \endcode
+ */
+#define CPPUNIT_STRINGIZE( symbol ) _CPPUNIT_DO_STRINGIZE( symbol )
+
+/// \internal
+#define _CPPUNIT_DO_STRINGIZE( symbol ) #symbol
+
+/*! Joins to symbol after expanding them into string.
+ *
+ * Use this macro to join two symbols. Example of usage:
+ *
+ * \code
+ * #define MAKE_UNIQUE_NAME(prefix) CPPUNIT_JOIN( prefix, __LINE__ )
+ * \endcode
+ *
+ * The macro defined in the example concatenate a given prefix with the line number
+ * to obtain a 'unique' identifier.
+ *
+ * \internal From boost documentation:
+ * The following piece of macro magic joins the two
+ * arguments together, even when one of the arguments is
+ * itself a macro (see 16.3.1 in C++ standard). The key
+ * is that macro expansion of macro arguments does not
+ * occur in CPPUNIT_JOIN2 but does in CPPUNIT_JOIN.
+ */
+#define CPPUNIT_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN( symbol1, symbol2 )
+
+/// \internal
+#define _CPPUNIT_DO_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN2( symbol1, symbol2 )
+
+/// \internal
+#define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2
+
+/*! Adds the line number to the specified string to create a unique identifier.
+ * \param prefix Prefix added to the line number to create a unique identifier.
+ * \see CPPUNIT_TEST_SUITE_REGISTRATION for an example of usage.
+ */
+#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, __LINE__ )
+
+
/* perform portability hacks */
@@ -89,4 +140,5 @@
#endif
#endif
+
#endif // CPPUNIT_PORTABILITY_H