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 liblldb_Property_h_
10 #define liblldb_Property_h_
11 
14 #include "lldb/Utility/Flags.h"
15 #include "lldb/lldb-defines.h"
17 
18 #include <string>
19 
20 namespace lldb_private {
21 
22 // A structure that can be used to create a global table for all properties.
23 // Property class instances can be constructed using one of these.
25  const char *name;
27  bool global; // false == this setting is a global setting by default
28  uintptr_t default_uint_value;
29  const char *default_cstr_value;
30  OptionEnumValues enum_values;
31  const char *description;
32 };
33 
34 using PropertyDefinitions = llvm::ArrayRef<PropertyDefinition>;
35 
36 class Property {
37 public:
38  Property(const PropertyDefinition &definition);
39 
40  Property(ConstString name, ConstString desc, bool is_global,
41  const lldb::OptionValueSP &value_sp);
42 
43  llvm::StringRef GetName() const { return m_name.GetStringRef(); }
44  llvm::StringRef GetDescription() const {
45  return m_description.GetStringRef();
46  }
47 
48  const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
49 
50  void SetOptionValue(const lldb::OptionValueSP &value_sp) {
51  m_value_sp = value_sp;
52  }
53 
54  bool IsValid() const { return (bool)m_value_sp; }
55 
56  bool IsGlobal() const { return m_is_global; }
57 
58  void Dump(const ExecutionContext *exe_ctx, Stream &strm,
59  uint32_t dump_mask) const;
60 
61  bool DumpQualifiedName(Stream &strm) const;
62 
63  void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
64  uint32_t output_width,
65  bool display_qualified_name) const;
66 
67  void SetValueChangedCallback(OptionValueChangedCallback callback,
68  void *baton);
69 
70 protected:
73  lldb::OptionValueSP m_value_sp;
75 };
76 
77 } // namespace lldb_private
78 
79 #endif // liblldb_Property_h_
lldb::OptionValueSP m_value_sp
Definition: Property.h:73
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
llvm::StringRef GetName() const
Definition: Property.h:43
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool IsGlobal() const
Definition: Property.h:56
ConstString m_description
Definition: Property.h:72
llvm::StringRef GetDescription() const
Definition: Property.h:44
OptionValue::Type type
Definition: Property.h:26
llvm::ArrayRef< PropertyDefinition > PropertyDefinitions
Definition: Property.h:34
const lldb::OptionValueSP & GetValue() const
Definition: Property.h:48
A uniqued constant string class.
Definition: ConstString.h:38
bool IsValid() const
Definition: Property.h:54
OptionEnumValues enum_values
Definition: Property.h:30
ConstString m_name
Definition: Property.h:71
void SetOptionValue(const lldb::OptionValueSP &value_sp)
Definition: Property.h:50