]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Interpreter/Property.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / include / lldb / Interpreter / Property.h
1 //===-- Property.h ----------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_Property_h_
11 #define liblldb_Property_h_
12
13 // C Includes
14 // C++ Includes
15 #include <string>
16
17 // Other libraries and framework includes
18 // Project 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"
23
24 namespace lldb_private {
25
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 {
29   const char *name;
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;
36 };
37
38 class Property {
39 public:
40   Property(const PropertyDefinition &definition);
41
42   Property(const ConstString &name, const ConstString &desc, bool is_global,
43            const lldb::OptionValueSP &value_sp);
44
45   llvm::StringRef GetName() const { return m_name.GetStringRef(); }
46   llvm::StringRef GetDescription() const {
47     return m_description.GetStringRef();
48   }
49
50   const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
51
52   void SetOptionValue(const lldb::OptionValueSP &value_sp) {
53     m_value_sp = value_sp;
54   }
55
56   bool IsValid() const { return (bool)m_value_sp; }
57
58   bool IsGlobal() const { return m_is_global; }
59
60   void Dump(const ExecutionContext *exe_ctx, Stream &strm,
61             uint32_t dump_mask) const;
62
63   bool DumpQualifiedName(Stream &strm) const;
64
65   void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
66                        uint32_t output_width,
67                        bool display_qualified_name) const;
68
69   void SetValueChangedCallback(OptionValueChangedCallback callback,
70                                void *baton);
71
72 protected:
73   ConstString m_name;
74   ConstString m_description;
75   lldb::OptionValueSP m_value_sp;
76   bool m_is_global;
77 };
78
79 } // namespace lldb_private
80
81 #endif // liblldb_Property_h_