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_
17 // Other libraries and framework includes
19 #include "lldb/Core/ConstString.h"
20 #include "lldb/Core/Flags.h"
21 #include "lldb/Interpreter/OptionValue.h"
22 #include "lldb/lldb-defines.h"
24 namespace lldb_private {
26 // A structure that can be used to create a global table for all properties.
27 // Property class instances can be constructed using one of these.
28 struct PropertyDefinition {
30 OptionValue::Type type;
31 bool global; // false == this setting is a global setting by default
32 uintptr_t default_uint_value;
33 const char *default_cstr_value;
34 OptionEnumValueElement *enum_values;
35 const char *description;
40 Property(const PropertyDefinition &definition);
42 Property(const ConstString &name, const ConstString &desc, bool is_global,
43 const lldb::OptionValueSP &value_sp);
45 llvm::StringRef GetName() const { return m_name.GetStringRef(); }
46 llvm::StringRef GetDescription() const {
47 return m_description.GetStringRef();
50 const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
52 void SetOptionValue(const lldb::OptionValueSP &value_sp) {
53 m_value_sp = value_sp;
56 bool IsValid() const { return (bool)m_value_sp; }
58 bool IsGlobal() const { return m_is_global; }
60 void Dump(const ExecutionContext *exe_ctx, Stream &strm,
61 uint32_t dump_mask) const;
63 bool DumpQualifiedName(Stream &strm) const;
65 void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
66 uint32_t output_width,
67 bool display_qualified_name) const;
69 void SetValueChangedCallback(OptionValueChangedCallback callback,
74 ConstString m_description;
75 lldb::OptionValueSP m_value_sp;
79 } // namespace lldb_private
81 #endif // liblldb_Property_h_