Greg Clayton | e1f50b9 | 2011-05-03 22:09:39 +0000 | [diff] [blame] | 1 | //===-- OptionGroupUUID.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/OptionGroupUUID.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 | OptionGroupUUID::OptionGroupUUID() : |
| 21 | m_uuid () |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | OptionGroupUUID::~OptionGroupUUID () |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | static OptionDefinition |
| 30 | g_option_table[] = |
| 31 | { |
| 32 | { LLDB_OPT_SET_1 , false, "uuid", 'u', required_argument, NULL, 0, eArgTypeNone, "A module UUID value."}, |
| 33 | }; |
| 34 | |
| 35 | const uint32_t k_num_file_options = sizeof(g_option_table)/sizeof(OptionDefinition); |
| 36 | |
| 37 | uint32_t |
| 38 | OptionGroupUUID::GetNumDefinitions () |
| 39 | { |
| 40 | return k_num_file_options; |
| 41 | } |
| 42 | |
| 43 | const OptionDefinition * |
| 44 | OptionGroupUUID::GetDefinitions () |
| 45 | { |
| 46 | return g_option_table; |
| 47 | } |
| 48 | |
| 49 | Error |
| 50 | OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter, |
| 51 | uint32_t option_idx, |
| 52 | const char *option_arg) |
| 53 | { |
| 54 | Error error; |
| 55 | char short_option = (char) g_option_table[option_idx].short_option; |
| 56 | |
| 57 | switch (short_option) |
| 58 | { |
| 59 | case 'u': |
| 60 | error = m_uuid.SetValueFromCString (option_arg); |
| 61 | break; |
| 62 | |
| 63 | default: |
| 64 | error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); |
| 65 | break; |
| 66 | } |
| 67 | |
| 68 | return error; |
| 69 | } |
| 70 | |
| 71 | void |
| 72 | OptionGroupUUID::OptionParsingStarting (CommandInterpreter &interpreter) |
| 73 | { |
| 74 | m_uuid.Clear(); |
| 75 | } |