Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / gcc / cp / tinfo.h
1 // RTTI support internals for -*- C++ -*-
2 // Copyright (C) 1994, 1995, 1996, 1998 Free Software Foundation
3
4 #include "typeinfo"
5
6 // Class declarations shared between the typeinfo implementation files.
7
8 // type_info for a class with no base classes (or an enum).
9
10 struct __user_type_info : public std::type_info {
11   __user_type_info (const char *n) : type_info (n) {}
12
13   // If our type can be converted to the desired type, 
14   // return the pointer, adjusted accordingly; else return 0.
15   virtual void* dcast (const type_info &, int, void *,
16                        const type_info * = 0, void * = 0) const;
17 };
18
19 // type_info for a class with one public, nonvirtual base class.
20
21 class __si_type_info : public __user_type_info {
22   const __user_type_info &base;
23
24 public:
25   __si_type_info (const char *n, const __user_type_info &b)
26     : __user_type_info (n), base (b) { }
27
28   virtual void *dcast (const type_info &, int, void *,
29                        const type_info * = 0, void * = 0) const;
30 };
31
32 // type_info for a general class.
33
34 typedef unsigned int USItype    __attribute__ ((mode (SI)));
35
36 struct __class_type_info : public __user_type_info {
37   enum access { PUBLIC = 1, PROTECTED = 2, PRIVATE = 3 };
38
39   struct base_info {
40     const __user_type_info *base;
41     USItype offset: 29;
42     bool is_virtual: 1;
43     enum access access: 2;
44   };
45
46   const base_info *base_list;
47   size_t n_bases;
48
49   __class_type_info (const char *name, const base_info *bl, size_t bn)
50     : __user_type_info (name), base_list (bl), n_bases (bn) {}
51
52   // This is a little complex.
53   virtual void* dcast (const type_info &, int, void *,
54                        const type_info * = 0, void * = 0) const;
55 };