Greg Clayton | e1f50b9 | 2011-05-03 22:09:39 +0000 | [diff] [blame] | 1 | //===-- OptionGroupFile.cpp -------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Johnny Chen | a0f3469 | 2011-05-13 20:21:08 +0000 | [diff] [blame] | 10 | #include "lldb/Interpreter/OptionGroupFile.h" |
Greg Clayton | e1f50b9 | 2011-05-03 22:09:39 +0000 | [diff] [blame] | 11 | |
| 12 | // C Includes |
| 13 | // C++ Includes |
| 14 | // Other libraries and framework includes |
| 15 | // Project includes |
| 16 | |
| 17 | using namespace lldb; |
| 18 | using namespace lldb_private; |
| 19 | |
| 20 | OptionGroupFile::OptionGroupFile (uint32_t usage_mask, |
| 21 | bool required, |
| 22 | const char *long_option, |
Greg Clayton | 6475c42 | 2012-12-04 00:32:51 +0000 | [diff] [blame] | 23 | int short_option, |
Greg Clayton | e1f50b9 | 2011-05-03 22:09:39 +0000 | [diff] [blame] | 24 | uint32_t completion_type, |
| 25 | lldb::CommandArgumentType argument_type, |
| 26 | const char *usage_text) : |
| 27 | m_file () |
| 28 | { |
| 29 | m_option_definition.usage_mask = usage_mask; |
| 30 | m_option_definition.required = required; |
| 31 | m_option_definition.long_option = long_option; |
| 32 | m_option_definition.short_option = short_option; |
| 33 | m_option_definition.option_has_arg = required_argument; |
| 34 | m_option_definition.enum_values = NULL; |
| 35 | m_option_definition.completion_type = completion_type; |
| 36 | m_option_definition.argument_type = argument_type; |
| 37 | m_option_definition.usage_text = usage_text; |
| 38 | } |
| 39 | |
| 40 | OptionGroupFile::~OptionGroupFile () |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | Error |
| 45 | OptionGroupFile::SetOptionValue (CommandInterpreter &interpreter, |
Greg Clayton | ec9c2d2 | 2012-11-30 19:05:35 +0000 | [diff] [blame] | 46 | uint32_t option_idx, |
| 47 | const char *option_arg) |
Greg Clayton | e1f50b9 | 2011-05-03 22:09:39 +0000 | [diff] [blame] | 48 | { |
| 49 | Error error (m_file.SetValueFromCString (option_arg)); |
| 50 | return error; |
| 51 | } |
| 52 | |
| 53 | void |
| 54 | OptionGroupFile::OptionParsingStarting (CommandInterpreter &interpreter) |
| 55 | { |
| 56 | m_file.Clear(); |
| 57 | } |
Greg Clayton | 801417e | 2011-07-07 01:59:51 +0000 | [diff] [blame] | 58 | |
| 59 | |
| 60 | OptionGroupFileList::OptionGroupFileList (uint32_t usage_mask, |
| 61 | bool required, |
| 62 | const char *long_option, |
Greg Clayton | 6475c42 | 2012-12-04 00:32:51 +0000 | [diff] [blame] | 63 | int short_option, |
Greg Clayton | 801417e | 2011-07-07 01:59:51 +0000 | [diff] [blame] | 64 | uint32_t completion_type, |
| 65 | lldb::CommandArgumentType argument_type, |
| 66 | const char *usage_text) : |
| 67 | m_file_list () |
| 68 | { |
| 69 | m_option_definition.usage_mask = usage_mask; |
| 70 | m_option_definition.required = required; |
| 71 | m_option_definition.long_option = long_option; |
| 72 | m_option_definition.short_option = short_option; |
| 73 | m_option_definition.option_has_arg = required_argument; |
| 74 | m_option_definition.enum_values = NULL; |
| 75 | m_option_definition.completion_type = completion_type; |
| 76 | m_option_definition.argument_type = argument_type; |
| 77 | m_option_definition.usage_text = usage_text; |
| 78 | } |
| 79 | |
| 80 | OptionGroupFileList::~OptionGroupFileList () |
| 81 | { |
| 82 | } |
| 83 | |
| 84 | Error |
| 85 | OptionGroupFileList::SetOptionValue (CommandInterpreter &interpreter, |
Greg Clayton | 6475c42 | 2012-12-04 00:32:51 +0000 | [diff] [blame] | 86 | uint32_t option_idx, |
| 87 | const char *option_arg) |
Greg Clayton | 801417e | 2011-07-07 01:59:51 +0000 | [diff] [blame] | 88 | { |
| 89 | Error error (m_file_list.SetValueFromCString (option_arg)); |
| 90 | return error; |
| 91 | } |
| 92 | |
| 93 | void |
| 94 | OptionGroupFileList::OptionParsingStarting (CommandInterpreter &interpreter) |
| 95 | { |
| 96 | m_file_list.Clear(); |
| 97 | } |