]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueDictionary.h
Merge ^/head r293280 through r293429.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionValueDictionary.h
1 //===-- OptionValueDictionary.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_OptionValueDictionary_h_
11 #define liblldb_OptionValueDictionary_h_
12
13 // C Includes
14 // C++ Includes
15 #include <map>
16
17 // Other libraries and framework includes
18 // Project includes
19 #include "lldb/Interpreter/OptionValue.h"
20
21 namespace lldb_private {
22     
23 class OptionValueDictionary : public OptionValue
24 {
25 public:
26     OptionValueDictionary (uint32_t type_mask = UINT32_MAX, bool raw_value_dump = true) :
27         OptionValue(),
28         m_type_mask (type_mask),
29         m_values (),
30         m_raw_value_dump (raw_value_dump)
31     {
32     }
33     
34     ~OptionValueDictionary() override
35     {
36     }
37     
38     //---------------------------------------------------------------------
39     // Virtual subclass pure virtual overrides
40     //---------------------------------------------------------------------
41     
42     OptionValue::Type
43     GetType() const override
44     {
45         return eTypeDictionary;
46     }
47     
48     void
49     DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
50     
51     Error
52     SetValueFromString(llvm::StringRef value,
53                        VarSetOperationType op = eVarSetOperationAssign) override;
54     
55     bool
56     Clear() override
57     {
58         m_values.clear();
59         m_value_was_set = false;
60         return true;
61     }
62     
63     lldb::OptionValueSP
64     DeepCopy() const override;
65     
66     bool
67     IsAggregateValue() const override
68     {
69         return true;
70     }
71
72     bool
73     IsHomogenous() const
74     {
75         return ConvertTypeMaskToType (m_type_mask) != eTypeInvalid;
76     }
77
78     //---------------------------------------------------------------------
79     // Subclass specific functions
80     //---------------------------------------------------------------------
81     
82     size_t
83     GetNumValues() const
84     {
85         return m_values.size();
86     }
87     
88     lldb::OptionValueSP
89     GetValueForKey (const ConstString &key) const;
90     
91     lldb::OptionValueSP
92     GetSubValue(const ExecutionContext *exe_ctx,
93                 const char *name,
94                 bool will_modify,
95                 Error &error) const override;
96     
97     Error
98     SetSubValue(const ExecutionContext *exe_ctx,
99                 VarSetOperationType op,
100                 const char *name,
101                 const char *value) override;
102
103     //---------------------------------------------------------------------
104     // String value getters and setters
105     //---------------------------------------------------------------------
106     const char *
107     GetStringValueForKey (const ConstString &key);
108
109     bool
110     SetStringValueForKey (const ConstString &key, 
111                           const char *value,
112                           bool can_replace = true);
113
114     
115     bool
116     SetValueForKey (const ConstString &key, 
117                     const lldb::OptionValueSP &value_sp, 
118                     bool can_replace = true);
119     
120     bool
121     DeleteValueForKey (const ConstString &key);
122     
123     size_t
124     GetArgs (Args &args) const;
125     
126     Error
127     SetArgs (const Args &args, VarSetOperationType op);
128     
129 protected:
130     typedef std::map<ConstString, lldb::OptionValueSP> collection;
131     uint32_t m_type_mask;
132     collection m_values;
133     bool m_raw_value_dump;
134 };
135     
136 } // namespace lldb_private
137
138 #endif // liblldb_OptionValueDictionary_h_