186801Sache//===-- OptionGroupString.cpp ---------------------------------------------===//
286801Sache//
386801Sache// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
486801Sache// See https://llvm.org/LICENSE.txt for license information.
586801Sache// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
686801Sache//
786801Sache//===----------------------------------------------------------------------===//
886801Sache
986801Sache#include "lldb/Interpreter/OptionGroupString.h"
1086801Sache
1186801Sache#include "lldb/Host/OptionParser.h"
1286801Sache
1386801Sacheusing namespace lldb;
1486801Sacheusing namespace lldb_private;
1586801Sache
1686801SacheOptionGroupString::OptionGroupString(uint32_t usage_mask, bool required,
1786801Sache                                     const char *long_option, int short_option,
1886801Sache                                     uint32_t completion_type,
1986801Sache                                     lldb::CommandArgumentType argument_type,
2086801Sache                                     const char *usage_text,
2186801Sache                                     const char *default_value)
2286801Sache    : m_value(default_value, default_value) {
2386801Sache  m_option_definition.usage_mask = usage_mask;
2486801Sache  m_option_definition.required = required;
2586801Sache  m_option_definition.long_option = long_option;
2686801Sache  m_option_definition.short_option = short_option;
2786801Sache  m_option_definition.validator = nullptr;
2886801Sache  m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
2986801Sache  m_option_definition.enum_values = {};
3086801Sache  m_option_definition.completion_type = completion_type;
3186801Sache  m_option_definition.argument_type = argument_type;
3286801Sache  m_option_definition.usage_text = usage_text;
3386801Sache}
3486801Sache
3586801SacheStatus OptionGroupString::SetOptionValue(uint32_t option_idx,
3686801Sache                                         llvm::StringRef option_arg,
3786801Sache                                         ExecutionContext *execution_context) {
3886801Sache  Status error(m_value.SetValueFromString(option_arg));
3986801Sache  return error;
4086801Sache}
4186801Sache
4286801Sachevoid OptionGroupString::OptionParsingStarting(
4386801Sache    ExecutionContext *execution_context) {
4486801Sache  m_value.Clear();
4586801Sache}
4686801Sache