import of gcc-2.8
[official-gcc.git] / gcc / cp / tinfo.h
blob3df55a5c709c1dc32a397fdcb560809631e82608
1 // RTTI support internals for -*- C++ -*-
2 // Copyright (C) 1994, 1995, 1996 Free Software Foundation
4 #include "typeinfo"
6 // Class declarations shared between the typeinfo implementation files.
8 // type_info for a class with no base classes (or an enum).
10 struct __user_type_info : public type_info {
11 __user_type_info (const char *n) : type_info (n) {}
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;
19 // type_info for a class with one public, nonvirtual base class.
21 class __si_type_info : public __user_type_info {
22 const __user_type_info &base;
24 public:
25 __si_type_info (const char *n, const __user_type_info &b)
26 : __user_type_info (n), base (b) { }
28 virtual void *dcast (const type_info &, int, void *,
29 const type_info * = 0, void * = 0) const;
32 // type_info for a general class.
34 typedef unsigned int USItype __attribute__ ((mode (SI)));
36 struct __class_type_info : public __user_type_info {
37 enum access { PUBLIC = 1, PROTECTED = 2, PRIVATE = 3 };
39 struct base_info {
40 const __user_type_info *base;
41 USItype offset: 29;
42 bool is_virtual: 1;
43 access access: 2;
46 const base_info *base_list;
47 size_t n_bases;
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) {}
52 // This is a little complex.
53 virtual void* dcast (const type_info &, int, void *,
54 const type_info * = 0, void * = 0) const;