LLDB  mainline
OptionValueDictionary.h
Go to the documentation of this file.
1 //===-- OptionValueDictionary.h ---------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef liblldb_OptionValueDictionary_h_
10 #define liblldb_OptionValueDictionary_h_
11 
12 #include <map>
13 
15 
16 namespace lldb_private {
17 
19 public:
21  bool raw_value_dump = true)
22  : OptionValue(), m_type_mask(type_mask), m_values(),
23  m_raw_value_dump(raw_value_dump) {}
24 
25  ~OptionValueDictionary() override {}
26 
27  // Virtual subclass pure virtual overrides
28 
29  OptionValue::Type GetType() const override { return eTypeDictionary; }
30 
31  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
32  uint32_t dump_mask) override;
33 
34  Status
35  SetValueFromString(llvm::StringRef value,
37 
38  bool Clear() override {
39  m_values.clear();
40  m_value_was_set = false;
41  return true;
42  }
43 
44  lldb::OptionValueSP DeepCopy() const override;
45 
46  bool IsAggregateValue() const override { return true; }
47 
48  bool IsHomogenous() const {
50  }
51 
52  // Subclass specific functions
53 
54  size_t GetNumValues() const { return m_values.size(); }
55 
56  lldb::OptionValueSP GetValueForKey(ConstString key) const;
57 
58  lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
59  llvm::StringRef name, bool will_modify,
60  Status &error) const override;
61 
63  llvm::StringRef name, llvm::StringRef value) override;
64 
65  bool SetValueForKey(ConstString key,
66  const lldb::OptionValueSP &value_sp,
67  bool can_replace = true);
68 
70 
71  size_t GetArgs(Args &args) const;
72 
73  Status SetArgs(const Args &args, VarSetOperationType op);
74 
75 protected:
76  typedef std::map<ConstString, lldb::OptionValueSP> collection;
78  collection m_values;
80 };
81 
82 } // namespace lldb_private
83 
84 #endif // liblldb_OptionValueDictionary_h_
A command line argument class.
Definition: Args.h:32
std::map< ConstString, lldb::OptionValueSP > collection
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, bool will_modify, Status &error) const override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb::OptionValueSP DeepCopy() const override
VarSetOperationType
Settable state variable types.
Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef name, llvm::StringRef value) override
OptionValueDictionary(uint32_t type_mask=UINT32_MAX, bool raw_value_dump=true)
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
static OptionValue::Type ConvertTypeMaskToType(uint32_t type_mask)
Definition: OptionValue.h:126
OptionValue::Type GetType() const override
A uniqued constant string class.
Definition: ConstString.h:38
bool SetValueForKey(ConstString key, const lldb::OptionValueSP &value_sp, bool can_replace=true)
lldb::OptionValueSP GetValueForKey(ConstString key) const
An error handling class.
Definition: Status.h:44
Status SetArgs(const Args &args, VarSetOperationType op)