blob: b1b3c77ee2d4ff62be8906061c5754e16fdc581c [file] [log] [blame]
Greg Claytone1f50b92011-05-03 22:09:39 +00001//===-- 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 Chena0f34692011-05-13 20:21:08 +000010#include "lldb/Interpreter/OptionGroupUUID.h"
Greg Claytone1f50b92011-05-03 22:09:39 +000011
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15// Project includes
16
17using namespace lldb;
18using namespace lldb_private;
19
20OptionGroupUUID::OptionGroupUUID() :
21 m_uuid ()
22{
23}
24
25OptionGroupUUID::~OptionGroupUUID ()
26{
27}
28
29static OptionDefinition
30g_option_table[] =
31{
32{ LLDB_OPT_SET_1 , false, "uuid", 'u', required_argument, NULL, 0, eArgTypeNone, "A module UUID value."},
33};
34
35const uint32_t k_num_file_options = sizeof(g_option_table)/sizeof(OptionDefinition);
36
37uint32_t
38OptionGroupUUID::GetNumDefinitions ()
39{
40 return k_num_file_options;
41}
42
43const OptionDefinition *
44OptionGroupUUID::GetDefinitions ()
45{
46 return g_option_table;
47}
48
49Error
50OptionGroupUUID::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
71void
72OptionGroupUUID::OptionParsingStarting (CommandInterpreter &interpreter)
73{
74 m_uuid.Clear();
75}