STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
typeinfo.h
Go to the documentation of this file.
1 /***
2 *typeinfo.h - Defines the type_info structure and exceptions used for RTTI
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * Defines the type_info structure and exceptions used for
8 * Runtime Type Identification.
9 *
10 * [Public]
11 *
12 ****/
13 
14 #pragma once
15 
16 #include <crtdefs.h>
17 
18 #ifndef _INC_TYPEINFO
19 #define _INC_TYPEINFO
20 
21 #pragma pack(push,_CRT_PACKING)
22 
23 #ifndef RC_INVOKED
24 
25 #ifndef __cplusplus
26 #error This header requires a C++ compiler ...
27 #endif /* __cplusplus */
28 
29 #ifndef _SYSCRT
30 #include <typeinfo>
31 
32 #if !defined(_CRTBLD) || !defined(_TICORE)
33 
34 #ifdef __RTTI_OLDNAMES
35 /* Some synonyms for folks using older standard */
36 using std::bad_cast;
37 using std::bad_typeid;
38 
39 typedef type_info Type_info;
40 typedef bad_cast Bad_cast;
41 typedef bad_typeid Bad_typeid;
42 #endif /* __RTTI_OLDNAMES */
43 
44 #endif /* !defined(_CRTBLD) || !defined(_TICORE) */
45 
46 #else /* _SYSCRT */
47 
48 class type_info {
49 public:
50  SECURITYCRITICAL_ATTRIBUTE
51  _CRTIMP virtual __thiscall ~type_info();
52  _CRTIMP int __thiscall operator==(_In_ const type_info& _Rhs) const;
53  _CRTIMP int __thiscall operator!=(_In_ const type_info& _Rhs) const;
54  _CRTIMP bool __thiscall before(_In_ const type_info& _Rhs) const;
55 #ifdef _SYSCRT
56  _Check_return_ _CRTIMP const char* __thiscall name() const;
57 #else /* _SYSCRT */
58  _Check_return_ _CRTIMP const char* __thiscall name(_Inout_ __type_info_node* __ptype_info_node = &__type_info_root_node) const;
59 #endif /* _SYSCRT */
60  _Check_return_ _CRTIMP const char* __thiscall raw_name() const;
61 private:
62  void *_M_data;
63  char _M_d_name[1];
64  __thiscall type_info(_In_ const type_info& _Rhs);
65  type_info& __thiscall operator=(_In_ const type_info& _Rhs);
66 };
67 #ifndef _TICORE
68 
69 /* This include must occur below the definition of class type_info */
70 #include <stdexcpt.h>
71 
72 class _CRTIMP bad_cast : public std::exception {
73 public:
74  __CLR_OR_THIS_CALL bad_cast(_In_z_ const char * _Message = "bad cast");
75  __CLR_OR_THIS_CALL bad_cast(_In_ const bad_cast & _Bad_cast);
76  virtual __CLR_OR_THIS_CALL ~bad_cast();
77 
78 #ifdef CRTDLL
79 private:
80  /* This is aliased to public:bad_cast(const char * const &) to provide */
81  /* the old, non-conformant constructor. */
82  bad_cast(_In_z_ const char * const * _Message);
83 #endif /* CRTDLL */
84 };
85 
86 class _CRTIMP bad_typeid : public std::exception {
87 public:
88  bad_typeid(_In_z_ const char * _Message = "bad typeid");
89  bad_typeid(_In_ const bad_typeid &);
90  virtual ~bad_typeid();
91 };
92 
93 class _CRTIMP __non_rtti_object : public bad_typeid {
94 public:
95  __non_rtti_object(_In_z_ const char * _Message);
97  virtual ~__non_rtti_object();
98 };
99 
100 #ifdef __RTTI_OLDNAMES
101 /* Some synonyms for folks using older standard */
102 typedef type_info Type_info;
103 typedef bad_cast Bad_cast;
104 typedef bad_typeid Bad_typeid;
105 #endif /* __RTTI_OLDNAMES */
106 
107 #endif /* _TICORE */
108 
109 #endif /* _SYSCRT */
110 
111 #endif /* RC_INVOKED */
112 
113 #pragma pack(pop)
114 
115 #endif /* _INC_TYPEINFO */
Definition: typeinfo:37
#define _CRTIMP
Definition: crtdefs.h:23
void * _M_data
Definition: typeinfo:70
Definition: typeinfo:189
char _M_d_name[1]
Definition: typeinfo:71
#define _Check_return_
Definition: sal.h:563
_CRTIMP_PURE const char *__CLR_OR_THIS_CALL name(__type_info_node *__ptype_info_node=&__type_info_root_node) const
#define _In_z_
Definition: sal.h:319
#define _In_
Definition: sal.h:314
_CRTIMP_PURE bool __CLR_OR_THIS_CALL before(const type_info &_Rhs) const
__type_info_node __type_info_root_node
#define __CLR_OR_THIS_CALL
Definition: crtdefs.h:202
_CRTIMP_PURE bool __CLR_OR_THIS_CALL operator!=(const type_info &_Rhs) const
_CRTIMP_PURE const char *__CLR_OR_THIS_CALL raw_name() const
__CLR_OR_THIS_CALL type_info(const type_info &)=delete
Definition: typeinfo:210
Definition: typeinfo:230
virtual ~type_info() _NOEXCEPT
#define _Inout_
Definition: sal.h:384
_CRTIMP_PURE bool __CLR_OR_THIS_CALL operator==(const type_info &_Rhs) const
Definition: typeinfo:44
type_info &__CLR_OR_THIS_CALL operator=(const type_info &)=delete