usb: getting string descriptors, minor improvements
[quarnos.git] / manes / typeinfo
blobc9ab7fca4a96d1e32a926f06ba5b302c4adcfb85
1 /* -*- C++ -*- */
2 /* Quarn OS
3  *
4  * Typeinfo
5  *
6  * Copyright (C) 2008-2009 Pawel Dziepak
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  */
24 #ifndef _TYPEINFO
25 #define _TYPEINFO
27 int strcmp(const char*, const char*);
29 namespace __cxxabiv1 {
30         class __class_type_info;
33 namespace std {
34         class type_info {
35         public:
36                 virtual ~type_info();
37                 bool operator==(const type_info &x) const {
38                         if (!strcmp(__type_name, x.__type_name))
39                                 return true;
40                         else
41                                 return false;
42                 }
44                 bool operator!=(const type_info &) const;
45                 bool before(const type_info &) const;
46                 const char *name() const { return __type_name; }
48                 virtual bool __is_pointer_p() const;
49                 virtual bool __is_function_p() const;
50                 virtual bool __do_catch(const type_info *, void **, unsigned int) const;
51                 virtual bool __do_upcast(const __cxxabiv1::__class_type_info *, void **) const;
53         protected:
54                 const char *__type_name;
55                 explicit type_info(const char* name) : __type_name(name) {}
57         private:
58                 type_info(const type_info &rhs);
59                 type_info &operator=(const type_info &rhs);
60         };
63 namespace __cxxabiv1 {
64         class __fundamental_type_info : public std::type_info {
65         public:
66                 virtual ~__fundamental_type_info();
67         };
69         class __array_type_info : public std::type_info {};
71         class __function_type_info : public std::type_info {};
73         class __enum_type_info : public std::type_info {};
75         class __class_type_info : public std::type_info {
76         public:
77                 virtual ~__class_type_info();
79                 virtual bool __do_upcast(const __cxxabiv1::__class_type_info *info, void **) const;
80         };
82         class __si_class_type_info : public __class_type_info {
83         public:
84                 const __class_type_info *__base_type;
86                 virtual ~__si_class_type_info();
88                 virtual bool __do_upcast(const __cxxabiv1::__class_type_info *info, void **) const;
89         };
91         class __pbase_type_info : public std::type_info {
92         public:
93                 unsigned int __flags;
94                 const std::type_info *__pointee;
96                 enum __masks {
97                         __const_mask = 0x01,
98                         __volatile_mask = 0x02,
99                         __restrict_mask = 0x04,
100                         __incomplete_mask = 0x08,
101                         __incomplete_class_mask = 0x10
102                 };
104                 virtual ~__pbase_type_info();
106                 virtual bool __do_upcast(const __cxxabiv1::__class_type_info *info, void **) const;
107                 virtual bool __is_pointer_p() const;
108         };
110         class __pointer_type_info : public __pbase_type_info {
111         public:
112                 virtual ~__pointer_type_info();
113         };
115         struct __base_class_type_info {
116                 const __class_type_info *__base_type;
117                 long __offset_flags;
119                 enum __offset_flags_masks {
120                         __virtual_mask = 0x1,
121                         __public_mask = 0x2,
122                         __offset_shift = 8
123                 };
124         };
127         class __vmi_class_type_info : public __class_type_info {
128         public:
129                 unsigned int __flags;
130                 unsigned int __base_count;
131                 __base_class_type_info __base_info[1];
133                 enum __flags_masks {
134                         __non_diamond_repeat_mask = 0x1,
135                         __diamond_shaped_mask = 0x2
136                 };
138                 virtual ~__vmi_class_type_info();
140                 virtual bool __do_upcast(const __cxxabiv1::__class_type_info *info, void **) const;
141         };
144 #endif