Greg Clayton | 307c7fd | 2012-10-19 22:22:57 +0000 | [diff] [blame] | 1 | //===-- OptionGroupString.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 | |
| 10 | #include "lldb/Interpreter/OptionGroupString.h" |
| 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 | OptionGroupString::OptionGroupString (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 | 307c7fd | 2012-10-19 22:22:57 +0000 | [diff] [blame] | 24 | uint32_t completion_type, |
| 25 | lldb::CommandArgumentType argument_type, |
| 26 | const char *usage_text, |
| 27 | const char *default_value) : |
| 28 | m_value (default_value, default_value) |
| 29 | { |
| 30 | m_option_definition.usage_mask = usage_mask; |
| 31 | m_option_definition.required = required; |
| 32 | m_option_definition.long_option = long_option; |
| 33 | m_option_definition.short_option = short_option; |
| 34 | m_option_definition.option_has_arg = required_argument; |
| 35 | m_option_definition.enum_values = NULL; |
| 36 | m_option_definition.completion_type = completion_type; |
| 37 | m_option_definition.argument_type = argument_type; |
| 38 | m_option_definition.usage_text = usage_text; |
| 39 | } |
| 40 | |
| 41 | OptionGroupString::~OptionGroupString () |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | Error |
| 46 | OptionGroupString::SetOptionValue (CommandInterpreter &interpreter, |
| 47 | uint32_t option_idx, |
| 48 | const char *option_arg) |
| 49 | { |
| 50 | Error error (m_value.SetValueFromCString (option_arg)); |
| 51 | return error; |
| 52 | } |
| 53 | |
| 54 | void |
| 55 | OptionGroupString::OptionParsingStarting (CommandInterpreter &interpreter) |
| 56 | { |
| 57 | m_value.Clear(); |
| 58 | } |