home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / stdexcpt.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  2KB  |  92 lines

  1. /***
  2. *stdexcpt.h - User include file for standard exception classes
  3. *
  4. *       Copyright (c) 1994-1997, 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.  
  15. #if     _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18.  
  19. #ifndef _INC_STDEXCPT
  20. #define _INC_STDEXCPT
  21.  
  22. #if     !defined(_WIN32) && !defined(_MAC)
  23. #error ERROR: Only Mac or Win32 targets supported!
  24. #endif
  25.  
  26.  
  27. #ifdef  __cplusplus
  28.  
  29. #include <exception>
  30.  
  31. #elif 0
  32.  
  33. #ifndef _CRTIMP
  34. #ifdef  _DLL
  35. #define _CRTIMP __declspec(dllimport)
  36. #else   /* ndef _DLL */
  37. #define _CRTIMP
  38. #endif  /* _DLL */
  39. #endif  /* _CRTIMP */
  40.  
  41. #ifndef _SIZE_T_DEFINED
  42. typedef unsigned int size_t;
  43. #define _SIZE_T_DEFINED
  44. #endif
  45.  
  46.  
  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.  
  60. typedef const char *__exString;
  61.  
  62. class _CRTIMP exception
  63. {
  64. public:
  65.     exception();
  66.     exception(const __exString&);
  67.     exception(const exception&);
  68.     exception& operator= (const exception&);
  69.     virtual ~exception();
  70.     virtual __exString what() const;
  71. private:
  72.     __exString _m_what;
  73.     int _m_doFree;
  74. };
  75.  
  76. #ifdef  __RTTI_OLDNAMES
  77. typedef exception xmsg;        // A synonym for folks using older standard
  78. #endif
  79.  
  80. //
  81. //  logic_error
  82. //
  83. class _CRTIMP logic_error: public exception 
  84. {
  85. public:
  86.     logic_error (const __exString& _what_arg) : exception(_what_arg) {}
  87. };
  88.  
  89. #endif  /* ndef __cplusplus */
  90. #endif  /* _INC_STDEXCPT */
  91.  
  92.