00001
00021
00022
00023
00024
00068
00069
00070
00082
00083
00087
00088
00089 #ifndef _MBO_H_
00090 #define _MBO_H_
00091
00092 #ifdef _MSC_VER
00093 #define Stringize( L ) #L
00094 #define MakeString( M, L ) M(L)
00095 #define $Line MakeString( Stringize, __LINE__ )
00096 #define Reminder __FILE__ "(" $Line ") : Reminder: "
00097
00098 #pragma comment (exestr, "This software includes material by M.Boerger (http://marcus-boerger.de/)")
00099 #endif
00100
00101 #ifdef DOXYGEN
00102 # define MBO_API
00103 #else
00104 # ifdef WIN32
00105 # if !defined(MBO_API)
00106 # if defined(MBO_LIB)
00107 # define MBO_API
00108 # elif defined(MBO_EXPORTS)
00109 # define MBO_API __declspec(dllexport)
00110 # else
00111 # define MBO_API __declspec(dllimport)
00112 # endif
00113 # endif
00114 # if !defined(MBO_USE_STDAFX) && !defined(MBO_NO_WIN_INCLUDE)
00115 # if defined(_MFC_VER) || defined(USE_MFC) || defined(_AFXDLL)
00116 # include <afx.h>
00117 # include <afxwin.h>
00118 # include <afxext.h>
00119 # include <afxdisp.h>
00120 # include <afxdtctl.h>
00121 # include <afxdlgs.h>
00122 # ifndef _AFX_NO_AFXCMN_SUPPORT
00123 # include <afxcmn.h>
00124 # endif // _AFX_NO_AFXCMN_SUPPORT
00125 # else // _MFC_VER
00126 # define WIN32_LEAN_AND_MEAN // Seldom used parts of Windows-Header will be ignored
00127 # include <windows.h>
00128 # endif // _MFC_VER
00129 # endif // !MBO_USE_STDAFX && !MBO_NO_WIN_INCLUDE
00130 # else // WIN32
00131 # define MBO_API
00132 # endif // WIN32
00133 #endif // MBO_API
00134
00135
00136 #ifndef _IN
00137
00138 # define _IN
00139 #endif
00140 #ifndef _OUT
00141
00142 # define _OUT
00143 #endif
00144 #ifndef _FREE
00145
00146 # define _FREE
00147 #endif
00148
00149
00150 #ifndef DEPRECATED
00151 # if defined(_MSC_VER) && !defined(DOXYGEN)
00152 # if _MSC_VER >= 1300
00153 # define DEPRECATED __declspec(deprecated)
00154 # else
00155 # define DEPRECATED
00156 # endif // _MSC_VER
00157 # else
00158 # define DEPRECATED
00159 # endif
00160 #endif // deprecated
00161
00162
00163 #if defined(_MSC_VER)
00164 # pragma warning(disable: 4786) // 'identifier' : identifier was truncated to 'number' characters in the debug information
00165 #endif
00166
00167 #include <string>
00168 #ifdef _MSC_VER
00169 # include <crtdbg.h>
00170 #endif
00171
00172 #ifndef DebugBreak
00173 # if defined(_MSC_VER) && defined(_DEBUG)
00174 # define DebugBreak() _asm { int 3 }
00175 # else
00176 # define DebugBreak()
00177 # endif
00178 #endif
00179
00185 #ifndef MBO_THROWS_EXCEPTIONS
00186 # define MBO_THROWS_EXCEPTIONS 1
00187 #endif
00188
00189 #if MBO_THROWS_EXCEPTIONS
00190
00191 # pragma warning(disable: 4290) // c++ exception specification ignored
00192
00193 # include <exception>
00194 # include <stdexcept>
00195
00196 # define MBO_THROW(exception, szMessage)\
00197 _RPT1(_CRT_WARN, "%s", szMessage);\
00198 throw exception(szMessage);
00199
00200 #define __THROWS(ex) throw(ex)
00201 #define __THROW2(ex1,ex2) throw(ex1,ex2)
00202
00203 # define mbo_throw_if_not(exception, condition) \
00204 if (!(condition)) { \
00205 char szMessage[1024]; \
00206 _snprintf(szMessage, sizeof(szMessage)-1, "%s(%d): %s", __FILE__, __LINE__, #condition); \
00207 throw exception(szMessage); \
00208 }
00209
00210 #else // MBO_THROWS_EXCEPTIONS
00211
00212 #include "assert.h"
00213
00214 # define MBO_THROW(exception, szMessage)\
00215 _RPT1(_CRT_WARN, "%s", szMessage);
00216
00217 #define __THROWS(ex) throw()
00218 #define __THROW2(ex1,ex2) throw()
00219
00220 # define mbo_throw_if_not(exception, condition) \
00221 if (!(condition)) { \
00222 assert(condition); \
00223 abort(); \
00224 }
00225
00226 #endif // MBO_THROWS_EXCEPTIONS
00227
00234 namespace mbo
00235 {
00236
00237 };
00238
00239 #undef MBO_USE_DEBUG_NEW
00240 #if defined(_MSC_VER) && !defined(MBO_USE_STDAFX) && !defined(MBO_NO_WIN_INCLUDE)
00241 # if defined(_MFC_VER) || defined(USE_MFC) || defined(_AFXDLL)
00242 # if defined(_DEBUG) && defined(USE_DEBUG_NEW)
00243 # define MBO_USE_DEBUG_NEW 1
00244 # endif
00245 # endif
00246 #endif
00247
00248 #if MBO_USE_DEBUG_NEW
00249 # define mbo_malloc(size) _malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__)
00250 # define mbo_realloc(ptr, size) _realloc_dbg(ptr, size, _NORMAL_BLOCK, __FILE__, __LINE__)
00251 # define mbo_free(ptr) _free_dbg(ptr, _NORMAL_BLOCK)
00252 #else
00253 # define mbo_malloc(size) malloc(size)
00254 # define mbo_realloc(ptr, size) realloc(ptr, size)
00255 # define mbo_free(prt) free(ptr)
00256 #endif
00257
00258
00259 #ifndef MBO_NO_MBOTSTRING
00260 # include "MboTString.h"
00261 #endif
00262
00263 #endif // _MBO_H_