LLDB  mainline
Property.h
Go to the documentation of this file.
1 //===-- Property.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_INTERPRETER_PROPERTY_H
10 #define LLDB_INTERPRETER_PROPERTY_H
11 
13 #include "lldb/Utility/Flags.h"
14 #include "lldb/lldb-defines.h"
16 
17 #include <string>
18 
19 namespace lldb_private {
20 
21 // A structure that can be used to create a global table for all properties.
22 // Property class instances can be constructed using one of these.
24  const char *name;
26  bool global; // false == this setting is a global setting by default
27  uintptr_t default_uint_value;
28  const char *default_cstr_value;
29  OptionEnumValues enum_values;
30  const char *description;
31 };
32 
33 using PropertyDefinitions = llvm::ArrayRef<PropertyDefinition>;
34 
35 class Property {
36 public:
37  Property(const PropertyDefinition &definition);
38 
39  Property(llvm::StringRef name, llvm::StringRef desc, bool is_global,
40  const lldb::OptionValueSP &value_sp);
41 
42  llvm::StringRef GetName() const { return m_name; }
43  llvm::StringRef GetDescription() const { return m_description; }
44 
45  const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
46 
47  void SetOptionValue(const lldb::OptionValueSP &value_sp) {
48  m_value_sp = value_sp;
49  }
50 
51  bool IsValid() const { return (bool)m_value_sp; }
52 
53  bool IsGlobal() const { return m_is_global; }
54 
55  void Dump(const ExecutionContext *exe_ctx, Stream &strm,
56  uint32_t dump_mask) const;
57 
58  bool DumpQualifiedName(Stream &strm) const;
59 
60  void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
61  uint32_t output_width,
62  bool display_qualified_name) const;
63 
64  void SetValueChangedCallback(std::function<void()> callback);
65 
66 protected:
69  lldb::OptionValueSP m_value_sp;
71 };
72 
73 } // namespace lldb_private
74 
75 #endif // LLDB_INTERPRETER_PROPERTY_H
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb-private-types.h
lldb_private::Property::Property
Property(const PropertyDefinition &definition)
Definition: Property.cpp:22
lldb-defines.h
lldb_private::Property::m_value_sp
lldb::OptionValueSP m_value_sp
Definition: Property.h:69
lldb_private::Property
Definition: Property.h:35
lldb_private::Property::IsGlobal
bool IsGlobal() const
Definition: Property.h:53
lldb_private::PropertyDefinition::default_uint_value
uintptr_t default_uint_value
Definition: Property.h:27
lldb_private::PropertyDefinition::name
const char * name
Definition: Property.h:24
lldb_private::Stream
Definition: Stream.h:28
lldb_private::PropertyDefinition::type
OptionValue::Type type
Definition: Property.h:25
OptionValue.h
lldb_private::PropertyDefinition::global
bool global
Definition: Property.h:26
lldb_private::Property::DumpQualifiedName
bool DumpQualifiedName(Stream &strm) const
Definition: Property.cpp:236
lldb_private::PropertyDefinitions
llvm::ArrayRef< PropertyDefinition > PropertyDefinitions
Definition: Property.h:33
lldb_private::Property::Dump
void Dump(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) const
Definition: Property.cpp:246
lldb_private::PropertyDefinition::default_cstr_value
const char * default_cstr_value
Definition: Property.h:28
lldb_private::PropertyDefinition::description
const char * description
Definition: Property.h:30
lldb_private::Property::DumpDescription
void DumpDescription(CommandInterpreter &interpreter, Stream &strm, uint32_t output_width, bool display_qualified_name) const
Definition: Property.cpp:274
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
lldb_private::Property::m_is_global
bool m_is_global
Definition: Property.h:70
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::Property::IsValid
bool IsValid() const
Definition: Property.h:51
lldb_private::OptionValue::Type
Type
Definition: OptionValue.h:26
uint32_t
lldb_private::Property::GetDescription
llvm::StringRef GetDescription() const
Definition: Property.h:43
lldb_private::PropertyDefinition::enum_values
OptionEnumValues enum_values
Definition: Property.h:29
lldb_private::Property::GetValue
const lldb::OptionValueSP & GetValue() const
Definition: Property.h:45
lldb_private::Property::SetValueChangedCallback
void SetValueChangedCallback(std::function< void()> callback)
Definition: Property.cpp:305
lldb_private::Property::m_name
std::string m_name
Definition: Property.h:67
lldb_private::Property::GetName
llvm::StringRef GetName() const
Definition: Property.h:42
lldb_private::Property::SetOptionValue
void SetOptionValue(const lldb::OptionValueSP &value_sp)
Definition: Property.h:47
lldb_private::PropertyDefinition
Definition: Property.h:23
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
Flags.h
lldb_private::Property::m_description
std::string m_description
Definition: Property.h:68