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