blob: 14bdc8494e45259a00c7dcd08884d73723fc79ee [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
Johnny Chen4003f572011-09-10 00:48:33 +000016#include "lldb/Utility/Utils.h"
Greg Claytone1f50b92011-05-03 22:09:39 +000017
18using namespace lldb;
19using namespace lldb_private;
20
21OptionGroupUUID::OptionGroupUUID() :
22 m_uuid ()
23{
24}
25
26OptionGroupUUID::~OptionGroupUUID ()
27{
28}
29
30static OptionDefinition
31g_option_table[] =
32{
Johnny Chen4003f572011-09-10 00:48:33 +000033 { LLDB_OPT_SET_1 , false, "uuid", 'u', required_argument, NULL, 0, eArgTypeNone, "A module UUID value."},
Greg Claytone1f50b92011-05-03 22:09:39 +000034};
35
Greg Claytone1f50b92011-05-03 22:09:39 +000036uint32_t
37OptionGroupUUID::GetNumDefinitions ()
38{
Johnny Chen08af5982012-05-15 23:21:36 +000039 return llvm::array_lengthof(g_option_table);
Greg Claytone1f50b92011-05-03 22:09:39 +000040}
41
42const OptionDefinition *
43OptionGroupUUID::GetDefinitions ()
44{
45 return g_option_table;
46}
47
48Error
49OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter,
Greg Clayton6475c422012-12-04 00:32:51 +000050 uint32_t option_idx,
51 const char *option_arg)
Greg Claytone1f50b92011-05-03 22:09:39 +000052{
53 Error error;
Greg Clayton6475c422012-12-04 00:32:51 +000054 const int short_option = g_option_table[option_idx].short_option;
Greg Claytone1f50b92011-05-03 22:09:39 +000055
56 switch (short_option)
57 {
58 case 'u':
59 error = m_uuid.SetValueFromCString (option_arg);
Jim Inghambb2218f2011-09-30 01:05:23 +000060 if (error.Success())
61 m_uuid.SetOptionWasSet();
Greg Claytone1f50b92011-05-03 22:09:39 +000062 break;
63
64 default:
Greg Clayton9c236732011-10-26 00:56:27 +000065 error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
Greg Claytone1f50b92011-05-03 22:09:39 +000066 break;
67 }
68
69 return error;
70}
71
72void
73OptionGroupUUID::OptionParsingStarting (CommandInterpreter &interpreter)
74{
75 m_uuid.Clear();
76}