180814287SRaphael Isemann //===-- OptionGroupFile.cpp -----------------------------------------------===// 2effe5c95SGreg Clayton // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6effe5c95SGreg Clayton // 7effe5c95SGreg Clayton //===----------------------------------------------------------------------===// 8effe5c95SGreg Clayton 94bee32e5SJohnny Chen #include "lldb/Interpreter/OptionGroupFile.h" 10effe5c95SGreg Clayton 113eb2b44dSZachary Turner #include "lldb/Host/OptionParser.h" 12effe5c95SGreg Clayton 13effe5c95SGreg Clayton using namespace lldb; 14effe5c95SGreg Clayton using namespace lldb_private; 15effe5c95SGreg Clayton 16b9c1b51eSKate Stone OptionGroupFile::OptionGroupFile(uint32_t usage_mask, bool required, 17b9c1b51eSKate Stone const char *long_option, int short_option, 18effe5c95SGreg Clayton uint32_t completion_type, 19effe5c95SGreg Clayton lldb::CommandArgumentType argument_type, 20*8cdcd41eSTatyana Krasnukha const char *usage_text) { 21effe5c95SGreg Clayton m_option_definition.usage_mask = usage_mask; 22effe5c95SGreg Clayton m_option_definition.required = required; 23effe5c95SGreg Clayton m_option_definition.long_option = long_option; 24effe5c95SGreg Clayton m_option_definition.short_option = short_option; 25df734cddSZachary Turner m_option_definition.validator = nullptr; 26e2607b50SVirgile Bello m_option_definition.option_has_arg = OptionParser::eRequiredArgument; 278fe53c49STatyana Krasnukha m_option_definition.enum_values = {}; 28effe5c95SGreg Clayton m_option_definition.completion_type = completion_type; 29effe5c95SGreg Clayton m_option_definition.argument_type = argument_type; 30effe5c95SGreg Clayton m_option_definition.usage_text = usage_text; 31effe5c95SGreg Clayton } 32effe5c95SGreg Clayton 3397206d57SZachary Turner Status OptionGroupFile::SetOptionValue(uint32_t option_idx, 348cef4b0bSZachary Turner llvm::StringRef option_arg, 35b9c1b51eSKate Stone ExecutionContext *execution_context) { 3697206d57SZachary Turner Status error(m_file.SetValueFromString(option_arg)); 37effe5c95SGreg Clayton return error; 38effe5c95SGreg Clayton } 39effe5c95SGreg Clayton 40b9c1b51eSKate Stone void OptionGroupFile::OptionParsingStarting( 41b9c1b51eSKate Stone ExecutionContext *execution_context) { 42effe5c95SGreg Clayton m_file.Clear(); 43effe5c95SGreg Clayton } 44644247c1SGreg Clayton 45b9c1b51eSKate Stone OptionGroupFileList::OptionGroupFileList( 46b9c1b51eSKate Stone uint32_t usage_mask, bool required, const char *long_option, 47b9c1b51eSKate Stone int short_option, uint32_t completion_type, 48b9c1b51eSKate Stone lldb::CommandArgumentType argument_type, const char *usage_text) 49b9c1b51eSKate Stone : m_file_list() { 50644247c1SGreg Clayton m_option_definition.usage_mask = usage_mask; 51644247c1SGreg Clayton m_option_definition.required = required; 52644247c1SGreg Clayton m_option_definition.long_option = long_option; 53644247c1SGreg Clayton m_option_definition.short_option = short_option; 54df734cddSZachary Turner m_option_definition.validator = nullptr; 55e2607b50SVirgile Bello m_option_definition.option_has_arg = OptionParser::eRequiredArgument; 568fe53c49STatyana Krasnukha m_option_definition.enum_values = {}; 57644247c1SGreg Clayton m_option_definition.completion_type = completion_type; 58644247c1SGreg Clayton m_option_definition.argument_type = argument_type; 59644247c1SGreg Clayton m_option_definition.usage_text = usage_text; 60644247c1SGreg Clayton } 61644247c1SGreg Clayton 62b9c1b51eSKate Stone OptionGroupFileList::~OptionGroupFileList() {} 63644247c1SGreg Clayton 6497206d57SZachary Turner Status 6597206d57SZachary Turner OptionGroupFileList::SetOptionValue(uint32_t option_idx, 668cef4b0bSZachary Turner llvm::StringRef option_value, 67b9c1b51eSKate Stone ExecutionContext *execution_context) { 6897206d57SZachary Turner Status error(m_file_list.SetValueFromString(option_value)); 69644247c1SGreg Clayton return error; 70644247c1SGreg Clayton } 71644247c1SGreg Clayton 72b9c1b51eSKate Stone void OptionGroupFileList::OptionParsingStarting( 73b9c1b51eSKate Stone ExecutionContext *execution_context) { 74644247c1SGreg Clayton m_file_list.Clear(); 75644247c1SGreg Clayton } 76