LLDB mainline
OptionGroupPythonClassWithDict.h
Go to the documentation of this file.
1//===-- OptionGroupPythonClassWithDict.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_OPTIONGROUPPYTHONCLASSWITHDICT_H
10#define LLDB_INTERPRETER_OPTIONGROUPPYTHONCLASSWITHDICT_H
11
13#include "lldb/Utility/Flags.h"
15#include "lldb/lldb-types.h"
16
17namespace lldb_private {
18
19// Use this Option group if you have a python class that implements some
20// Python extension point, and you pass a SBStructuredData to the class
21// __init__ method.
22// class_option specifies the class name
23// the key and value options are read in in pairs, and a
24// StructuredData::Dictionary is constructed with those pairs.
26public:
28 eScriptClass = 1 << 0,
29 eDictKey = 1 << 1,
30 eDictValue = 1 << 2,
33 };
34
35 OptionGroupPythonClassWithDict(const char *class_use, bool is_class = true,
36 int class_option = 'C', int key_option = 'k',
37 int value_option = 'v',
38 uint16_t required_options = eScriptClass |
40
41 ~OptionGroupPythonClassWithDict() override = default;
42
43 llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
44 return llvm::ArrayRef<OptionDefinition>(m_option_definition);
45 }
46
47 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
48 ExecutionContext *execution_context) override;
49
50 void OptionParsingStarting(ExecutionContext *execution_context) override;
51 Status OptionParsingFinished(ExecutionContext *execution_context) override;
52
54 return m_dict_sp;
55 }
56 const std::string &GetName() {
57 return m_name;
58 }
59
60protected:
61 std::string m_name;
62 std::string m_current_key;
68};
69
70} // namespace lldb_private
71
72#endif // LLDB_INTERPRETER_OPTIONGROUPPYTHONCLASSWITHDICT_H
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A class to manage flags.
Definition: Flags.h:22
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
const StructuredData::DictionarySP GetStructuredData()
Status OptionParsingFinished(ExecutionContext *execution_context) override
An error handling class.
Definition: Status.h:115
std::shared_ptr< Dictionary > DictionarySP
A class that represents a running process on the host machine.