Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

266 lines
6.5 KiB

  1. // This is a part of the Active Template Library.
  2. // Copyright (C) 1996-2001 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Active Template Library Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Active Template Library product.
  10. #ifndef __ATLDEF_H__
  11. #define __ATLDEF_H__
  12. #pragma once
  13. #include <atlres.h>
  14. #ifndef RC_INVOKED
  15. #ifndef __cplusplus
  16. #error ATL requires C++ compilation (use a .cpp suffix)
  17. #endif
  18. #ifdef UNDER_CE
  19. #error ATL not currently supported for CE
  20. #endif
  21. #ifdef _UNICODE
  22. #ifndef UNICODE
  23. #define UNICODE // UNICODE is used by Windows headers
  24. #endif
  25. #endif
  26. #ifdef UNICODE
  27. #ifndef _UNICODE
  28. #define _UNICODE // _UNICODE is used by C-runtime/MFC headers
  29. #endif
  30. #endif
  31. #ifdef _DEBUG
  32. #ifndef DEBUG
  33. #define DEBUG
  34. #endif
  35. #endif
  36. #ifdef _WIN64
  37. #define _ATL_SUPPORT_VT_I8 // Always support VT_I8 on Win64.
  38. #endif
  39. #ifndef ATLASSERT
  40. #define ATLASSERT(expr) _ASSERTE(expr)
  41. #endif
  42. #ifndef ATLVERIFY
  43. #ifdef _DEBUG
  44. #define ATLVERIFY(expr) ATLASSERT(expr)
  45. #else
  46. #define ATLVERIFY(expr) (expr)
  47. #endif // DEBUG
  48. #endif // ATLVERIFY
  49. ///////////////////////////////////////////////////////////////////////////////
  50. // __declspec(novtable) is used on a class declaration to prevent the vtable
  51. // pointer from being initialized in the constructor and destructor for the
  52. // class. This has many benefits because the linker can now eliminate the
  53. // vtable and all the functions pointed to by the vtable. Also, the actual
  54. // constructor and destructor code are now smaller.
  55. ///////////////////////////////////////////////////////////////////////////////
  56. // This should only be used on a class that is not directly createable but is
  57. // rather only used as a base class. Additionally, the constructor and
  58. // destructor (if provided by the user) should not call anything that may cause
  59. // a virtual function call to occur back on the object.
  60. ///////////////////////////////////////////////////////////////////////////////
  61. // By default, the wizards will generate new ATL object classes with this
  62. // attribute (through the ATL_NO_VTABLE macro). This is normally safe as long
  63. // the restriction mentioned above is followed. It is always safe to remove
  64. // this macro from your class, so if in doubt, remove it.
  65. ///////////////////////////////////////////////////////////////////////////////
  66. #ifdef _ATL_DISABLE_NO_VTABLE
  67. #define ATL_NO_VTABLE
  68. #else
  69. #define ATL_NO_VTABLE __declspec(novtable)
  70. #endif
  71. #ifdef _ATL_DISABLE_NOTHROW
  72. #define ATL_NOTHROW
  73. #else
  74. #define ATL_NOTHROW __declspec(nothrow)
  75. #endif
  76. #ifdef _ATL_DISABLE_FORCEINLINE
  77. #define ATL_FORCEINLINE
  78. #else
  79. #define ATL_FORCEINLINE __forceinline
  80. #endif
  81. #ifdef _ATL_DISABLE_NOINLINE
  82. #define ATL_NOINLINE
  83. #else
  84. #define ATL_NOINLINE __declspec( noinline )
  85. #endif
  86. //#define _ATL_DISABLE_DEPRECATED //REVIEW: Waiting for recent compiler
  87. #ifdef _ATL_DISABLE_DEPRECATED
  88. #define ATL_DEPRECATED
  89. #else
  90. #define ATL_DEPRECATED __declspec( deprecated )
  91. #endif
  92. // If ATL70.DLL is being used then _ATL_STATIC_REGISTRY doesn't really make sense
  93. #ifdef _ATL_DLL
  94. #undef _ATL_STATIC_REGISTRY
  95. #else
  96. // If not linking to ATL70.DLL, use the static registrar and not building atl.dll
  97. #ifndef _ATL_DLL_IMPL
  98. #ifndef _ATL_STATIC_REGISTRY
  99. #define _ATL_STATIC_REGISTRY
  100. #endif
  101. #endif
  102. #endif
  103. #ifdef _ATL_DEBUG_REFCOUNT
  104. #ifndef _ATL_DEBUG_INTERFACES
  105. #define _ATL_DEBUG_INTERFACES
  106. #endif
  107. #endif
  108. #ifdef _DEBUG
  109. #ifndef _ATL_DEBUG
  110. #define _ATL_DEBUG
  111. #endif // _ATL_DEBUG
  112. #endif // _DEBUG
  113. #ifdef _ATL_DEBUG_INTERFACES
  114. #ifndef _ATL_DEBUG
  115. #define _ATL_DEBUG
  116. #endif // _ATL_DEBUG
  117. #endif // _ATL_DEBUG_INTERFACES
  118. #ifndef _ATL_HEAPFLAGS
  119. #ifdef _MALLOC_ZEROINIT
  120. #define _ATL_HEAPFLAGS HEAP_ZERO_MEMORY
  121. #else
  122. #define _ATL_HEAPFLAGS 0
  123. #endif
  124. #endif
  125. #ifndef _ATL_PACKING
  126. #define _ATL_PACKING 8
  127. #endif
  128. #if defined(_ATL_DLL)
  129. #define ATLAPI extern "C" HRESULT __declspec(dllimport) __stdcall
  130. #define ATLAPI_(x) extern "C" __declspec(dllimport) x __stdcall
  131. #define ATLINLINE
  132. #elif defined(_ATL_DLL_IMPL)
  133. #define ATLAPI extern "C" inline HRESULT __stdcall
  134. #define ATLAPI_(x) extern "C" inline x __stdcall
  135. #define ATLINLINE
  136. #else
  137. #define ATLAPI ATL_NOTHROW HRESULT __stdcall
  138. #define ATLAPI_(x) ATL_NOTHROW x __stdcall
  139. #define ATLINLINE inline
  140. #endif
  141. #ifdef _ATL_NO_EXCEPTIONS
  142. #ifdef _AFX
  143. #error MFC projects cannot define _ATL_NO_EXCEPTIONS
  144. #endif
  145. #else
  146. #ifndef _CPPUNWIND
  147. #define _ATL_NO_EXCEPTIONS
  148. #endif
  149. #endif
  150. #ifdef _CPPUNWIND
  151. #ifndef ATLTRYALLOC
  152. #ifdef _AFX
  153. #define ATLTRYALLOC(x) try{x;} catch(CException* e){e->Delete();}
  154. #else
  155. #define ATLTRYALLOC(x) try{x;} catch(...){}
  156. #endif //__AFX
  157. #endif //ATLTRYALLOC
  158. // If you define _ATLTRY before including this file, then
  159. // you should define _ATLCATCH and _ATLRETHROW as well.
  160. #ifndef _ATLTRY
  161. #define _ATLTRY try
  162. #ifdef _AFX
  163. #define _ATLCATCH( e ) catch( CException* e )
  164. #else
  165. #define _ATLCATCH( e ) catch( CAtlException e )
  166. #endif
  167. #define _ATLCATCHALL() catch( ... )
  168. #ifdef _AFX
  169. #define _ATLDELETEEXCEPTION(e) e->Delete();
  170. #else
  171. #define _ATLDELETEEXCEPTION(e) e;
  172. #endif
  173. #define _ATLRETHROW throw
  174. #endif // _ATLTRY
  175. #else //_CPPUNWIND
  176. #ifndef ATLTRYALLOC
  177. #define ATLTRYALLOC(x) x;
  178. #endif //ATLTRYALLOC
  179. // if _ATLTRY is defined before including this file then
  180. // _ATLCATCH and _ATLRETHROW should be defined as well.
  181. #ifndef _ATLTRY
  182. #define _ATLTRY
  183. #define _ATLCATCH( e ) __pragma(warning(push)) __pragma(warning(disable: 4127)) if( false ) __pragma(warning(pop))
  184. #define _ATLCATCHALL() __pragma(warning(push)) __pragma(warning(disable: 4127)) if( false ) __pragma(warning(pop))
  185. #define _ATLDELETEEXCEPTION(e)
  186. #define _ATLRETHROW
  187. #endif // _ATLTRY
  188. #endif //_CPPUNWIND
  189. #ifndef ATLTRY
  190. #define ATLTRY(x) ATLTRYALLOC(x)
  191. #endif //ATLTRY
  192. #define offsetofclass(base, derived) ((DWORD_PTR)(static_cast<base*>((derived*)_ATL_PACKING))-_ATL_PACKING)
  193. /////////////////////////////////////////////////////////////////////////////
  194. // Master version numbers
  195. #define _ATL 1 // Active Template Library
  196. #define _ATL_VER 0x0700 // Active Template Library version 7.0
  197. /////////////////////////////////////////////////////////////////////////////
  198. // Threading
  199. #ifndef _ATL_SINGLE_THREADED
  200. #ifndef _ATL_APARTMENT_THREADED
  201. #ifndef _ATL_FREE_THREADED
  202. #define _ATL_FREE_THREADED
  203. #endif
  204. #endif
  205. #endif
  206. // UUIDOF
  207. #ifndef _ATL_NO_UUIDOF
  208. #define _ATL_IIDOF(x) __uuidof(x)
  209. #else
  210. #define _ATL_IIDOF(x) IID_##x
  211. #endif
  212. #endif // RC_INVOKED
  213. #define ATLAXWIN_CLASS "AtlAxWin7"
  214. #define ATLAXWINLIC_CLASS "AtlAxWinLic7"
  215. #endif // __ATLDEF_H__
  216. /////////////////////////////////////////////////////////////////////////////