11
11
12
12
module core.stdcpp.typeinfo ;
13
13
14
- version (CRuntime_DigitalMars )
14
+ version (CppRuntime_DigitalMars )
15
15
{
16
16
import core.stdcpp.exception ;
17
17
18
- extern (C++ , std)
18
+ extern (C++ , " std" ):
19
+
20
+ class type_info
19
21
{
20
- class type_info
21
- {
22
- void * pdata;
23
-
24
- public :
25
- // virtual ~this();
26
- void dtor () { } // reserve slot in vtbl[]
27
-
28
- // bool operator==(const type_info rhs) const;
29
- // bool operator!=(const type_info rhs) const;
30
- final bool before (const type_info rhs) const ;
31
- final const (char )* name () const ;
32
- protected :
33
- // type_info();
34
- private :
35
- // this(const type_info rhs);
36
- // type_info operator=(const type_info rhs);
37
- }
22
+ void * pdata;
23
+
24
+ public :
25
+ // virtual ~this();
26
+ void dtor () { } // reserve slot in vtbl[]
27
+
28
+ // bool operator==(const type_info rhs) const;
29
+ // bool operator!=(const type_info rhs) const;
30
+ final bool before (const type_info rhs) const ;
31
+ final const (char )* name () const ;
32
+ protected :
33
+ // type_info();
34
+ private :
35
+ // this(const type_info rhs);
36
+ // type_info operator=(const type_info rhs);
37
+ }
38
38
39
- class bad_cast : core .stdcpp.exception.std. exception
40
- {
41
- this () nothrow { }
42
- this (const bad_cast) nothrow { }
43
- // bad_cast operator=(const bad_cast) nothrow { return this; }
44
- // virtual ~this() nothrow;
45
- override const (char )* what () const nothrow ;
46
- }
39
+ class bad_cast : exception
40
+ {
41
+ this () nothrow { }
42
+ this (const bad_cast) nothrow { }
43
+ // bad_cast operator=(const bad_cast) nothrow { return this; }
44
+ // virtual ~this() nothrow;
45
+ override const (char )* what () const nothrow ;
46
+ }
47
47
48
- class bad_typeid : core .stdcpp.exception.std.exception
49
- {
50
- this () nothrow { }
51
- this (const bad_typeid) nothrow { }
52
- // bad_typeid operator=(const bad_typeid) nothrow { return this; }
53
- // virtual ~this() nothrow;
54
- override const (char )* what() const nothrow ;
55
- }
48
+ class bad_typeid : exception
49
+ {
50
+ this () nothrow { }
51
+ this (const bad_typeid) nothrow { }
52
+ // bad_typeid operator=(const bad_typeid) nothrow { return this; }
53
+ // virtual ~this() nothrow;
54
+ override const (char )* what() const nothrow ;
56
55
}
57
56
}
58
- else version (CRuntime_Microsoft )
57
+ else version (CppRuntime_Microsoft )
59
58
{
60
59
import core.stdcpp.exception ;
61
60
61
+ extern (C++ , " std" ):
62
+
62
63
struct __type_info_node
63
64
{
64
65
void * _MemPtr;
@@ -67,82 +68,80 @@ else version (CRuntime_Microsoft)
67
68
68
69
extern __gshared __type_info_node __type_info_root_node;
69
70
70
- extern ( C++ , std)
71
+ class type_info
71
72
{
72
- class type_info
73
- {
74
- // virtual ~this();
75
- void dtor () { } // reserve slot in vtbl[]
76
- // bool operator==(const type_info rhs) const;
77
- // bool operator!=(const type_info rhs) const;
78
- final bool before (const type_info rhs) const ;
79
- final const (char )* name (__type_info_node* p = &__type_info_root_node) const ;
80
-
81
- private :
82
- void * pdata;
83
- char [1 ] _name;
84
- // type_info operator=(const type_info rhs);
85
- }
73
+ // virtual ~this();
74
+ void dtor () { } // reserve slot in vtbl[]
75
+ // bool operator==(const type_info rhs) const;
76
+ // bool operator!=(const type_info rhs) const;
77
+ final bool before (const type_info rhs) const ;
78
+ final const (char )* name (__type_info_node* p = &__type_info_root_node) const ;
79
+
80
+ private :
81
+ void * pdata;
82
+ char [1 ] _name;
83
+ // type_info operator=(const type_info rhs);
84
+ }
86
85
87
- class bad_cast : core .stdcpp.exception.std. exception
88
- {
89
- this (const (char )* msg = " bad cast" );
90
- // virtual ~this();
91
- }
86
+ class bad_cast : exception
87
+ {
88
+ this (const (char )* msg = " bad cast" );
89
+ // virtual ~this();
90
+ }
92
91
93
- class bad_typeid : core .stdcpp.exception.std.exception
94
- {
95
- this (const (char )* msg = " bad typeid" );
96
- // virtual ~this();
97
- }
92
+ class bad_typeid : exception
93
+ {
94
+ this (const (char )* msg = " bad typeid" );
95
+ // virtual ~this();
98
96
}
99
97
}
100
- else version (CRuntime_Glibc )
98
+ else version (CppRuntime_Gcc )
101
99
{
102
100
import core.stdcpp.exception ;
103
101
104
- extern (C++ , __cxxabiv1)
102
+ extern (C++ , " __cxxabiv1" )
105
103
{
106
104
class __class_type_info ;
107
105
}
108
106
109
- extern (C++ , std)
107
+ extern (C++ , " std" ):
108
+
109
+ class type_info
110
110
{
111
- class type_info
112
- {
113
- void dtor1 (); // consume destructor slot in vtbl[]
114
- void dtor2 (); // consume destructor slot in vtbl[]
115
- final const (char )* name ()() const nothrow {
116
- return _name[0 ] == ' *' ? _name + 1 : _name;
117
- }
118
- final bool before ()(const type_info _arg) const {
119
- import core.stdc.string : strcmp;
120
- return (_name[0 ] == ' *' && _arg._name[0 ] == ' *' )
121
- ? _name < _arg._name
122
- : strcmp(_name, _arg._name) < 0 ;
123
- }
124
- // bool operator==(const type_info) const;
125
- bool __is_pointer_p () const ;
126
- bool __is_function_p () const ;
127
- bool __do_catch (const type_info, void ** , uint ) const ;
128
- bool __do_upcast (const __cxxabiv1.__class_type_info, void ** ) const ;
129
-
130
- const (char )* _name;
131
- this (const (char )* );
111
+ void dtor1 (); // consume destructor slot in vtbl[]
112
+ void dtor2 (); // consume destructor slot in vtbl[]
113
+ final const (char )* name ()() const nothrow {
114
+ return _name[0 ] == ' *' ? _name + 1 : _name;
132
115
}
133
-
134
- class bad_cast : core .stdcpp.exception.std.exception
135
- {
136
- this ();
137
- // ~this();
138
- override const (char )* what () const ;
116
+ final bool before ()(const type_info _arg) const {
117
+ import core.stdc.string : strcmp;
118
+ return (_name[0 ] == ' *' && _arg._name[0 ] == ' *' )
119
+ ? _name < _arg._name
120
+ : strcmp(_name, _arg._name) < 0 ;
139
121
}
122
+ // bool operator==(const type_info) const;
123
+ bool __is_pointer_p () const ;
124
+ bool __is_function_p () const ;
125
+ bool __do_catch (const type_info, void ** , uint ) const ;
126
+ bool __do_upcast (const __class_type_info, void ** ) const ;
127
+
128
+ const (char )* _name;
129
+ this (const (char )* );
130
+ }
140
131
141
- class bad_typeid : core .stdcpp.exception.std.exception
142
- {
143
- this ();
144
- // ~this();
145
- override const (char )* what () const ;
146
- }
132
+ class bad_cast : exception
133
+ {
134
+ this ();
135
+ // ~this();
136
+ override const (char )* what () const ;
137
+ }
138
+
139
+ class bad_typeid : exception
140
+ {
141
+ this ();
142
+ // ~this();
143
+ override const (char )* what () const ;
147
144
}
148
145
}
146
+ else
147
+ static assert (0 , " Missing std::type_info binding for this platform" );
0 commit comments