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.

84 lines
1.7 KiB

  1. /***
  2. *exception - Defines class exception and related functions
  3. *
  4. * Copyright (c) 1994-2001, 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 _EXCEPTION_
  15. #define _EXCEPTION_
  16. #include <xstddef>
  17. #include <eh.h>
  18. #ifdef _MSC_VER
  19. #pragma pack(push,8)
  20. #endif /* _MSC_VER */
  21. #if !defined(_WIN32) && !defined(_MAC)
  22. #error ERROR: Only Mac or Win32 targets supported!
  23. #endif
  24. #ifndef _CRTIMP
  25. #ifdef _DLL
  26. #define _CRTIMP __declspec(dllimport)
  27. #else /* ndef _DLL */
  28. #define _CRTIMP
  29. #endif /* _DLL */
  30. #endif /* _CRTIMP */
  31. typedef const char *__exString;
  32. class _CRTIMP exception
  33. {
  34. public:
  35. exception();
  36. exception(const __exString&);
  37. exception(const exception&);
  38. exception& operator= (const exception&);
  39. virtual ~exception();
  40. virtual __exString what() const;
  41. private:
  42. __exString _m_what;
  43. int _m_doFree;
  44. };
  45. _STD_BEGIN
  46. using ::exception;
  47. // CLASS bad_exception
  48. class _CRTIMP2 bad_exception : public exception {
  49. public:
  50. bad_exception(const char *_S = "bad exception") _THROW0()
  51. : exception(_S) {}
  52. virtual ~bad_exception() _THROW0()
  53. {}
  54. protected:
  55. virtual void _Doraise() const
  56. {_RAISE(*this); }
  57. };
  58. _CRTIMP2 bool __cdecl uncaught_exception();
  59. _STD_END
  60. #ifdef __RTTI_OLDNAMES
  61. typedef exception xmsg; // A synonym for folks using older standard
  62. #endif
  63. #ifdef _MSC_VER
  64. #pragma pack(pop)
  65. #endif /* _MSC_VER */
  66. #endif /* _EXCEPTION_ */
  67. /*
  68. * 1994-2000, Microsoft Corporation. All rights reserved.
  69. * Modified January 1996 by P.J. Plauger
  70. * Consult your license regarding permissions and restrictions.
  71. */