1 //===-- ValueObjectDynamicValue.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_ValueObjectCast_h_
11 #define liblldb_ValueObjectCast_h_
12 
13 #include "lldb/Core/ValueObject.h"
14 #include "lldb/Symbol/CompilerType.h"
15 #include "lldb/lldb-defines.h"
16 #include "lldb/lldb-enumerations.h"
17 #include "lldb/lldb-forward.h"
18 
19 #include <stddef.h>
20 #include <stdint.h>
21 
22 namespace lldb_private {
23 class ConstString;
24 }
25 
26 namespace lldb_private {
27 
28 //---------------------------------------------------------------------------------
29 // A ValueObject that represents a given value represented as a different type.
30 //---------------------------------------------------------------------------------
31 class ValueObjectCast : public ValueObject {
32 public:
33   ~ValueObjectCast() override;
34 
35   static lldb::ValueObjectSP Create(ValueObject &parent,
36                                     const ConstString &name,
37                                     const CompilerType &cast_type);
38 
39   uint64_t GetByteSize() override;
40 
41   size_t CalculateNumChildren(uint32_t max) override;
42 
43   lldb::ValueType GetValueType() const override;
44 
45   bool IsInScope() override;
46 
GetParent()47   ValueObject *GetParent() override {
48     return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
49   }
50 
GetParent()51   const ValueObject *GetParent() const override {
52     return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
53   }
54 
55 protected:
56   ValueObjectCast(ValueObject &parent, const ConstString &name,
57                   const CompilerType &cast_type);
58 
59   bool UpdateValue() override;
60 
61   CompilerType GetCompilerTypeImpl() override;
62 
63   CompilerType m_cast_type;
64 
65 private:
66   DISALLOW_COPY_AND_ASSIGN(ValueObjectCast);
67 };
68 
69 } // namespace lldb_private
70 
71 #endif // liblldb_ValueObjectCast_h_
72