ValueObjectChild.h revision 931acecd4e3af534028936431dc0f75a9fd6eb02
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 bool
63    IsInScope ();
64
65    virtual bool
66    IsBaseClass ()
67    {
68        return m_is_base_class;
69    }
70
71    virtual bool
72    IsDereferenceOfParent ()
73    {
74        return m_is_deref_of_parent;
75    }
76
77protected:
78    virtual bool
79    UpdateValue ();
80
81    virtual clang::ASTContext *
82    GetClangASTImpl ()
83    {
84        return m_clang_ast;
85    }
86
87    virtual lldb::clang_type_t
88    GetClangTypeImpl ()
89    {
90        return m_clang_type;
91    }
92
93    clang::ASTContext *m_clang_ast; // The clang AST that the clang type comes from
94    void *m_clang_type; // The type of the child in question within the parent (m_parent_sp)
95    ConstString m_type_name;
96    uint32_t m_byte_size;
97    int32_t m_byte_offset;
98    uint8_t m_bitfield_bit_size;
99    uint8_t m_bitfield_bit_offset;
100    bool m_is_base_class;
101    bool m_is_deref_of_parent;
102
103//
104//  void
105//  ReadValueFromMemory (ValueObject* parent, lldb::addr_t address);
106
107protected:
108    friend class ValueObject;
109    friend class ValueObjectConstResult;
110    ValueObjectChild (ValueObject &parent,
111                      clang::ASTContext *clang_ast,
112                      void *clang_type,
113                      const ConstString &name,
114                      uint32_t byte_size,
115                      int32_t byte_offset,
116                      uint32_t bitfield_bit_size,
117                      uint32_t bitfield_bit_offset,
118                      bool is_base_class,
119                      bool is_deref_of_parent,
120                      AddressType child_ptr_or_ref_addr_type);
121
122    DISALLOW_COPY_AND_ASSIGN (ValueObjectChild);
123};
124
125} // namespace lldb_private
126
127#endif  // liblldb_ValueObjectChild_h_
128