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; 28 GetDefinitions()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 Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; 36 37 void OptionParsingStarting(ExecutionContext *execution_context) override; 38 GetOptionValue()39 OptionValueFileSpec &GetOptionValue() { return m_file; } 40 GetOptionValue()41 const OptionValueFileSpec &GetOptionValue() const { return m_file; } 42 43 protected: 44 OptionValueFileSpec m_file; 45 OptionDefinition m_option_definition; 46 }; 47 48 // OptionGroupFileList 49 50 class OptionGroupFileList : public OptionGroup { 51 public: 52 OptionGroupFileList(uint32_t usage_mask, bool required, 53 const char *long_option, int short_option, 54 uint32_t completion_type, 55 lldb::CommandArgumentType argument_type, 56 const char *usage_text); 57 58 ~OptionGroupFileList() override; 59 GetDefinitions()60 llvm::ArrayRef<OptionDefinition> GetDefinitions() override { 61 return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); 62 } 63 64 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, 65 ExecutionContext *execution_context) override; 66 Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; 67 68 void OptionParsingStarting(ExecutionContext *execution_context) override; 69 GetOptionValue()70 OptionValueFileSpecList &GetOptionValue() { return m_file_list; } 71 GetOptionValue()72 const OptionValueFileSpecList &GetOptionValue() const { return m_file_list; } 73 74 protected: 75 OptionValueFileSpecList m_file_list; 76 OptionDefinition m_option_definition; 77 }; 78 79 } // namespace lldb_private 80 81 #endif // LLDB_INTERPRETER_OPTIONGROUPFILE_H 82