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
14
15#include "llvm/ADT/StringMap.h"
16
17namespace lldb_private {
18
20 : public Cloneable<OptionValueDictionary, OptionValue> {
21public:
22 OptionValueDictionary(uint32_t type_mask = UINT32_MAX,
23 OptionEnumValues enum_values = OptionEnumValues(),
24 bool raw_value_dump = true)
25 : m_type_mask(type_mask), m_enum_values(enum_values),
26 m_raw_value_dump(raw_value_dump) {}
27
28 ~OptionValueDictionary() override = default;
29
30 // Virtual subclass pure virtual overrides
31
32 OptionValue::Type GetType() const override { return eTypeDictionary; }
33
34 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
35 uint32_t dump_mask) override;
36
37 llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
38
39 Status
40 SetValueFromString(llvm::StringRef value,
42
43 void Clear() override {
44 m_values.clear();
45 m_value_was_set = false;
46 }
47
49 DeepCopy(const lldb::OptionValueSP &new_parent) const override;
50
51 bool IsAggregateValue() const override { return true; }
52
53 bool IsHomogenous() const {
55 }
56
57 // Subclass specific functions
58
59 size_t GetNumValues() const { return m_values.size(); }
60
61 lldb::OptionValueSP GetValueForKey(llvm::StringRef key) const;
62
64 llvm::StringRef name,
65 Status &error) const override;
66
68 llvm::StringRef name, llvm::StringRef value) override;
69
70 bool SetValueForKey(llvm::StringRef key, const lldb::OptionValueSP &value_sp,
71 bool can_replace = true);
72
73 bool DeleteValueForKey(llvm::StringRef key);
74
75 size_t GetArgs(Args &args) const;
76
77 Status SetArgs(const Args &args, VarSetOperationType op);
78
79protected:
80 uint32_t m_type_mask;
82 llvm::StringMap<lldb::OptionValueSP> m_values;
84};
85
86} // namespace lldb_private
87
88#endif // LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
static llvm::raw_ostream & error(Stream &strm)
A command line argument class.
Definition: Args.h:33
A class that implements CRTP-based "virtual constructor" idiom.
Definition: Cloneable.h:40
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
llvm::StringMap< lldb::OptionValueSP > m_values
lldb::OptionValueSP DeepCopy(const lldb::OptionValueSP &new_parent) const override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef name, llvm::StringRef value) override
OptionValueDictionary(uint32_t type_mask=UINT32_MAX, OptionEnumValues enum_values=OptionEnumValues(), bool raw_value_dump=true)
OptionValue::Type GetType() const override
Status SetArgs(const Args &args, VarSetOperationType op)
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override
lldb::OptionValueSP GetValueForKey(llvm::StringRef key) const
lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, Status &error) const override
bool SetValueForKey(llvm::StringRef key, const lldb::OptionValueSP &value_sp, bool can_replace=true)
~OptionValueDictionary() override=default
static OptionValue::Type ConvertTypeMaskToType(uint32_t type_mask)
Definition: OptionValue.h:144
An error handling class.
Definition: Status.h:44
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
#define UINT32_MAX
Definition: lldb-defines.h:19
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
VarSetOperationType
Settable state variable types.
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
Definition: lldb-forward.h:376