SBType.h revision 0a19a1b9c25117854f226256805239d95153ed2d
1//===-- SBType.h ------------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLDB_SBType_h_
11#define LLDB_SBType_h_
12
13#include "lldb/API/SBDefines.h"
14
15namespace lldb {
16
17class SBTypeList;
18
19class SBTypeMember
20{
21public:
22    SBTypeMember ();
23
24    SBTypeMember (const lldb::SBTypeMember& rhs);
25
26    ~SBTypeMember();
27
28#ifndef SWIG
29    lldb::SBTypeMember&
30    operator = (const lldb::SBTypeMember& rhs);
31#endif
32
33    bool
34    IsValid() const;
35
36    const char *
37    GetName ();
38
39    lldb::SBType
40    GetType ();
41
42    uint64_t
43    GetOffsetInBytes();
44
45    uint64_t
46    GetOffsetInBits();
47
48    bool
49    GetDescription (lldb::SBStream &description,
50                    lldb::DescriptionLevel description_level);
51
52protected:
53    friend class SBType;
54
55#ifndef SWIG
56    void
57    reset (lldb_private::TypeMemberImpl *);
58
59    lldb_private::TypeMemberImpl &
60    ref ();
61
62    const lldb_private::TypeMemberImpl &
63    ref () const;
64#endif
65
66    std::auto_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
67};
68
69class SBType
70{
71public:
72
73    SBType();
74
75    SBType (const lldb::SBType &rhs);
76
77    ~SBType ();
78
79    bool
80    IsValid() const;
81
82    size_t
83    GetByteSize();
84
85    bool
86    IsPointerType();
87
88    bool
89    IsReferenceType();
90
91    lldb::SBType
92    GetPointerType();
93
94    lldb::SBType
95    GetPointeeType();
96
97    lldb::SBType
98    GetReferenceType();
99
100    lldb::SBType
101    GetDereferencedType();
102
103    lldb::SBType
104    GetUnqualifiedType();
105
106    lldb::SBType
107    GetBasicType(lldb::BasicType type);
108
109    uint32_t
110    GetNumberOfFields ();
111
112    uint32_t
113    GetNumberOfDirectBaseClasses ();
114
115    uint32_t
116    GetNumberOfVirtualBaseClasses ();
117
118    lldb::SBTypeMember
119    GetFieldAtIndex (uint32_t idx);
120
121    lldb::SBTypeMember
122    GetDirectBaseClassAtIndex (uint32_t idx);
123
124    lldb::SBTypeMember
125    GetVirtualBaseClassAtIndex (uint32_t idx);
126
127    uint32_t
128    GetNumberOfTemplateArguments ();
129
130    lldb::SBType
131    GetTemplateArgumentType (uint32_t idx);
132
133    lldb::TemplateArgumentKind
134    GetTemplateArgumentKind (uint32_t idx);
135
136    const char*
137    GetName();
138
139    lldb::TypeClass
140    GetTypeClass ();
141
142    // DEPRECATED: but needed for Xcode right now
143    static bool
144    IsPointerType (void * clang_type);
145
146    bool
147    GetDescription (lldb::SBStream &description,
148                    lldb::DescriptionLevel description_level);
149
150#ifndef SWIG
151    lldb::SBType &
152    operator = (const lldb::SBType &rhs);
153
154    bool
155    operator == (lldb::SBType &rhs);
156
157    bool
158    operator != (lldb::SBType &rhs);
159#endif
160
161protected:
162
163#ifndef SWIG
164    lldb_private::TypeImpl &
165    ref ();
166
167    const lldb_private::TypeImpl &
168    ref () const;
169
170    lldb::TypeImplSP
171    GetSP ();
172
173    void
174    SetSP (const lldb::TypeImplSP &type_impl_sp);
175#endif
176
177
178    lldb::TypeImplSP m_opaque_sp;
179
180    friend class SBModule;
181    friend class SBTarget;
182    friend class SBValue;
183    friend class SBTypeMember;
184    friend class SBTypeList;
185
186    SBType (const lldb_private::ClangASTType &);
187    SBType (const lldb::TypeSP &);
188    SBType (const lldb::TypeImplSP &);
189
190};
191
192class SBTypeList
193{
194public:
195    SBTypeList();
196
197    SBTypeList(const lldb::SBTypeList& rhs);
198
199    ~SBTypeList();
200
201    lldb::SBTypeList&
202    operator = (const lldb::SBTypeList& rhs);
203
204    bool
205    IsValid();
206
207    void
208    Append (lldb::SBType type);
209
210    lldb::SBType
211    GetTypeAtIndex (uint32_t index);
212
213    uint32_t
214    GetSize();
215
216
217private:
218    std::auto_ptr<lldb_private::TypeListImpl> m_opaque_ap;
219};
220
221
222} // namespace lldb
223
224#endif // LLDB_SBType_h_
225