LLDB  mainline
ValueObjectCast.h
Go to the documentation of this file.
1 //===-- ValueObjectCast.h ---------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_CORE_VALUEOBJECTCAST_H
10 #define LLDB_CORE_VALUEOBJECTCAST_H
11 
12 #include "lldb/Core/ValueObject.h"
14 #include "lldb/lldb-defines.h"
15 #include "lldb/lldb-enumerations.h"
16 #include "lldb/lldb-forward.h"
17 
18 #include <cstddef>
19 #include <cstdint>
20 
21 namespace lldb_private {
22 class ConstString;
23 
24 /// A ValueObject that represents a given value represented as a different type.
25 class ValueObjectCast : public ValueObject {
26 public:
27  ~ValueObjectCast() override;
28 
29  static lldb::ValueObjectSP Create(ValueObject &parent,
30  ConstString name,
31  const CompilerType &cast_type);
32 
33  llvm::Optional<uint64_t> GetByteSize() override;
34 
35  size_t CalculateNumChildren(uint32_t max) override;
36 
37  lldb::ValueType GetValueType() const override;
38 
39  bool IsInScope() override;
40 
41  ValueObject *GetParent() override {
42  return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
43  }
44 
45  const ValueObject *GetParent() const override {
46  return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
47  }
48 
49 protected:
51  const CompilerType &cast_type);
52 
53  bool UpdateValue() override;
54 
56 
58 
59 private:
60  ValueObjectCast(const ValueObjectCast &) = delete;
61  const ValueObjectCast &operator=(const ValueObjectCast &) = delete;
62 };
63 
64 } // namespace lldb_private
65 
66 #endif // LLDB_CORE_VALUEOBJECTCAST_H
lldb_private::ValueObjectCast::UpdateValue
bool UpdateValue() override
Definition: ValueObjectCast.cpp:60
lldb_private::ValueObjectCast::operator=
const ValueObjectCast & operator=(const ValueObjectCast &)=delete
lldb_private::ValueObjectCast::GetParent
ValueObject * GetParent() override
Definition: ValueObjectCast.h:41
lldb-defines.h
lldb_private::ValueObjectCast::Create
static lldb::ValueObjectSP Create(ValueObject &parent, ConstString name, const CompilerType &cast_type)
Definition: ValueObjectCast.cpp:24
lldb_private::ValueObjectCast::GetByteSize
llvm::Optional< uint64_t > GetByteSize() override
Definition: ValueObjectCast.cpp:50
lldb_private::ValueObjectCast::ValueObjectCast
ValueObjectCast(ValueObject &parent, ConstString name, const CompilerType &cast_type)
Definition: ValueObjectCast.cpp:32
lldb_private::ValueObjectCast
A ValueObject that represents a given value represented as a different type.
Definition: ValueObjectCast.h:25
lldb_private::ValueObjectCast::GetParent
const ValueObject * GetParent() const override
Definition: ValueObjectCast.h:45
lldb_private::ConstString
Definition: ConstString.h:40
lldb-enumerations.h
lldb_private::ValueObjectCast::GetValueType
lldb::ValueType GetValueType() const override
Definition: ValueObjectCast.cpp:55
lldb_private::ValueObject::GetParent
virtual ValueObject * GetParent()
Definition: ValueObject.h:753
lldb_private::ValueObjectCast::m_cast_type
CompilerType m_cast_type
Definition: ValueObjectCast.h:57
CompilerType.h
ValueObject.h
lldb_private::ValueObjectCast::IsInScope
bool IsInScope() override
Definition: ValueObjectCast.cpp:91
lldb_private::ValueObjectCast::GetCompilerTypeImpl
CompilerType GetCompilerTypeImpl() override
Definition: ValueObjectCast.cpp:41
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb::ValueType
ValueType
Definition: lldb-enumerations.h:315
uint32_t
lldb_private::ValueObject::m_parent
ValueObject * m_parent
The parent value object, or nullptr if this has no parent.
Definition: ValueObject.h:840
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb-forward.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ValueObjectCast::CalculateNumChildren
size_t CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
Definition: ValueObjectCast.cpp:43
lldb_private::ValueObjectCast::~ValueObjectCast
~ValueObjectCast() override