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 LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
10 #define LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
11 
12 #include <map>
13 
15 
16 namespace lldb_private {
17 
19  : public Cloneable<OptionValueDictionary, OptionValue> {
20 public:
22  bool raw_value_dump = true)
23  : m_type_mask(type_mask), m_raw_value_dump(raw_value_dump) {}
24 
25  ~OptionValueDictionary() override = default;
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  void Clear() override {
39  m_values.clear();
40  m_value_was_set = false;
41  }
42 
43  lldb::OptionValueSP
44  DeepCopy(const lldb::OptionValueSP &new_parent) 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;
80 };
81 
82 } // namespace lldb_private
83 
84 #endif // LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
lldb_private::OptionValueDictionary::GetValueForKey
lldb::OptionValueSP GetValueForKey(ConstString key) const
Definition: OptionValueDictionary.cpp:280
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::OptionValue::eTypeInvalid
@ eTypeInvalid
Definition: OptionValue.h:27
lldb_private::OptionValueDictionary::m_raw_value_dump
bool m_raw_value_dump
Definition: OptionValueDictionary.h:79
lldb_private::OptionValueDictionary::collection
std::map< ConstString, lldb::OptionValueSP > collection
Definition: OptionValueDictionary.h:76
lldb_private::OptionValueDictionary::Clear
void Clear() override
Definition: OptionValueDictionary.h:38
lldb_private::OptionValueDictionary::SetArgs
Status SetArgs(const Args &args, VarSetOperationType op)
Definition: OptionValueDictionary.cpp:97
lldb_private::OptionValueDictionary::~OptionValueDictionary
~OptionValueDictionary() override=default
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Args
Definition: Args.h:33
lldb_private::OptionValueDictionary::DeepCopy
lldb::OptionValueSP DeepCopy(const lldb::OptionValueSP &new_parent) const override
Definition: OptionValueDictionary.cpp:315
lldb_private::Cloneable
Definition: Cloneable.h:40
lldb_private::OptionValueDictionary::GetArgs
size_t GetArgs(Args &args) const
Definition: OptionValueDictionary.cpp:85
lldb_private::OptionValueDictionary::OptionValueDictionary
OptionValueDictionary(uint32_t type_mask=UINT32_MAX, bool raw_value_dump=true)
Definition: OptionValueDictionary.h:21
OptionValue.h
lldb_private::OptionValueDictionary::GetType
OptionValue::Type GetType() const override
Definition: OptionValueDictionary.h:29
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::VarSetOperationType
VarSetOperationType
Settable state variable types.
Definition: lldb-private-enumerations.h:83
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::OptionValueDictionary::GetNumValues
size_t GetNumValues() const
Definition: OptionValueDictionary.h:54
lldb_private::OptionValueDictionary::SetValueForKey
bool SetValueForKey(ConstString key, const lldb::OptionValueSP &value_sp, bool can_replace=true)
Definition: OptionValueDictionary.cpp:288
lldb_private::OptionValueDictionary::DumpValue
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
Definition: OptionValueDictionary.cpp:20
lldb_private::OptionValueDictionary::DeleteValueForKey
bool DeleteValueForKey(ConstString key)
Definition: OptionValueDictionary.cpp:305
lldb_private::OptionValue::ConvertTypeMaskToType
static OptionValue::Type ConvertTypeMaskToType(uint32_t type_mask)
Definition: OptionValue.h:124
lldb_private::OptionValueDictionary::GetSubValue
lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, bool will_modify, Status &error) const override
Definition: OptionValueDictionary.cpp:213
lldb_private::Status
Definition: Status.h:44
lldb_private::OptionValue::Type
Type
Definition: OptionValue.h:26
lldb_private::OptionValue::eTypeDictionary
@ eTypeDictionary
Definition: OptionValue.h:33
lldb_private::OptionValueDictionary::IsHomogenous
bool IsHomogenous() const
Definition: OptionValueDictionary.h:48
uint32_t
lldb_private::OptionValue::m_value_was_set
bool m_value_was_set
Definition: OptionValue.h:332
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::OptionValueDictionary::IsAggregateValue
bool IsAggregateValue() const override
Definition: OptionValueDictionary.h:46
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::OptionValueDictionary::m_type_mask
uint32_t m_type_mask
Definition: OptionValueDictionary.h:77
lldb_private::OptionValueDictionary
Definition: OptionValueDictionary.h:18
lldb_private::OptionValueDictionary::SetSubValue
Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef name, llvm::StringRef value) override
Definition: OptionValueDictionary.cpp:263
lldb_private::OptionValueDictionary::SetValueFromString
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Definition: OptionValueDictionary.cpp:203
lldb_private::OptionValueDictionary::m_values
collection m_values
Definition: OptionValueDictionary.h:78
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition: lldb-private-enumerations.h:90