1ac7ddfbfSEd Maste //===-- OptionGroupFile.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/OptionGroupFile.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 
OptionGroupFile(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)17435933ddSDimitry Andric OptionGroupFile::OptionGroupFile(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,
21435933ddSDimitry Andric                                  const char *usage_text)
22435933ddSDimitry Andric     : m_file() {
23ac7ddfbfSEd Maste   m_option_definition.usage_mask = usage_mask;
24ac7ddfbfSEd Maste   m_option_definition.required = required;
25ac7ddfbfSEd Maste   m_option_definition.long_option = long_option;
26ac7ddfbfSEd Maste   m_option_definition.short_option = short_option;
270127ef0fSEd Maste   m_option_definition.validator = nullptr;
2835617911SEd Maste   m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
29*b5893f02SDimitry Andric   m_option_definition.enum_values = {};
30ac7ddfbfSEd Maste   m_option_definition.completion_type = completion_type;
31ac7ddfbfSEd Maste   m_option_definition.argument_type = argument_type;
32ac7ddfbfSEd Maste   m_option_definition.usage_text = usage_text;
33ac7ddfbfSEd Maste }
34ac7ddfbfSEd Maste 
~OptionGroupFile()35435933ddSDimitry Andric OptionGroupFile::~OptionGroupFile() {}
36ac7ddfbfSEd Maste 
SetOptionValue(uint32_t option_idx,llvm::StringRef option_arg,ExecutionContext * execution_context)375517e702SDimitry Andric Status OptionGroupFile::SetOptionValue(uint32_t option_idx,
38435933ddSDimitry Andric                                        llvm::StringRef option_arg,
39435933ddSDimitry Andric                                        ExecutionContext *execution_context) {
405517e702SDimitry Andric   Status error(m_file.SetValueFromString(option_arg));
41ac7ddfbfSEd Maste   return error;
42ac7ddfbfSEd Maste }
43ac7ddfbfSEd Maste 
OptionParsingStarting(ExecutionContext * execution_context)44435933ddSDimitry Andric void OptionGroupFile::OptionParsingStarting(
45435933ddSDimitry Andric     ExecutionContext *execution_context) {
46ac7ddfbfSEd Maste   m_file.Clear();
47ac7ddfbfSEd Maste }
48ac7ddfbfSEd Maste 
OptionGroupFileList(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)49435933ddSDimitry Andric OptionGroupFileList::OptionGroupFileList(
50435933ddSDimitry Andric     uint32_t usage_mask, bool required, const char *long_option,
51435933ddSDimitry Andric     int short_option, uint32_t completion_type,
52435933ddSDimitry Andric     lldb::CommandArgumentType argument_type, const char *usage_text)
53435933ddSDimitry Andric     : m_file_list() {
54ac7ddfbfSEd Maste   m_option_definition.usage_mask = usage_mask;
55ac7ddfbfSEd Maste   m_option_definition.required = required;
56ac7ddfbfSEd Maste   m_option_definition.long_option = long_option;
57ac7ddfbfSEd Maste   m_option_definition.short_option = short_option;
580127ef0fSEd Maste   m_option_definition.validator = nullptr;
5935617911SEd Maste   m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
60*b5893f02SDimitry Andric   m_option_definition.enum_values = {};
61ac7ddfbfSEd Maste   m_option_definition.completion_type = completion_type;
62ac7ddfbfSEd Maste   m_option_definition.argument_type = argument_type;
63ac7ddfbfSEd Maste   m_option_definition.usage_text = usage_text;
64ac7ddfbfSEd Maste }
65ac7ddfbfSEd Maste 
~OptionGroupFileList()66435933ddSDimitry Andric OptionGroupFileList::~OptionGroupFileList() {}
67ac7ddfbfSEd Maste 
685517e702SDimitry Andric Status
SetOptionValue(uint32_t option_idx,llvm::StringRef option_value,ExecutionContext * execution_context)695517e702SDimitry Andric OptionGroupFileList::SetOptionValue(uint32_t option_idx,
70435933ddSDimitry Andric                                     llvm::StringRef option_value,
71435933ddSDimitry Andric                                     ExecutionContext *execution_context) {
725517e702SDimitry Andric   Status error(m_file_list.SetValueFromString(option_value));
73ac7ddfbfSEd Maste   return error;
74ac7ddfbfSEd Maste }
75ac7ddfbfSEd Maste 
OptionParsingStarting(ExecutionContext * execution_context)76435933ddSDimitry Andric void OptionGroupFileList::OptionParsingStarting(
77435933ddSDimitry Andric     ExecutionContext *execution_context) {
78ac7ddfbfSEd Maste   m_file_list.Clear();
79ac7ddfbfSEd Maste }
80