1*80814287SRaphael Isemann //===-- OptionGroupUInt64.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/OptionGroupUInt64.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 
OptionGroupUInt64(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,uint64_t default_value)16b9c1b51eSKate Stone OptionGroupUInt64::OptionGroupUInt64(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,
20effe5c95SGreg Clayton                                      const char *usage_text,
21b9c1b51eSKate Stone                                      uint64_t default_value)
22b9c1b51eSKate Stone     : m_value(default_value, default_value) {
23effe5c95SGreg Clayton   m_option_definition.usage_mask = usage_mask;
24effe5c95SGreg Clayton   m_option_definition.required = required;
25effe5c95SGreg Clayton   m_option_definition.long_option = long_option;
26effe5c95SGreg Clayton   m_option_definition.short_option = short_option;
27df734cddSZachary Turner   m_option_definition.validator = nullptr;
28e2607b50SVirgile Bello   m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
298fe53c49STatyana Krasnukha   m_option_definition.enum_values = {};
30effe5c95SGreg Clayton   m_option_definition.completion_type = completion_type;
31effe5c95SGreg Clayton   m_option_definition.argument_type = argument_type;
32effe5c95SGreg Clayton   m_option_definition.usage_text = usage_text;
33effe5c95SGreg Clayton }
34effe5c95SGreg Clayton 
SetOptionValue(uint32_t option_idx,llvm::StringRef option_arg,ExecutionContext * execution_context)3597206d57SZachary Turner Status OptionGroupUInt64::SetOptionValue(uint32_t option_idx,
368cef4b0bSZachary Turner                                          llvm::StringRef option_arg,
37b9c1b51eSKate Stone                                          ExecutionContext *execution_context) {
3897206d57SZachary Turner   Status error(m_value.SetValueFromString(option_arg));
39effe5c95SGreg Clayton   return error;
40effe5c95SGreg Clayton }
41effe5c95SGreg Clayton 
OptionParsingStarting(ExecutionContext * execution_context)42b9c1b51eSKate Stone void OptionGroupUInt64::OptionParsingStarting(
43b9c1b51eSKate Stone     ExecutionContext *execution_context) {
44effe5c95SGreg Clayton   m_value.Clear();
45effe5c95SGreg Clayton }
46