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.

102 lines
1.9 KiB

  1. /***
  2. *exception - Defines class exception and related functions
  3. *
  4. * Copyright (c) 1994-1997, Microsoft Corporation. All rights reserved.
  5. * Modified January 1996 by P.J. Plauger
  6. *
  7. *Purpose:
  8. * Defines class exception (and derived class bad_exception)
  9. * plus new and unexpected handler functions.
  10. *
  11. * [Public]
  12. *
  13. ****/
  14. #ifndef _STLEXCEP_H_
  15. #define _STLEXCEP_H_
  16. //#include <xstddef>
  17. //#include <eh.h>
  18. #include <stlxstdd.h>
  19. #ifdef _MSC_VER
  20. #pragma pack(push,8)
  21. #endif /* _MSC_VER */
  22. #if !defined(_WIN32) && !defined(_MAC)
  23. #error ERROR: Only Mac or Win32 targets supported!
  24. #endif
  25. /*
  26. #ifndef _CRTIMP
  27. #ifdef _NTSDK
  28. // definition compatible with NT SDK
  29. #define _CRTIMP
  30. #else // ndef _NTSDK
  31. // current definition
  32. #ifdef _DLL
  33. #define _CRTIMP __declspec(dllimport)
  34. #else // ndef _DLL
  35. #define _CRTIMP
  36. #endif // _DLL
  37. #endif // _NTSDK
  38. #endif // _CRTIMP
  39. */
  40. typedef const char *__exString;
  41. class /*_CRTIMP*/ exception
  42. {
  43. public:
  44. exception();
  45. exception(const __exString&);
  46. exception(const exception&);
  47. exception& operator= (const exception&);
  48. virtual ~exception();
  49. virtual __exString what() const;
  50. private:
  51. __exString _m_what;
  52. int _m_doFree;
  53. };
  54. _STD_BEGIN
  55. using ::exception;
  56. // CLASS bad_exception
  57. class /*_CRTIMP*/ bad_exception : public exception
  58. {
  59. public:
  60. bad_exception(const char *_S = "bad exception") _THROW0()
  61. : exception(_S)
  62. {
  63. }
  64. virtual ~bad_exception() _THROW0()
  65. {
  66. }
  67. protected:
  68. virtual void _Doraise() const
  69. {
  70. _RAISE(*this);
  71. }
  72. };
  73. /*_CRTIMP*/
  74. bool __cdecl uncaught_exception();
  75. _STD_END
  76. #ifdef __RTTI_OLDNAMES
  77. typedef exception xmsg; // A synonym for folks using older standard
  78. #endif
  79. #ifdef _MSC_VER
  80. #pragma pack(pop)
  81. #endif /* _MSC_VER */
  82. #endif /* _STLEXCEP_H_ */
  83. /*
  84. * 1994-1995, Microsoft Corporation. All rights reserved.
  85. * Modified January 1996 by P.J. Plauger
  86. * Consult your license regarding permissions and restrictions.
  87. */