SBValue.h revision 968958c31c42224cfd5eb4ba0cf6fe0157ab375c
1//===-- SBValue.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_SBValue_h_
11#define LLDB_SBValue_h_
12
13#include "lldb/API/SBDefines.h"
14
15#include <stdio.h>
16
17namespace lldb {
18
19#ifdef SWIG
20%feature("docstring",
21         "Represents the value of a variable, a register, or an expression."
22         ) SBValue;
23#endif
24class SBValue
25{
26#ifdef SWIG
27    %feature("autodoc", "1");
28#endif
29public:
30    SBValue ();
31
32    SBValue (const SBValue &rhs);
33
34#ifndef SWIG
35    const SBValue &
36    operator =(const SBValue &rhs);
37#endif
38
39    ~SBValue ();
40
41    bool
42    IsValid() const;
43
44    SBError
45    GetError();
46
47    lldb::user_id_t
48    GetID ();
49
50    const char *
51    GetName();
52
53    const char *
54    GetTypeName ();
55
56    size_t
57    GetByteSize ();
58
59    bool
60    IsInScope (const lldb::SBFrame &frame);  // DEPRECATED - SBValues know their own frames.
61
62    bool
63    IsInScope ();
64
65    lldb::Format
66    GetFormat () const;
67
68    void
69    SetFormat (lldb::Format format);
70
71    const char *
72    GetValue (const lldb::SBFrame &frame);   // DEPRECATED - SBValues know their own frames.
73
74    const char *
75    GetValue ();
76
77    ValueType
78    GetValueType ();
79
80    bool
81    GetValueDidChange (const lldb::SBFrame &frame);  // DEPRECATED - SBValues know their own frames.
82
83    bool
84    GetValueDidChange ();
85
86    const char *
87    GetSummary (const lldb::SBFrame &frame);  // DEPRECATED - SBValues know their own frames.
88
89    const char *
90    GetSummary ();
91
92    const char *
93    GetObjectDescription (const lldb::SBFrame &frame);  // DEPRECATED - SBValues know their own frames.
94
95    const char *
96    GetObjectDescription ();
97
98    const char *
99    GetLocation (const lldb::SBFrame &frame);  // DEPRECATED - SBValues know their own frames.
100
101    const char *
102    GetLocation ();
103
104    bool
105    SetValueFromCString (const lldb::SBFrame &frame, const char *value_str);  // DEPRECATED - SBValues know their own frames.
106
107    bool
108    SetValueFromCString (const char *value_str);
109
110    lldb::SBValue
111    GetChildAtIndex (uint32_t idx);
112
113    lldb::SBValue
114    GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic);
115
116    // Matches children of this object only and will match base classes and
117    // member names if this is a clang typed object.
118    uint32_t
119    GetIndexOfChildWithName (const char *name);
120
121    // Matches child members of this object and child members of any base
122    // classes.
123    lldb::SBValue
124    GetChildMemberWithName (const char *name);
125
126    // Matches child members of this object and child members of any base
127    // classes.
128    lldb::SBValue
129    GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic);
130
131    uint32_t
132    GetNumChildren ();
133
134    void *
135    GetOpaqueType();
136
137
138    lldb::SBValue
139    Dereference ();
140
141    bool
142    TypeIsPointerType ();
143
144    bool
145    GetDescription (lldb::SBStream &description);
146
147    bool
148    GetExpressionPath (lldb::SBStream &description);
149
150    bool
151    GetExpressionPath (lldb::SBStream &description, bool qualify_cxx_base_classes);
152
153protected:
154    friend class SBValueList;
155    friend class SBFrame;
156
157    SBValue (const lldb::ValueObjectSP &value_sp);
158
159#ifndef SWIG
160
161    // Mimic shared pointer...
162    lldb_private::ValueObject *
163    get() const;
164
165    lldb_private::ValueObject *
166    operator->() const;
167
168    lldb::ValueObjectSP &
169    operator*();
170
171    const lldb::ValueObjectSP &
172    operator*() const;
173
174#endif
175
176private:
177    lldb::ValueObjectSP m_opaque_sp;
178};
179
180} // namespace lldb
181
182#endif  // LLDB_SBValue_h_
183