ValueObjectChild.h revision dc0a38c5a727cae5362b218a3180d0f4265a619d
1//===-- ValueObjectChild.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 liblldb_ValueObjectChild_h_
11#define liblldb_ValueObjectChild_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/Core/ValueObject.h"
18
19namespace lldb_private {
20
21//----------------------------------------------------------------------
22// A child of another ValueObject.
23//----------------------------------------------------------------------
24class ValueObjectChild : public ValueObject
25{
26public:
27    virtual ~ValueObjectChild();
28
29    virtual size_t
30    GetByteSize()
31    {
32        return m_byte_size;
33    }
34
35    virtual off_t
36    GetByteOffset()
37    {
38        return m_byte_offset;
39    }
40
41    virtual uint32_t
42    GetBitfieldBitSize()
43    {
44        return m_bitfield_bit_size;
45    }
46
47    virtual uint32_t
48    GetBitfieldBitOffset()
49    {
50        return m_bitfield_bit_offset;
51    }
52
53    virtual lldb::ValueType
54    GetValueType() const;
55
56    virtual uint32_t
57    CalculateNumChildren();
58
59    virtual ConstString
60    GetTypeName();
61
62    virtual ConstString
63    GetQualifiedTypeName();
64
65    virtual bool
66    IsInScope ();
67
68    virtual bool
69    IsBaseClass ()
70    {
71        return m_is_base_class;
72    }
73
74    virtual bool
75    IsDereferenceOfParent ()
76    {
77        return m_is_deref_of_parent;
78    }
79
80protected:
81    virtual bool
82    UpdateValue ();
83
84    virtual clang::ASTContext *
85    GetClangASTImpl ()
86    {
87        return m_clang_ast;
88    }
89
90    virtual lldb::clang_type_t
91    GetClangTypeImpl ()
92    {
93        return m_clang_type;
94    }
95
96    clang::ASTContext *m_clang_ast; // The clang AST that the clang type comes from
97    void *m_clang_type; // The type of the child in question within the parent (m_parent_sp)
98    ConstString m_type_name;
99    uint32_t m_byte_size;
100    int32_t m_byte_offset;
101    uint8_t m_bitfield_bit_size;
102    uint8_t m_bitfield_bit_offset;
103    bool m_is_base_class;
104    bool m_is_deref_of_parent;
105
106//
107//  void
108//  ReadValueFromMemory (ValueObject* parent, lldb::addr_t address);
109
110protected:
111    friend class ValueObject;
112    friend class ValueObjectConstResult;
113    ValueObjectChild (ValueObject &parent,
114                      clang::ASTContext *clang_ast,
115                      void *clang_type,
116                      const ConstString &name,
117                      uint32_t byte_size,
118                      int32_t byte_offset,
119                      uint32_t bitfield_bit_size,
120                      uint32_t bitfield_bit_offset,
121                      bool is_base_class,
122                      bool is_deref_of_parent,
123                      AddressType child_ptr_or_ref_addr_type);
124
125    DISALLOW_COPY_AND_ASSIGN (ValueObjectChild);
126};
127
128} // namespace lldb_private
129
130#endif  // liblldb_ValueObjectChild_h_
131