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