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.

129 lines
2.9 KiB

  1. /***
  2. *oldexcpt.h - User include file for standard exception classes (old version)
  3. *
  4. * Copyright (c) 1994-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file presents an interface to the standard exception classes,
  8. * as specified by the ANSI X3J16/ISO SC22/WG21 Working Paper for
  9. * Draft C++, May 1994.
  10. *
  11. * [Public]
  12. *
  13. *Revision History:
  14. * 11-15-94 JWM Made logic & exception classes _CRTIMP
  15. * 11-21-94 JWM xmsg typedef now #ifdef __RTTI_OLDNAMES
  16. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers, protect with _INC_STDEXCPT.
  17. * 02-14-95 CFW Clean up Mac merge.
  18. * 02-15-95 JWM Minor cleanups related to Olympus bug 3716.
  19. * 07-02-95 JWM Now generally ANSI-compliant; excess baggage removed.
  20. * 12-14-95 JWM Add "#pragma once".
  21. * 03-04-96 JWM Replaced by C++ header "exception".
  22. * 01-05-99 GJF Changes for 64-bit size_t.
  23. * 05-17-99 PML Remove all Macintosh support.
  24. *
  25. ****/
  26. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  27. #pragma once
  28. #endif
  29. #ifndef _INC_STDEXCPT
  30. #define _INC_STDEXCPT
  31. #if !defined(_WIN32)
  32. #error ERROR: Only Win32 target supported!
  33. #endif
  34. #ifndef _CRTBLD
  35. /* This version of the header files is NOT for user programs.
  36. * It is intended for use when building the C runtimes ONLY.
  37. * The version intended for public use will not have this message.
  38. */
  39. #error ERROR: Use of C runtime library internal header file.
  40. #endif /* _CRTBLD */
  41. /**
  42. * #ifdef __cplusplus
  43. *
  44. * #include <exception>
  45. *
  46. * #elif 0
  47. **/
  48. #ifndef _CRTIMP
  49. #ifdef _NTSDK
  50. /* definition compatible with NT SDK */
  51. #define _CRTIMP
  52. #else /* ndef _NTSDK */
  53. /* current definition */
  54. #ifdef CRTDLL
  55. #define _CRTIMP __declspec(dllexport)
  56. #else /* ndef CRTDLL */
  57. #ifdef _DLL
  58. #define _CRTIMP __declspec(dllimport)
  59. #else /* ndef _DLL */
  60. #define _CRTIMP
  61. #endif /* _DLL */
  62. #endif /* CRTDLL */
  63. #endif /* _NTSDK */
  64. #endif /* _CRTIMP */
  65. #ifndef _SIZE_T_DEFINED
  66. #ifdef _WIN64
  67. typedef unsigned __int64 size_t;
  68. #else
  69. typedef unsigned int size_t;
  70. #endif
  71. #define _SIZE_T_DEFINED
  72. #endif
  73. //
  74. // Standard exception class heirarchy (ref. 1/94 WP 17.3.2.1, as ammended 3/94).
  75. //
  76. // exception (formerly xmsg)
  77. // logic
  78. // domain
  79. // runtime
  80. // range
  81. // alloc
  82. // xalloc
  83. //
  84. // Updated as per May'94 Working Paper
  85. typedef const char *__exString;
  86. class _CRTIMP exception
  87. {
  88. public:
  89. exception();
  90. exception(const __exString&);
  91. exception(const exception&);
  92. exception& operator= (const exception&);
  93. virtual ~exception();
  94. virtual __exString what() const;
  95. private:
  96. __exString _m_what;
  97. int _m_doFree;
  98. };
  99. #ifdef __RTTI_OLDNAMES
  100. typedef exception xmsg; // A synonym for folks using older standard
  101. #endif
  102. //
  103. // logic_error
  104. //
  105. class _CRTIMP logic_error: public exception
  106. {
  107. public:
  108. logic_error (const __exString& _what_arg) : exception(_what_arg) {}
  109. };
  110. /**
  111. * #endif /-* ndef __cplusplus *-/
  112. **/
  113. #endif /* _INC_STDEXCPT */