1 //===-- Property.h ----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_Property_h_
11 #define liblldb_Property_h_
13 #include "lldb/Interpreter/OptionValue.h"
14 #include "lldb/Utility/ConstString.h"
15 #include "lldb/Utility/Flags.h"
16 #include "lldb/lldb-defines.h"
17 #include "lldb/lldb-private-types.h"
21 namespace lldb_private {
23 // A structure that can be used to create a global table for all properties.
24 // Property class instances can be constructed using one of these.
25 struct PropertyDefinition {
27 OptionValue::Type type;
28 bool global; // false == this setting is a global setting by default
29 uintptr_t default_uint_value;
30 const char *default_cstr_value;
31 OptionEnumValues enum_values;
32 const char *description;
35 using PropertyDefinitions = llvm::ArrayRef<PropertyDefinition>;
39 Property(const PropertyDefinition &definition);
41 Property(const ConstString &name, const ConstString &desc, bool is_global,
42 const lldb::OptionValueSP &value_sp);
44 llvm::StringRef GetName() const { return m_name.GetStringRef(); }
45 llvm::StringRef GetDescription() const {
46 return m_description.GetStringRef();
49 const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
51 void SetOptionValue(const lldb::OptionValueSP &value_sp) {
52 m_value_sp = value_sp;
55 bool IsValid() const { return (bool)m_value_sp; }
57 bool IsGlobal() const { return m_is_global; }
59 void Dump(const ExecutionContext *exe_ctx, Stream &strm,
60 uint32_t dump_mask) const;
62 bool DumpQualifiedName(Stream &strm) const;
64 void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
65 uint32_t output_width,
66 bool display_qualified_name) const;
68 void SetValueChangedCallback(OptionValueChangedCallback callback,
73 ConstString m_description;
74 lldb::OptionValueSP m_value_sp;
78 } // namespace lldb_private
80 #endif // liblldb_Property_h_