1ac7ddfbfSEd Maste //===-- OptionGroupString.cpp ----------------------------------*- C++ -*-===//
2ac7ddfbfSEd Maste //
3ac7ddfbfSEd Maste //                     The LLVM Compiler Infrastructure
4ac7ddfbfSEd Maste //
5ac7ddfbfSEd Maste // This file is distributed under the University of Illinois Open Source
6ac7ddfbfSEd Maste // License. See LICENSE.TXT for details.
7ac7ddfbfSEd Maste //
8ac7ddfbfSEd Maste //===----------------------------------------------------------------------===//
9ac7ddfbfSEd Maste 
10ac7ddfbfSEd Maste #include "lldb/Interpreter/OptionGroupString.h"
11ac7ddfbfSEd Maste 
12f678e45dSDimitry Andric #include "lldb/Host/OptionParser.h"
13ac7ddfbfSEd Maste 
14ac7ddfbfSEd Maste using namespace lldb;
15ac7ddfbfSEd Maste using namespace lldb_private;
16ac7ddfbfSEd Maste 
OptionGroupString(uint32_t usage_mask,bool required,const char * long_option,int short_option,uint32_t completion_type,lldb::CommandArgumentType argument_type,const char * usage_text,const char * default_value)17435933ddSDimitry Andric OptionGroupString::OptionGroupString(uint32_t usage_mask, bool required,
18435933ddSDimitry Andric                                      const char *long_option, int short_option,
19ac7ddfbfSEd Maste                                      uint32_t completion_type,
20ac7ddfbfSEd Maste                                      lldb::CommandArgumentType argument_type,
21ac7ddfbfSEd Maste                                      const char *usage_text,
22435933ddSDimitry Andric                                      const char *default_value)
23435933ddSDimitry Andric     : m_value(default_value, default_value) {
24ac7ddfbfSEd Maste   m_option_definition.usage_mask = usage_mask;
25ac7ddfbfSEd Maste   m_option_definition.required = required;
26ac7ddfbfSEd Maste   m_option_definition.long_option = long_option;
27ac7ddfbfSEd Maste   m_option_definition.short_option = short_option;
280127ef0fSEd Maste   m_option_definition.validator = nullptr;
2935617911SEd Maste   m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
30*b5893f02SDimitry Andric   m_option_definition.enum_values = {};
31ac7ddfbfSEd Maste   m_option_definition.completion_type = completion_type;
32ac7ddfbfSEd Maste   m_option_definition.argument_type = argument_type;
33ac7ddfbfSEd Maste   m_option_definition.usage_text = usage_text;
34ac7ddfbfSEd Maste }
35ac7ddfbfSEd Maste 
~OptionGroupString()36435933ddSDimitry Andric OptionGroupString::~OptionGroupString() {}
37ac7ddfbfSEd Maste 
SetOptionValue(uint32_t option_idx,llvm::StringRef option_arg,ExecutionContext * execution_context)385517e702SDimitry Andric Status OptionGroupString::SetOptionValue(uint32_t option_idx,
39435933ddSDimitry Andric                                          llvm::StringRef option_arg,
40435933ddSDimitry Andric                                          ExecutionContext *execution_context) {
415517e702SDimitry Andric   Status error(m_value.SetValueFromString(option_arg));
42ac7ddfbfSEd Maste   return error;
43ac7ddfbfSEd Maste }
44ac7ddfbfSEd Maste 
OptionParsingStarting(ExecutionContext * execution_context)45435933ddSDimitry Andric void OptionGroupString::OptionParsingStarting(
46435933ddSDimitry Andric     ExecutionContext *execution_context) {
47ac7ddfbfSEd Maste   m_value.Clear();
48ac7ddfbfSEd Maste }
49