11d19a2f2SGreg Clayton //===-- OptionGroupString.cpp ----------------------------------*- C++ -*-===// 21d19a2f2SGreg Clayton // 31d19a2f2SGreg Clayton // The LLVM Compiler Infrastructure 41d19a2f2SGreg Clayton // 51d19a2f2SGreg Clayton // This file is distributed under the University of Illinois Open Source 61d19a2f2SGreg Clayton // License. See LICENSE.TXT for details. 71d19a2f2SGreg Clayton // 81d19a2f2SGreg Clayton //===----------------------------------------------------------------------===// 91d19a2f2SGreg Clayton 101d19a2f2SGreg Clayton #include "lldb/Interpreter/OptionGroupString.h" 111d19a2f2SGreg Clayton 121d19a2f2SGreg Clayton // C Includes 131d19a2f2SGreg Clayton // C++ Includes 141d19a2f2SGreg Clayton // Other libraries and framework includes 151d19a2f2SGreg Clayton // Project includes 16*3eb2b44dSZachary Turner #include "lldb/Host/OptionParser.h" 171d19a2f2SGreg Clayton 181d19a2f2SGreg Clayton using namespace lldb; 191d19a2f2SGreg Clayton using namespace lldb_private; 201d19a2f2SGreg Clayton 21b9c1b51eSKate Stone OptionGroupString::OptionGroupString(uint32_t usage_mask, bool required, 22b9c1b51eSKate Stone const char *long_option, int short_option, 231d19a2f2SGreg Clayton uint32_t completion_type, 241d19a2f2SGreg Clayton lldb::CommandArgumentType argument_type, 251d19a2f2SGreg Clayton const char *usage_text, 26b9c1b51eSKate Stone const char *default_value) 27b9c1b51eSKate Stone : m_value(default_value, default_value) { 281d19a2f2SGreg Clayton m_option_definition.usage_mask = usage_mask; 291d19a2f2SGreg Clayton m_option_definition.required = required; 301d19a2f2SGreg Clayton m_option_definition.long_option = long_option; 311d19a2f2SGreg Clayton m_option_definition.short_option = short_option; 32df734cddSZachary Turner m_option_definition.validator = nullptr; 33e2607b50SVirgile Bello m_option_definition.option_has_arg = OptionParser::eRequiredArgument; 34d78c9576SEd Maste m_option_definition.enum_values = nullptr; 351d19a2f2SGreg Clayton m_option_definition.completion_type = completion_type; 361d19a2f2SGreg Clayton m_option_definition.argument_type = argument_type; 371d19a2f2SGreg Clayton m_option_definition.usage_text = usage_text; 381d19a2f2SGreg Clayton } 391d19a2f2SGreg Clayton 40b9c1b51eSKate Stone OptionGroupString::~OptionGroupString() {} 411d19a2f2SGreg Clayton 42b9c1b51eSKate Stone Error OptionGroupString::SetOptionValue(uint32_t option_idx, 438cef4b0bSZachary Turner llvm::StringRef option_arg, 44b9c1b51eSKate Stone ExecutionContext *execution_context) { 45c95f7e2aSPavel Labath Error error(m_value.SetValueFromString(option_arg)); 461d19a2f2SGreg Clayton return error; 471d19a2f2SGreg Clayton } 481d19a2f2SGreg Clayton 49b9c1b51eSKate Stone void OptionGroupString::OptionParsingStarting( 50b9c1b51eSKate Stone ExecutionContext *execution_context) { 511d19a2f2SGreg Clayton m_value.Clear(); 521d19a2f2SGreg Clayton } 53