2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
11 #include <Referenceable.h>
28 TYPE_POINTER_TO_MEMBER
32 enum compound_type_kind
{
36 COMPOUND_TYPE_INTERFACE
40 enum address_type_kind
{
42 DERIVED_TYPE_REFERENCE
46 enum template_type_kind
{
53 TYPE_MODIFIER_CONST
= 0x01,
54 TYPE_MODIFIER_VOLATILE
= 0x02,
55 TYPE_MODIFIER_RESTRICT
= 0x04,
56 TYPE_MODIFIER_PACKED
= 0x08,
57 TYPE_MODIFIER_SHARED
= 0x10
69 class BaseType
: public BReferenceable
{
73 virtual Type
* GetType() const = 0;
77 class DataMember
: public BReferenceable
{
79 virtual ~DataMember();
81 virtual const char* Name() const = 0;
82 virtual Type
* GetType() const = 0;
86 class EnumeratorValue
: public BReferenceable
{
88 virtual ~EnumeratorValue();
90 virtual const char* Name() const = 0;
91 virtual BVariant
Value() const = 0;
95 class ArrayDimension
: public BReferenceable
{
97 virtual ~ArrayDimension();
99 virtual Type
* GetType() const = 0;
100 // subrange or enumeration
101 virtual uint64
CountElements() const;
102 // returns 0, if unknown
106 class FunctionParameter
: public BReferenceable
{
108 virtual ~FunctionParameter();
110 virtual const char* Name() const = 0;
111 virtual Type
* GetType() const = 0;
115 class TemplateParameter
: public BReferenceable
{
117 virtual ~TemplateParameter();
119 virtual template_type_kind
Kind() const = 0;
120 virtual Type
* GetType() const = 0;
121 virtual BVariant
Value() const = 0;
125 class Type
: public BReferenceable
{
129 virtual image_id
ImageID() const = 0;
130 virtual const BString
& ID() const = 0;
131 virtual const BString
& Name() const = 0;
132 virtual type_kind
Kind() const = 0;
133 virtual target_size_t
ByteSize() const = 0;
134 virtual Type
* ResolveRawType(bool nextOneOnly
) const;
135 // strips modifiers and typedefs (only one,
139 virtual status_t
CreateDerivedAddressType(
140 address_type_kind kind
,
141 AddressType
*& _resultType
);
143 virtual status_t
CreateDerivedArrayType(
147 // if the current object is already
148 // an array type, attach an extra
149 // dimension to it rather than
150 // creating a new encapsulating
152 ArrayType
*& _resultType
);
155 virtual status_t
ResolveObjectDataLocation(
156 const ValueLocation
& objectLocation
,
157 ValueLocation
*& _location
) = 0;
158 // returns a reference
159 virtual status_t
ResolveObjectDataLocation(
160 target_addr_t objectAddress
,
161 ValueLocation
*& _location
) = 0;
162 // returns a reference
166 class PrimitiveType
: public virtual Type
{
168 virtual ~PrimitiveType();
170 virtual type_kind
Kind() const;
172 virtual uint32
TypeConstant() const = 0;
176 class CompoundType
: public virtual Type
{
178 virtual ~CompoundType();
180 virtual type_kind
Kind() const;
181 virtual compound_type_kind
CompoundKind() const = 0;
183 virtual int32
CountBaseTypes() const = 0;
184 virtual BaseType
* BaseTypeAt(int32 index
) const = 0;
186 virtual int32
CountDataMembers() const = 0;
187 virtual DataMember
* DataMemberAt(int32 index
) const = 0;
189 virtual int32
CountTemplateParameters() const = 0;
190 virtual TemplateParameter
* TemplateParameterAt(int32 index
) const = 0;
193 virtual status_t
ResolveBaseTypeLocation(BaseType
* baseType
,
194 const ValueLocation
& parentLocation
,
195 ValueLocation
*& _location
) = 0;
196 // returns a reference
197 virtual status_t
ResolveDataMemberLocation(DataMember
* member
,
198 const ValueLocation
& parentLocation
,
199 ValueLocation
*& _location
) = 0;
200 // returns a reference
204 class ModifiedType
: public virtual Type
{
206 virtual ~ModifiedType();
208 virtual type_kind
Kind() const;
210 virtual uint32
Modifiers() const = 0;
211 virtual Type
* BaseType() const = 0;
212 virtual Type
* ResolveRawType(bool nextOneOnly
) const;
216 class TypedefType
: public virtual Type
{
218 virtual ~TypedefType();
220 virtual type_kind
Kind() const;
222 virtual Type
* BaseType() const = 0;
223 virtual Type
* ResolveRawType(bool nextOneOnly
) const;
227 class AddressType
: public virtual Type
{
229 virtual ~AddressType();
231 virtual type_kind
Kind() const;
233 virtual address_type_kind
AddressKind() const = 0;
234 virtual Type
* BaseType() const = 0;
238 class EnumerationType
: public virtual Type
{
240 virtual ~EnumerationType();
242 virtual type_kind
Kind() const;
244 virtual Type
* BaseType() const = 0;
247 virtual int32
CountValues() const = 0;
248 virtual EnumeratorValue
* ValueAt(int32 index
) const = 0;
249 virtual EnumeratorValue
* ValueFor(const BVariant
& value
) const;
253 class SubrangeType
: public virtual Type
{
255 virtual ~SubrangeType();
257 virtual type_kind
Kind() const;
259 virtual Type
* BaseType() const = 0;
261 virtual BVariant
LowerBound() const = 0;
262 virtual BVariant
UpperBound() const = 0;
266 class ArrayType
: public virtual Type
{
268 virtual ~ArrayType();
270 virtual type_kind
Kind() const;
272 virtual Type
* BaseType() const = 0;
274 virtual int32
CountDimensions() const = 0;
275 virtual ArrayDimension
* DimensionAt(int32 index
) const = 0;
277 virtual status_t
ResolveElementLocation(
278 const ArrayIndexPath
& indexPath
,
279 const ValueLocation
& parentLocation
,
280 ValueLocation
*& _location
) = 0;
281 // returns a reference
285 class UnspecifiedType
: public virtual Type
{
287 virtual ~UnspecifiedType();
289 virtual type_kind
Kind() const;
293 class FunctionType
: public virtual Type
{
295 virtual ~FunctionType();
297 virtual type_kind
Kind() const;
299 virtual Type
* ReturnType() const = 0;
301 virtual int32
CountParameters() const = 0;
302 virtual FunctionParameter
* ParameterAt(int32 index
) const = 0;
304 virtual bool HasVariableArguments() const = 0;
308 class PointerToMemberType
: public virtual Type
{
310 virtual ~PointerToMemberType();
312 virtual type_kind
Kind() const;
314 virtual CompoundType
* ContainingType() const = 0;
315 virtual Type
* BaseType() const = 0;