1 //===-- OptionValueDictionary.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_OptionValueDictionary_h_
11 #define liblldb_OptionValueDictionary_h_
17 // Other libraries and framework includes
19 #include "lldb/Interpreter/OptionValue.h"
21 namespace lldb_private {
23 class OptionValueDictionary : public OptionValue {
25 OptionValueDictionary(uint32_t type_mask = UINT32_MAX,
26 bool raw_value_dump = true)
27 : OptionValue(), m_type_mask(type_mask), m_values(),
28 m_raw_value_dump(raw_value_dump) {}
30 ~OptionValueDictionary() override {}
32 //---------------------------------------------------------------------
33 // Virtual subclass pure virtual overrides
34 //---------------------------------------------------------------------
36 OptionValue::Type GetType() const override { return eTypeDictionary; }
38 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
39 uint32_t dump_mask) override;
42 SetValueFromString(llvm::StringRef value,
43 VarSetOperationType op = eVarSetOperationAssign) override;
45 bool Clear() override {
47 m_value_was_set = false;
51 lldb::OptionValueSP DeepCopy() const override;
53 bool IsAggregateValue() const override { return true; }
55 bool IsHomogenous() const {
56 return ConvertTypeMaskToType(m_type_mask) != eTypeInvalid;
59 //---------------------------------------------------------------------
60 // Subclass specific functions
61 //---------------------------------------------------------------------
63 size_t GetNumValues() const { return m_values.size(); }
65 lldb::OptionValueSP GetValueForKey(const ConstString &key) const;
67 lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
68 llvm::StringRef name, bool will_modify,
69 Error &error) const override;
71 Error SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
72 llvm::StringRef name, llvm::StringRef value) override;
74 bool SetValueForKey(const ConstString &key,
75 const lldb::OptionValueSP &value_sp,
76 bool can_replace = true);
78 bool DeleteValueForKey(const ConstString &key);
80 size_t GetArgs(Args &args) const;
82 Error SetArgs(const Args &args, VarSetOperationType op);
85 typedef std::map<ConstString, lldb::OptionValueSP> collection;
88 bool m_raw_value_dump;
91 } // namespace lldb_private
93 #endif // liblldb_OptionValueDictionary_h_