]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/Property.h
MFV r344364:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / 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 #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"
18
19 #include <string>
20
21 namespace lldb_private {
22
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 {
26   const char *name;
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;
33 };
34
35 class Property {
36 public:
37   Property(const PropertyDefinition &definition);
38
39   Property(const ConstString &name, const ConstString &desc, bool is_global,
40            const lldb::OptionValueSP &value_sp);
41
42   llvm::StringRef GetName() const { return m_name.GetStringRef(); }
43   llvm::StringRef GetDescription() const {
44     return m_description.GetStringRef();
45   }
46
47   const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
48
49   void SetOptionValue(const lldb::OptionValueSP &value_sp) {
50     m_value_sp = value_sp;
51   }
52
53   bool IsValid() const { return (bool)m_value_sp; }
54
55   bool IsGlobal() const { return m_is_global; }
56
57   void Dump(const ExecutionContext *exe_ctx, Stream &strm,
58             uint32_t dump_mask) const;
59
60   bool DumpQualifiedName(Stream &strm) const;
61
62   void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
63                        uint32_t output_width,
64                        bool display_qualified_name) const;
65
66   void SetValueChangedCallback(OptionValueChangedCallback callback,
67                                void *baton);
68
69 protected:
70   ConstString m_name;
71   ConstString m_description;
72   lldb::OptionValueSP m_value_sp;
73   bool m_is_global;
74 };
75
76 } // namespace lldb_private
77
78 #endif // liblldb_Property_h_