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
161d19a2f2SGreg Clayton 
171d19a2f2SGreg Clayton using namespace lldb;
181d19a2f2SGreg Clayton using namespace lldb_private;
191d19a2f2SGreg Clayton 
201d19a2f2SGreg Clayton OptionGroupString::OptionGroupString (uint32_t usage_mask,
211d19a2f2SGreg Clayton                                       bool required,
221d19a2f2SGreg Clayton                                       const char *long_option,
233bcdfc0eSGreg Clayton                                       int short_option,
241d19a2f2SGreg Clayton                                       uint32_t completion_type,
251d19a2f2SGreg Clayton                                       lldb::CommandArgumentType argument_type,
261d19a2f2SGreg Clayton                                       const char *usage_text,
271d19a2f2SGreg Clayton                                       const char *default_value) :
281d19a2f2SGreg Clayton     m_value (default_value, default_value)
291d19a2f2SGreg Clayton {
301d19a2f2SGreg Clayton     m_option_definition.usage_mask = usage_mask;
311d19a2f2SGreg Clayton     m_option_definition.required = required;
321d19a2f2SGreg Clayton     m_option_definition.long_option = long_option;
331d19a2f2SGreg Clayton     m_option_definition.short_option = short_option;
34df734cddSZachary Turner     m_option_definition.validator = nullptr;
35e2607b50SVirgile Bello     m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
36d78c9576SEd Maste     m_option_definition.enum_values = nullptr;
371d19a2f2SGreg Clayton     m_option_definition.completion_type = completion_type;
381d19a2f2SGreg Clayton     m_option_definition.argument_type = argument_type;
391d19a2f2SGreg Clayton     m_option_definition.usage_text = usage_text;
401d19a2f2SGreg Clayton }
411d19a2f2SGreg Clayton 
421d19a2f2SGreg Clayton OptionGroupString::~OptionGroupString ()
431d19a2f2SGreg Clayton {
441d19a2f2SGreg Clayton }
451d19a2f2SGreg Clayton 
461d19a2f2SGreg Clayton Error
471d19a2f2SGreg Clayton OptionGroupString::SetOptionValue (CommandInterpreter &interpreter,
481d19a2f2SGreg Clayton                                    uint32_t option_idx,
491d19a2f2SGreg Clayton                                    const char *option_arg)
501d19a2f2SGreg Clayton {
51*c95f7e2aSPavel Labath     Error error (m_value.SetValueFromString (option_arg));
521d19a2f2SGreg Clayton     return error;
531d19a2f2SGreg Clayton }
541d19a2f2SGreg Clayton 
551d19a2f2SGreg Clayton void
561d19a2f2SGreg Clayton OptionGroupString::OptionParsingStarting (CommandInterpreter &interpreter)
571d19a2f2SGreg Clayton {
581d19a2f2SGreg Clayton     m_value.Clear();
591d19a2f2SGreg Clayton }
60