00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00088 #ifndef MOCKPP_H
00089 #define MOCKPP_H
00090
00091 # ifdef _MSC_VER
00092
00093 # pragma warning (disable:4800) // conversion int - bool
00094 # pragma warning (disable:4786) // identifier was truncated to 'number' characters in the debug information
00095 # pragma warning (disable:4251) // class 'type' needs to have dll-interface to be used by clients of class 'type2'
00096 # pragma warning (disable:4180) // qualifier applied to function type has no meaning
00097 # pragma warning (disable:4355) // 'this' : used in base member initializer list
00098 # pragma warning (disable:4512) // assignment operator could not be generated
00099 # pragma warning (disable:4511) // copy constructor could not be generated
00100 # pragma warning (disable:4018) // signed/unsigned mismatch
00101 # pragma warning (disable:4100) // unreferenced formal parameter
00102 # pragma warning (disable:4663) // C++ language change: to explicitly specialize class template 'identifier' use the following syntax
00103 # pragma warning (disable:4146) // unary minus operator applied to unsigned type, result still unsigned
00104 # pragma warning (disable:4244) // conversion from 'type1' to 'type2', possible loss of data
00105 # pragma warning (disable:4138) // '*/' found outside of comment
00106 # pragma warning (disable:4516) // access-declarations are deprecated; member using-declarations provide a better alternative
00107 # pragma warning (disable:4097) // typedef-name 'identifier1' used as synonym for class-name 'identifier2'
00108 # pragma warning (disable:4702) // unreachable code
00109 # endif // _MSC_VER
00110
00111
00112
00113
00114 #ifdef _MSC_VER
00115 # include <mockpp/mockpp_config-msvc_71.h>
00116
00117 #elif defined(__BORLANDC__)
00118 # include <mockpp/mockpp_config-bcb5.h>
00119
00120 #elif defined(__CYGWIN__)
00121 # ifdef HAVE_CONFIG_H
00122 # include <config.h>
00123 # else
00124 # include <mockpp/mockpp_config.h>
00125 # endif
00126
00127 #else
00128 # ifdef HAVE_CONFIG_H
00129 # include <config.h>
00130 # else
00131 # include <mockpp/mockpp_config.h>
00132 # endif
00133 #endif
00134
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 #if defined(MOCKPP_UNICODE) && defined(__CYGWIN__) // probably ugly hack
00150 # define _GLIBCPP_USE_WSTRING 1
00151
00152
00153 #endif
00154
00155
00157
00158
00159 #ifdef verify
00160 #error "<verify> must not be #defined within mockpp sources"
00161 #endif
00162
00163 #ifdef check
00164 #error "<check> must not be #defined within mockpp sources"
00165 #endif
00166
00167 #ifdef require
00168 #error "<require> must not be #defined within mockpp sources"
00169 #endif
00170
00172
00173
00174 #ifdef MOCKPP_USE_MINI_STL
00175
00176 #define MOCKPP_STRING_H <ministl/string>
00177 #define MOCKPP_VECTOR_H <ministl/vector>
00178 #define MOCKPP_MAP_H <ministl/map>
00179 #define MOCKPP_SET_H <ministl/set>
00180 #define MOCKPP_ALGORITHM_H <ministl/algorithm>
00181 #define MOCKPP_FUNCTION_H <ministl/function>
00182
00183
00184 #define MOCKPP_STL MINISTL_NS
00185 #define MOCKPP_ALTERNATIVE_STL
00186
00187 #else
00188
00189 #define MOCKPP_STRING_H <string>
00190 #define MOCKPP_VECTOR_H <vector>
00191 #define MOCKPP_MAP_H <map>
00192 #define MOCKPP_SET_H <set>
00193 #define MOCKPP_FUNCTION_H <function>
00194 #define MOCKPP_ALGORITHM_H <algorithm>
00195
00196
00197 #define MOCKPP_STL MOCKPP_STD_NS
00198 #undef MOCKPP_ALTERNATIVE_STL
00199
00200 #endif
00201
00203
00204
00205 #ifndef MOCKPP_NO_RTTI
00206 # include <typeinfo>
00207 #else
00208 # undef CPPUNIT_USE_TYPEINFO_NAME
00209 # define CPPUNIT_USE_TYPEINFO_NAME 0
00210 #endif
00211
00213
00214
00215 #ifdef MOCKPP_NO_NAMESPACE
00216 # define MOCKPP_ANON_NS_START
00217 # define MOCKPP_NS
00218 # define MOCKPP_NS_START
00219 # define MOCKPP_NS_END
00220 # define USING_NAMESPACE_MOCKPP
00221 #else
00222 # define MOCKPP_ANON_NS_START namespace {
00223 # define MOCKPP_NS mockpp
00224 # define MOCKPP_NS_START namespace mockpp {
00225 # define MOCKPP_NS_END }
00226 # define USING_NAMESPACE_MOCKPP using namespace mockpp;
00227 #endif
00228
00230
00231
00232 #ifdef MOCKPP_NO_STD_NS
00233 # define MOCKPP_STD_NS
00234 #else
00235 # define MOCKPP_STD_NS std
00236 #endif
00237
00239
00240
00241 #ifndef MOCKPP_NO_EXCEPTIONS
00242
00243 #define MOCKPP_THROW(x) throw (x)
00244 #define MOCKPP_RETHROW throw
00245 #define MOCKPP_TRY try
00246 #define MOCKPP_CATCH(x) catch(x)
00247 #define MOCKPP_CATCH_ALL catch(...)
00248
00249 #else
00250
00251 #define CPPUNIT_DISABLE_EXCEPTIONS // ea-hack not available in official cppunit
00252
00253 # ifndef MOCKPP_THROW
00254 # define MOCKPP_THROW(x)
00255 # endif
00256
00257 # ifndef MOCKPP_RETHROW
00258 # define MOCKPP_RETHROW
00259 # endif
00260
00261 # ifndef MOCKPP_TRY
00262 # define MOCKPP_TRY
00263 # endif
00264
00265 # ifndef MOCKPP_CATCH
00266 # define MOCKPP_CATCH(x) if(false)
00267 # endif
00268
00269 # ifndef MOCKPP_CATCH_ALL
00270 # define MOCKPP_CATCH_ALL
00271 # endif
00272
00273 #endif
00274
00276
00277
00278 #ifdef HAVE_LIMITS
00279 # include <limits>
00280 #else
00281 # ifdef HAVE_VALUES_H
00282 # include <values.h>
00283 # else
00284 # include <machine/limits.h>
00285 # endif
00286 #endif
00287
00292 #if defined(HAVE_LIMITS) && !defined (MOCKPP_NO_STD_NUMERICLIMITS)
00293 # define MOCKPP_UNLIMITED (std::numeric_limits<unsigned>::max())
00294 #else
00295 # define MOCKPP_UNLIMITED (UINT_MAX)
00296 #endif
00297
00299
00300
00301 #ifdef __BORLANDC__
00302 # define MOCKPP_FUNC_MACRO __FUNC__
00303 #elif defined(_MSC_VER)
00304 # if _MSC_VER <= 1200
00305 # define MOCKPP_FUNC_MACRO (MOCKPP_STL::string(__FILE__) + "_" + MOCKPP_NS::getLatin1(MOCKPP_NS::number((long unsigned)__LINE__))) // needs #include <mockpp/compat/Formatter.h>
00306 # else
00307 # define MOCKPP_FUNC_MACRO __FUNCSIG__
00308 # endif
00309 #else
00310 # define MOCKPP_FUNC_MACRO __func__
00311 #endif
00312
00318
00319
00320
00328 #ifndef MOCKPP_UNUSED
00329 #define MOCKPP_UNUSED(x)
00330 #endif
00331
00333
00334
00338 #define MOCKPP_MAKE_CHAR_READABLE 1
00339
00343 #define MOCKPP_USE_STD_EXCEPTION 1
00344
00345 #undef HAVE_MULTITHREAD // obsolete and error prone
00346
00350 #define MOCKPP_BOUNDARY_DELTA 0
00351
00353
00354
00355 #if defined(_WIN32) || defined(_WIN64)
00356 # ifndef __WIN32__
00357 # define __WIN32__
00358 # endif
00359 #endif
00360
00361 #if defined(__BORLANDC__) || defined (_MSC_VER)
00362
00363 # ifndef __WIN32__
00364 # define __WIN32__
00365 # endif //__WIN32__
00366
00367 # ifdef __BORLANDC__
00368 # include <io.h>
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 # endif
00379
00381
00382
00383 # ifdef _MSC_VER
00384
00385 # if defined(MOCKPP_STATIC_LIB)
00386 # define MOCKPP_API_DECL(type) type
00387 # define MOCKPP_API_DECL0
00388 # define MOCKPP_API_IMPL(type) type
00389 # define MOCKPP_API_IMPL0
00390 # pragma message("*** mockpp: Static ***")
00391 # else //MOCKPP_STATIC_LIB
00392
00393 # if defined(MOCKPP_NEED_EXPORTS)
00394 # define MOCKPP_API_DECL(type) __declspec(dllexport) type
00395 # define MOCKPP_API_DECL0 __declspec(dllexport)
00396 # define MOCKPP_API_IMPL(type) __declspec(dllexport) type
00397 # define MOCKPP_API_IMPL0 __declspec(dllexport)
00398 # pragma message("*** mockpp: DllExport ***")
00399
00400 # else // MOCKPP_NEED_EXPORTS
00401
00402 # define MOCKPP_API_DECL(type) __declspec(dllimport) type
00403 # define MOCKPP_API_DECL0 __declspec(dllimport)
00404 # define MOCKPP_API_IMPL(type) __declspec(dllimport) type
00405 # define MOCKPP_API_IMPL0 __declspec(dllimport)
00406 # pragma message("*** mockpp: DllImport ***")
00407 # endif // MOCKPP_NEED_EXPORTS
00408
00409 # endif //MOCKPP_STATIC_LIB
00410
00411 # else // __BORLANDC__
00412
00413 # if defined(MOCKPP_NEED_EXPORTS)
00414 # define MOCKPP_API_DECL0 __declspec(dllexport)
00415 # define MOCKPP_API_IMPL0 __declspec(dllexport)
00416 # define MOCKPP_API_DECL(type) __declspec(dllexport) type
00417 # define MOCKPP_API_IMPL(type) __declspec(dllexport) type
00418 # else
00419 # define MOCKPP_API_DECL0 __declspec(dllimport)
00420 # define MOCKPP_API_IMPL0
00421 # define MOCKPP_API_DECL(type) __declspec(dllimport) type
00422 # define MOCKPP_API_IMPL(type) type
00423 # endif
00424
00425 # endif
00426
00427 #else // __BORLANDC__ || _MSC_VER
00428
00429 # include <unistd.h>
00430 # define MOCKPP_API_DECL0
00431 # define MOCKPP_API_IMPL0
00432 # define MOCKPP_API_DECL(type) type
00433 # define MOCKPP_API_IMPL(type) type
00434
00435 #endif
00436
00438
00439
00440 #include MOCKPP_STRING_H
00441
00443 MOCKPP_NS_START
00444
00445
00446 #ifdef MOCKPP_UNICODE
00447
00448 typedef MOCKPP_STL::basic_string<wchar_t> String;
00449 typedef wchar_t Char;
00451 # define MOCKPP_CHAR(x) L##x
00453 # define MOCKPP_PCHAR(x) L##x
00454
00455 #else
00456
00457 typedef MOCKPP_STL::basic_string<char> String;
00458 typedef char Char;
00460 # define MOCKPP_CHAR(x) x
00462 # define MOCKPP_PCHAR(x) x
00463
00464 #endif
00465
00466
00468 #define MOCKPP_PCSTRING(x) MOCKPP_NS::String(MOCKPP_PCHAR(x))
00469
00471 #define MOCKPP_STRING(x) MOCKPP_NS::String(x)
00472
00474 #ifndef MOCKPP_I18N_NOOP
00475 #define MOCKPP_I18N_NOOP(x) x
00476 #endif
00477
00479 #ifndef mockpp_i18n
00480 #define mockpp_i18n(x) x
00481 #endif
00482
00484 #undef MOCKP_NO_PREVENT_FLOAT_EXPECTATION
00485
00486
00494 MOCKPP_API_DECL(void) getVersion (int &major, int &minor, int &patch,
00495 bool &debug, MOCKPP_STL::string &info);
00496
00497 #ifdef MOCKPP_UNICODE
00498
00505 MOCKPP_API_DECL(MOCKPP_STL::basic_string<wchar_t>)
00506 getUnicode(const MOCKPP_STL::string &latin1);
00507
00508
00514 inline MOCKPP_STL::basic_string<wchar_t> getUnicode(const MOCKPP_STL::basic_string<wchar_t> &uni)
00515 {
00516 return uni;
00517 }
00518
00525 MOCKPP_API_DECL(MOCKPP_STL::string)
00526 getLatin1(const MOCKPP_STL::basic_string<wchar_t> &uni);
00527
00528 #endif
00529
00535 inline MOCKPP_STL::string getLatin1(const MOCKPP_STL::string &latin1)
00536 {
00537 return latin1;
00538 }
00539
00540 class AssertionFailedError;
00541
00544 typedef void (*AssertionFailedForwarder_t)(const AssertionFailedError &err);
00545
00552 MOCKPP_API_DECL(AssertionFailedForwarder_t)
00553 setAssertionFailedForwarder(AssertionFailedForwarder_t fwd);
00554
00555 MOCKPP_NS_END
00556
00557 #ifdef __SUNPRO_CC
00558 #define MOCKPP_NO_TEMPLATE_HINT
00559 #endif
00560
00561 #ifdef MOCKPP_UNICODE
00563 # define MOCKPP_GET_STRING(x) MOCKPP_NS::getUnicode(x)
00564 #else
00566 # define MOCKPP_GET_STRING(x) MOCKPP_NS::getLatin1(x)
00567 #endif
00568
00570 #define mockpp_constructor
00571
00573 #define mockpp_methods
00574
00575 #if defined(__BORLANDC__) || (__GNUC__ < 3)
00576 # define MOCKPP_MEMBER_RESTRICTOR_PRIVATE public
00577 # define MOCKPP_MEMBER_RESTRICTOR_PROTECTED public
00578 #else
00579 # define MOCKPP_MEMBER_RESTRICTOR_PRIVATE private
00580 # define MOCKPP_MEMBER_RESTRICTOR_PROTECTED protected
00581 #endif
00582
00583 #ifdef DOXYGEN_SHOULD_INCLUDE_THIS // make doxygen happily include docs
00584 #define MOCKPP_UNICODE
00585 #define CXXTEST_USE_MINI_STL
00586 #define MOCKPP_USE_MINI_STL
00587 #define MOCKPP_NO_NAMESPACE
00588 #define MOCKPP_NO_TEMPLATE_HINT
00589 #define MOCKPP_NO_TYPENAME_FOR_STL_NS
00590 #define MOCKPP_ALTERNATIVE_STL
00591 #define MOCKPP_NEED_EXPORTS
00592 #define MOCKPP_API_DECL0
00593 #define MOCKPP_API_DECL
00594 #define MOCKPP_API_IMPL0
00595 #define MOCKPP_API_IMPL
00596 #endif
00597
00755 #endif // MOCKPP_H