1 | //===-- OptionGroupFile.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_OPTIONGROUPFILE_H |
10 | #define LLDB_INTERPRETER_OPTIONGROUPFILE_H |
11 | |
12 | #include "lldb/Interpreter/OptionValueFileSpec.h" |
13 | #include "lldb/Interpreter/OptionValueFileSpecList.h" |
14 | #include "lldb/Interpreter/Options.h" |
15 | |
16 | namespace lldb_private { |
17 | |
18 | // OptionGroupFile |
19 | |
20 | class OptionGroupFile : public OptionGroup { |
21 | public: |
22 | OptionGroupFile(uint32_t usage_mask, bool required, const char *long_option, |
23 | int short_option, uint32_t completion_type, |
24 | lldb::CommandArgumentType argument_type, |
25 | const char *usage_text); |
26 | |
27 | ~OptionGroupFile() override = default; |
28 | |
29 | llvm::ArrayRef<OptionDefinition> GetDefinitions() override { |
30 | return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); |
31 | } |
32 | |
33 | Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, |
34 | ExecutionContext *execution_context) override; |
35 | |
36 | void OptionParsingStarting(ExecutionContext *execution_context) override; |
37 | |
38 | OptionValueFileSpec &GetOptionValue() { return m_file; } |
39 | |
40 | const OptionValueFileSpec &GetOptionValue() const { return m_file; } |
41 | |
42 | protected: |
43 | OptionValueFileSpec m_file; |
44 | OptionDefinition m_option_definition; |
45 | }; |
46 | |
47 | // OptionGroupFileList |
48 | |
49 | class OptionGroupFileList : public OptionGroup { |
50 | public: |
51 | OptionGroupFileList(uint32_t usage_mask, bool required, |
52 | const char *long_option, int short_option, |
53 | uint32_t completion_type, |
54 | lldb::CommandArgumentType argument_type, |
55 | const char *usage_text); |
56 | |
57 | ~OptionGroupFileList() override; |
58 | |
59 | llvm::ArrayRef<OptionDefinition> GetDefinitions() override { |
60 | return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); |
61 | } |
62 | |
63 | Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, |
64 | ExecutionContext *execution_context) override; |
65 | |
66 | void OptionParsingStarting(ExecutionContext *execution_context) override; |
67 | |
68 | OptionValueFileSpecList &GetOptionValue() { return m_file_list; } |
69 | |
70 | const OptionValueFileSpecList &GetOptionValue() const { return m_file_list; } |
71 | |
72 | protected: |
73 | OptionValueFileSpecList m_file_list; |
74 | OptionDefinition m_option_definition; |
75 | }; |
76 | |
77 | } // namespace lldb_private |
78 | |
79 | #endif // LLDB_INTERPRETER_OPTIONGROUPFILE_H |
80 | |