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.

103 lines
1.9 KiB

  1. /***
  2. *stdexcpt.h - User include file for standard exception classes
  3. *
  4. * Copyright (c) 1994-2000, 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. ****/
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifndef _INC_STDEXCPT
  18. #define _INC_STDEXCPT
  19. #if !defined(_WIN32)
  20. #error ERROR: Only Win32 target supported!
  21. #endif
  22. #ifdef __cplusplus
  23. #include <exception>
  24. #elif 0
  25. #ifndef _CRTIMP
  26. #ifdef _DLL
  27. #define _CRTIMP __declspec(dllimport)
  28. #else /* ndef _DLL */
  29. #define _CRTIMP
  30. #endif /* _DLL */
  31. #endif /* _CRTIMP */
  32. #if !defined(_W64)
  33. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
  34. #define _W64 __w64
  35. #else
  36. #define _W64
  37. #endif
  38. #endif
  39. #ifndef _SIZE_T_DEFINED
  40. #ifdef _WIN64
  41. typedef unsigned __int64 size_t;
  42. #else
  43. typedef _W64 unsigned int size_t;
  44. #endif
  45. #define _SIZE_T_DEFINED
  46. #endif
  47. //
  48. // Standard exception class heirarchy (ref. 1/94 WP 17.3.2.1, as ammended 3/94).
  49. //
  50. // exception (formerly xmsg)
  51. // logic
  52. // domain
  53. // runtime
  54. // range
  55. // alloc
  56. // xalloc
  57. //
  58. // Updated as per May'94 Working Paper
  59. typedef const char *__exString;
  60. class _CRTIMP exception
  61. {
  62. public:
  63. exception();
  64. exception(const __exString&);
  65. exception(const exception&);
  66. exception& operator= (const exception&);
  67. virtual ~exception();
  68. virtual __exString what() const;
  69. private:
  70. __exString _m_what;
  71. int _m_doFree;
  72. };
  73. #ifdef __RTTI_OLDNAMES
  74. typedef exception xmsg; // A synonym for folks using older standard
  75. #endif
  76. //
  77. // logic_error
  78. //
  79. class _CRTIMP logic_error: public exception
  80. {
  81. public:
  82. logic_error (const __exString& _what_arg) : exception(_what_arg) {}
  83. };
  84. #endif /* ndef __cplusplus */
  85. #endif /* _INC_STDEXCPT */