Leaked source code of windows server 2003
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.

111 lines
2.5 KiB

  1. /***
  2. *typeinfo.h - Defines the type_info structure and exceptions used for RTTI
  3. *
  4. * Copyright (c) 1994-2001, Microsoft Corporation. All rights reserved.
  5. * Modified January 1996 by P.J. Plauger
  6. *
  7. *Purpose:
  8. * Defines the type_info structure and exceptions used for
  9. * Runtime Type Identification.
  10. *
  11. * [Public]
  12. *
  13. ****/
  14. #ifndef __cplusplus
  15. #error This header requires a C++ compiler ...
  16. #endif
  17. #ifndef _INC_TYPEINFO
  18. #define _INC_TYPEINFO
  19. #if !defined(_WIN32) && !defined(_MAC)
  20. #error ERROR: Only Mac or Win32 targets supported!
  21. #endif
  22. /* Define _CRTIMP */
  23. #ifndef _CRTIMP
  24. #ifdef _DLL
  25. #define _CRTIMP __declspec(dllimport)
  26. #else /* ndef _DLL */
  27. #define _CRTIMP
  28. #endif /* _DLL */
  29. #endif /* _CRTIMP */
  30. #include <xstddef>
  31. #ifdef _MSC_VER
  32. #pragma pack(push,8)
  33. #endif /* _MSC_VER */
  34. class type_info {
  35. public:
  36. _CRTIMP virtual ~type_info();
  37. _CRTIMP int operator==(const type_info& rhs) const;
  38. _CRTIMP int operator!=(const type_info& rhs) const;
  39. _CRTIMP int before(const type_info& rhs) const;
  40. _CRTIMP const char* name() const;
  41. _CRTIMP const char* raw_name() const;
  42. private:
  43. void *_m_data;
  44. char _m_d_name[1];
  45. type_info(const type_info& rhs);
  46. type_info& operator=(const type_info& rhs);
  47. };
  48. // This include must occur below the definition of class type_info
  49. #include <exception>
  50. _STD_BEGIN
  51. // CLASS bad_cast
  52. class _CRTIMP2 bad_cast : public exception {
  53. public:
  54. bad_cast(const char *_S = "bad cast") _THROW0()
  55. : exception(_S) {}
  56. virtual ~bad_cast() _THROW0()
  57. {}
  58. protected:
  59. virtual void _Doraise() const
  60. {_RAISE(*this); }
  61. };
  62. // CLASS bad_typeid
  63. class _CRTIMP2 bad_typeid : public exception {
  64. public:
  65. bad_typeid(const char *_S = "bad typeid") _THROW0()
  66. : exception(_S) {}
  67. virtual ~bad_typeid() _THROW0()
  68. {}
  69. protected:
  70. virtual void _Doraise() const
  71. {_RAISE(*this); }
  72. };
  73. class _CRTIMP2 __non_rtti_object : public bad_typeid {
  74. public:
  75. __non_rtti_object(const char * what_arg) : bad_typeid(what_arg) {}
  76. };
  77. using ::type_info;
  78. _STD_END
  79. using std::__non_rtti_object;
  80. #ifdef __RTTI_OLDNAMES
  81. // Some synonyms for folks using older standard
  82. typedef type_info Type_info;
  83. typedef bad_cast Bad_cast;
  84. typedef bad_typeid Bad_typeid;
  85. #endif // __RTTI_OLDNAMES
  86. #ifdef _MSC_VER
  87. #pragma pack(pop)
  88. #endif /* _MSC_VER */
  89. #endif // _INC_TYPEINFO
  90. /*
  91. * 1994-2000, Microsoft Corporation. All rights reserved.
  92. * Modified January 1996 by P.J. Plauger
  93. * Consult your license regarding permissions and restrictions.
  94. */