]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUUID.cpp
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / llvm / tools / lldb / source / Interpreter / OptionGroupUUID.cpp
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
10 #include "lldb/Interpreter/OptionGroupUUID.h"
11
12 // C Includes
13 // C++ Includes
14 // Other libraries and framework includes
15 // Project includes
16 #include "lldb/Utility/Utils.h"
17
18 using namespace lldb;
19 using namespace lldb_private;
20
21 OptionGroupUUID::OptionGroupUUID() :
22     m_uuid ()
23 {
24 }
25
26 OptionGroupUUID::~OptionGroupUUID ()
27 {
28 }
29
30 static OptionDefinition
31 g_option_table[] =
32 {
33     { LLDB_OPT_SET_1 , false, "uuid", 'u', required_argument, NULL, 0, eArgTypeNone, "A module UUID value."},
34 };
35
36 uint32_t
37 OptionGroupUUID::GetNumDefinitions ()
38 {
39     return llvm::array_lengthof(g_option_table);
40 }
41
42 const OptionDefinition *
43 OptionGroupUUID::GetDefinitions ()
44 {
45     return g_option_table;
46 }
47
48 Error
49 OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter,
50                                  uint32_t option_idx,
51                                  const char *option_arg)
52 {
53     Error error;
54     const int short_option = g_option_table[option_idx].short_option;
55
56     switch (short_option)
57     {
58         case 'u':
59             error = m_uuid.SetValueFromCString (option_arg);
60             if (error.Success())
61                 m_uuid.SetOptionWasSet();
62             break;
63
64         default:
65             error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
66             break;
67     }
68
69     return error;
70 }
71
72 void
73 OptionGroupUUID::OptionParsingStarting (CommandInterpreter &interpreter)
74 {
75     m_uuid.Clear();
76 }