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 OptionEnumValueElement *enum_values;
32 const char *description;
37 Property(const PropertyDefinition &definition);
39 Property(const ConstString &name, const ConstString &desc, bool is_global,
40 const lldb::OptionValueSP &value_sp);
42 llvm::StringRef GetName() const { return m_name.GetStringRef(); }
43 llvm::StringRef GetDescription() const {
44 return m_description.GetStringRef();
47 const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
49 void SetOptionValue(const lldb::OptionValueSP &value_sp) {
50 m_value_sp = value_sp;
53 bool IsValid() const { return (bool)m_value_sp; }
55 bool IsGlobal() const { return m_is_global; }
57 void Dump(const ExecutionContext *exe_ctx, Stream &strm,
58 uint32_t dump_mask) const;
60 bool DumpQualifiedName(Stream &strm) const;
62 void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
63 uint32_t output_width,
64 bool display_qualified_name) const;
66 void SetValueChangedCallback(OptionValueChangedCallback callback,
71 ConstString m_description;
72 lldb::OptionValueSP m_value_sp;
76 } // namespace lldb_private
78 #endif // liblldb_Property_h_