SBValue.h revision 98f930f429160f9777f626c3ac6aa609f4e965d2
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
19class SBValue
20{
21public:
22    SBValue ();
23
24    ~SBValue ();
25
26    bool
27    IsValid() const;
28
29    const char *
30    GetName();
31
32    const char *
33    GetTypeName ();
34
35    size_t
36    GetByteSize ();
37
38    bool
39    IsInScope (const lldb::SBFrame &frame);
40
41    const char *
42    GetValue (const lldb::SBFrame &frame);
43
44    bool
45    GetValueDidChange (const lldb::SBFrame &frame);
46
47    const char *
48    GetSummary (const lldb::SBFrame &frame);
49
50    const char *
51    GetObjectDescription (const lldb::SBFrame &frame);
52
53    const char *
54    GetLocation (const lldb::SBFrame &frame);
55
56    bool
57    SetValueFromCString (const lldb::SBFrame &frame, const char *value_str);
58
59    lldb::SBValue
60    GetChildAtIndex (uint32_t idx);
61
62    // Matches children of this object only and will match base classes and
63    // member names if this is a clang typed object.
64    uint32_t
65    GetIndexOfChildWithName (const char *name);
66
67    // Matches child members of this object and child members of any base
68    // classes.
69    lldb::SBValue
70    GetChildMemberWithName (const char *name);
71
72    uint32_t
73    GetNumChildren ();
74
75    bool
76    ValueIsStale ();
77
78    void *
79    GetOpaqueType();
80
81
82    lldb::SBValue
83    Dereference ();
84
85    bool
86    TypeIsPtrType ();
87
88    bool
89    GetDescription (lldb::SBStream &description);
90
91    // The following function gets called by Python when a user tries to print
92    // an object of this class.  It take no arguments and returns a
93    // PyObject * representing a char * (and it must be named "__repr__");
94
95    PyObject *
96    __repr__ ();
97
98protected:
99    friend class SBValueList;
100    friend class SBFrame;
101
102    SBValue (const lldb::ValueObjectSP &value_sp);
103
104#ifndef SWIG
105
106    // Mimic shared pointer...
107    lldb_private::ValueObject *
108    get() const;
109
110    lldb_private::ValueObject *
111    operator->() const;
112
113    lldb::ValueObjectSP &
114    operator*();
115
116    const lldb::ValueObjectSP &
117    operator*() const;
118
119#endif
120
121private:
122    lldb::ValueObjectSP m_opaque_sp;
123};
124
125} // namespace lldb
126
127#endif  // LLDB_SBValue_h_
128