tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / bridges / source / cpp_uno / gcc3_ios / rtti.h
blob88413ea27a18aedfb4033aa00455b0f8a9241fee
1 // Copyright (C) 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
2 //
3 // This file is part of GCC.
4 //
5 // GCC is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2, or (at your option)
8 // any later version.
9 // GCC is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with GCC; see the file COPYING. If not, write to
15 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
16 // Boston, MA 02110-1301, USA.
18 // As a special exception, you may use this file as part of a free software
19 // library without restriction. Specifically, if other files instantiate
20 // templates or use macros or inline functions from this file, or you compile
21 // this file and link it with other files to produce an executable, this
22 // file does not by itself cause the resulting executable to be covered by
23 // the GNU General Public License. This exception does not however
24 // invalidate any other reasons why the executable file might be covered by
25 // the GNU General Public License.
27 // Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com>
29 #pragma once
31 #include <typeinfo>
33 namespace __cxxabiv1
35 // Type information for int, float etc.
36 class __fundamental_type_info : public std::type_info
38 public:
39 explicit
40 __fundamental_type_info(const char* __n) : std::type_info(__n) { }
42 virtual
43 ~__fundamental_type_info();
46 // Type information for array objects.
47 class __array_type_info : public std::type_info
49 public:
50 explicit
51 __array_type_info(const char* __n) : std::type_info(__n) { }
53 virtual
54 ~__array_type_info();
57 // Type information for functions (both member and non-member).
58 class __function_type_info : public std::type_info
60 public:
61 explicit
62 __function_type_info(const char* __n) : std::type_info(__n) { }
64 virtual
65 ~__function_type_info();
67 protected:
68 // Implementation defined member function.
69 virtual bool
70 __is_function_p() const;
73 // Type information for enumerations.
74 class __enum_type_info : public std::type_info
76 public:
77 explicit
78 __enum_type_info(const char* __n) : std::type_info(__n) { }
80 virtual
81 ~__enum_type_info();
84 // Common type information for simple pointers and pointers to member.
85 class __pbase_type_info : public std::type_info
87 public:
88 unsigned int __flags; // Qualification of the target object.
89 const std::type_info* __pointee; // Type of pointed to object.
91 explicit
92 __pbase_type_info(const char* __n, int __quals,
93 const std::type_info* __type)
94 : std::type_info(__n), __flags(__quals), __pointee(__type)
95 { }
97 virtual
98 ~__pbase_type_info();
100 // Implementation defined type.
101 enum __masks
103 __const_mask = 0x1,
104 __volatile_mask = 0x2,
105 __restrict_mask = 0x4,
106 __incomplete_mask = 0x8,
107 __incomplete_class_mask = 0x10
110 protected:
111 __pbase_type_info(const __pbase_type_info&);
113 __pbase_type_info&
114 operator=(const __pbase_type_info&);
116 // Implementation defined member functions.
117 virtual bool
118 __do_catch(const std::type_info* __thr_type, void** __thr_obj,
119 unsigned int __outer) const;
121 inline virtual bool
122 __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
123 unsigned __outer) const;
126 // Type information for simple pointers.
127 class __pointer_type_info : public __pbase_type_info
129 public:
130 explicit
131 __pointer_type_info(const char* __n, int __quals,
132 const std::type_info* __type)
133 : __pbase_type_info (__n, __quals, __type) { }
136 virtual
137 ~__pointer_type_info();
139 protected:
140 // Implementation defined member functions.
141 virtual bool
142 __is_pointer_p() const;
144 virtual bool
145 __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
146 unsigned __outer) const;
149 class __class_type_info;
151 // Type information for a pointer to member variable.
152 class __pointer_to_member_type_info : public __pbase_type_info
154 public:
155 __class_type_info* __context; // Class of the member.
157 explicit
158 __pointer_to_member_type_info(const char* __n, int __quals,
159 const std::type_info* __type,
160 __class_type_info* __klass)
161 : __pbase_type_info(__n, __quals, __type), __context(__klass) { }
163 virtual
164 ~__pointer_to_member_type_info();
166 protected:
167 __pointer_to_member_type_info(const __pointer_to_member_type_info&);
169 __pointer_to_member_type_info&
170 operator=(const __pointer_to_member_type_info&);
172 // Implementation defined member function.
173 virtual bool
174 __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
175 unsigned __outer) const;
178 // Helper class for __vmi_class_type.
179 class __base_class_type_info
181 public:
182 const __class_type_info* __base_type; // Base class type.
183 long __offset_flags; // Offset and info.
185 enum __offset_flags_masks
187 __virtual_mask = 0x1,
188 __public_mask = 0x2,
189 __hwm_bit = 2,
190 __offset_shift = 8 // Bits to shift offset.
193 // Implementation defined member functions.
194 bool
195 __is_virtual_p() const
196 { return __offset_flags & __virtual_mask; }
198 bool
199 __is_public_p() const
200 { return __offset_flags & __public_mask; }
202 ptrdiff_t
203 __offset() const
205 // This shift, being of a signed type, is implementation
206 // defined. GCC implements such shifts as arithmetic, which is
207 // what we want.
208 return static_cast<ptrdiff_t>(__offset_flags) >> __offset_shift;
212 // Type information for a class.
213 class __class_type_info : public std::type_info
215 public:
216 explicit
217 __class_type_info (const char *__n) : type_info(__n) { }
219 virtual
220 ~__class_type_info ();
222 // Implementation defined types.
223 // The type sub_kind tells us about how a base object is contained
224 // within a derived object. We often do this lazily, hence the
225 // UNKNOWN value. At other times we may use NOT_CONTAINED to mean
226 // not publicly contained.
227 enum __sub_kind
229 // We have no idea.
230 __unknown = 0,
232 // Not contained within us (in some circumstances this might
233 // mean not contained publicly)
234 __not_contained,
236 // Contained ambiguously.
237 __contained_ambig,
239 // Via a virtual path.
240 __contained_virtual_mask = __base_class_type_info::__virtual_mask,
242 // Via a public path.
243 __contained_public_mask = __base_class_type_info::__public_mask,
245 // Contained within us.
246 __contained_mask = 1 << __base_class_type_info::__hwm_bit,
248 __contained_private = __contained_mask,
249 __contained_public = __contained_mask | __contained_public_mask
252 struct __upcast_result;
253 struct __dyncast_result;
255 protected:
256 // Implementation defined member functions.
257 virtual bool
258 __do_upcast(const __class_type_info* __dst_type, void**__obj_ptr) const;
260 virtual bool
261 __do_catch(const type_info* __thr_type, void** __thr_obj,
262 unsigned __outer) const;
264 public:
265 // Helper for upcast. See if DST is us, or one of our bases.
266 // Return false if not found, true if found.
267 virtual bool
268 __do_upcast(const __class_type_info* __dst, const void* __obj,
269 __upcast_result& __restrict __result) const;
271 // Indicate whether SRC_PTR of type SRC_TYPE is contained publicly
272 // within OBJ_PTR. OBJ_PTR points to a base object of our type,
273 // which is the destination type. SRC2DST indicates how SRC
274 // objects might be contained within this type. If SRC_PTR is one
275 // of our SRC_TYPE bases, indicate the virtuality. Returns
276 // not_contained for non containment or private containment.
277 inline __sub_kind
278 __find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
279 const __class_type_info* __src_type,
280 const void* __src_ptr) const;
282 // Helper for dynamic cast. ACCESS_PATH gives the access from the
283 // most derived object to this base. DST_TYPE indicates the
284 // desired type we want. OBJ_PTR points to a base of our type
285 // within the complete object. SRC_TYPE indicates the static type
286 // started from and SRC_PTR points to that base within the most
287 // derived object. Fill in RESULT with what we find. Return true
288 // if we have located an ambiguous match.
289 virtual bool
290 __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
291 const __class_type_info* __dst_type, const void* __obj_ptr,
292 const __class_type_info* __src_type, const void* __src_ptr,
293 __dyncast_result& __result) const;
295 // Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE
296 // bases are inherited by the type started from -- which is not
297 // necessarily the current type. The current type will be a base
298 // of the destination type. OBJ_PTR points to the current base.
299 virtual __sub_kind
300 __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
301 const __class_type_info* __src_type,
302 const void* __src_ptr) const;
305 // Type information for a class with a single non-virtual base.
306 class __si_class_type_info : public __class_type_info
308 public:
309 const __class_type_info* __base_type;
311 explicit
312 __si_class_type_info(const char *__n, const __class_type_info *__base)
313 : __class_type_info(__n), __base_type(__base) { }
315 virtual
316 ~__si_class_type_info();
318 protected:
319 __si_class_type_info(const __si_class_type_info&);
321 __si_class_type_info&
322 operator=(const __si_class_type_info&);
324 // Implementation defined member functions.
325 virtual bool
326 __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
327 const __class_type_info* __dst_type, const void* __obj_ptr,
328 const __class_type_info* __src_type, const void* __src_ptr,
329 __dyncast_result& __result) const;
331 virtual __sub_kind
332 __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
333 const __class_type_info* __src_type,
334 const void* __sub_ptr) const;
336 virtual bool
337 __do_upcast(const __class_type_info*__dst, const void*__obj,
338 __upcast_result& __restrict __result) const;
341 // Type information for a class with multiple and/or virtual bases.
342 class __vmi_class_type_info : public __class_type_info
344 public:
345 unsigned int __flags; // Details about the class hierarchy.
346 unsigned int __base_count; // Number of direct bases.
348 // The array of bases uses the trailing array struct hack so this
349 // class is not constructable with a normal constructor. It is
350 // internally generated by the compiler.
351 __base_class_type_info __base_info[1]; // Array of bases.
353 explicit
354 __vmi_class_type_info(const char* __n, int ___flags)
355 : __class_type_info(__n), __flags(___flags), __base_count(0) { }
357 virtual
358 ~__vmi_class_type_info();
360 // Implementation defined types.
361 enum __flags_masks
363 __non_diamond_repeat_mask = 0x1, // Distinct instance of repeated base.
364 __diamond_shaped_mask = 0x2, // Diamond shaped multiple inheritance.
365 __flags_unknown_mask = 0x10
368 protected:
369 // Implementation defined member functions.
370 virtual bool
371 __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
372 const __class_type_info* __dst_type, const void* __obj_ptr,
373 const __class_type_info* __src_type, const void* __src_ptr,
374 __dyncast_result& __result) const;
376 virtual __sub_kind
377 __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
378 const __class_type_info* __src_type,
379 const void* __src_ptr) const;
381 virtual bool
382 __do_upcast(const __class_type_info* __dst, const void* __obj,
383 __upcast_result& __restrict __result) const;
386 // Dynamic cast runtime.
387 // src2dst has the following possible values
388 // >-1: src_type is a unique public non-virtual base of dst_type
389 // dst_ptr + src2dst == src_ptr
390 // -1: unspecified relationship
391 // -2: src_type is not a public base of dst_type
392 // -3: src_type is a multiple public non-virtual base of dst_type
393 extern "C" void*
394 __dynamic_cast(const void* __src_ptr, // Starting object.
395 const __class_type_info* __src_type, // Static type of object.
396 const __class_type_info* __dst_type, // Desired target type.
397 ptrdiff_t __src2dst); // How src and dst are related.
400 // Returns the type_info for the currently handled exception [15.3/8], or
401 // null if there is none.
402 extern "C" std::type_info*
403 __cxa_current_exception_type();
404 } // namespace __cxxabiv1
406 // User programs should use the alias `abi'.
407 namespace abi = __cxxabiv1;