1effe5c95SGreg Clayton //===-- OptionGroupUUID.cpp -------------------------------------*- C++ -*-===// 2effe5c95SGreg Clayton // 3effe5c95SGreg Clayton // The LLVM Compiler Infrastructure 4effe5c95SGreg Clayton // 5effe5c95SGreg Clayton // This file is distributed under the University of Illinois Open Source 6effe5c95SGreg Clayton // License. See LICENSE.TXT for details. 7effe5c95SGreg Clayton // 8effe5c95SGreg Clayton //===----------------------------------------------------------------------===// 9effe5c95SGreg Clayton 104bee32e5SJohnny Chen #include "lldb/Interpreter/OptionGroupUUID.h" 11effe5c95SGreg Clayton 12effe5c95SGreg Clayton // C Includes 13effe5c95SGreg Clayton // C++ Includes 14effe5c95SGreg Clayton // Other libraries and framework includes 15effe5c95SGreg Clayton // Project includes 167c575b3bSJohnny Chen #include "lldb/Utility/Utils.h" 17effe5c95SGreg Clayton 18effe5c95SGreg Clayton using namespace lldb; 19effe5c95SGreg Clayton using namespace lldb_private; 20effe5c95SGreg Clayton 21effe5c95SGreg Clayton OptionGroupUUID::OptionGroupUUID() : 22effe5c95SGreg Clayton m_uuid () 23effe5c95SGreg Clayton { 24effe5c95SGreg Clayton } 25effe5c95SGreg Clayton 26effe5c95SGreg Clayton OptionGroupUUID::~OptionGroupUUID () 27effe5c95SGreg Clayton { 28effe5c95SGreg Clayton } 29effe5c95SGreg Clayton 30effe5c95SGreg Clayton static OptionDefinition 31effe5c95SGreg Clayton g_option_table[] = 32effe5c95SGreg Clayton { 33effe5c95SGreg Clayton { LLDB_OPT_SET_1 , false, "uuid", 'u', required_argument, NULL, 0, eArgTypeNone, "A module UUID value."}, 34effe5c95SGreg Clayton }; 35effe5c95SGreg Clayton 36effe5c95SGreg Clayton uint32_t 37effe5c95SGreg Clayton OptionGroupUUID::GetNumDefinitions () 38effe5c95SGreg Clayton { 396ebc8c45SJohnny Chen return llvm::array_lengthof(g_option_table); 40effe5c95SGreg Clayton } 41effe5c95SGreg Clayton 42effe5c95SGreg Clayton const OptionDefinition * 43effe5c95SGreg Clayton OptionGroupUUID::GetDefinitions () 44effe5c95SGreg Clayton { 45effe5c95SGreg Clayton return g_option_table; 46effe5c95SGreg Clayton } 47effe5c95SGreg Clayton 48effe5c95SGreg Clayton Error 49effe5c95SGreg Clayton OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter, 50effe5c95SGreg Clayton uint32_t option_idx, 51effe5c95SGreg Clayton const char *option_arg) 52effe5c95SGreg Clayton { 53effe5c95SGreg Clayton Error error; 54*3bcdfc0eSGreg Clayton const int short_option = g_option_table[option_idx].short_option; 55effe5c95SGreg Clayton 56effe5c95SGreg Clayton switch (short_option) 57effe5c95SGreg Clayton { 58effe5c95SGreg Clayton case 'u': 59effe5c95SGreg Clayton error = m_uuid.SetValueFromCString (option_arg); 602af4db58SJim Ingham if (error.Success()) 612af4db58SJim Ingham m_uuid.SetOptionWasSet(); 62effe5c95SGreg Clayton break; 63effe5c95SGreg Clayton 64effe5c95SGreg Clayton default: 6586edbf41SGreg Clayton error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); 66effe5c95SGreg Clayton break; 67effe5c95SGreg Clayton } 68effe5c95SGreg Clayton 69effe5c95SGreg Clayton return error; 70effe5c95SGreg Clayton } 71effe5c95SGreg Clayton 72effe5c95SGreg Clayton void 73effe5c95SGreg Clayton OptionGroupUUID::OptionParsingStarting (CommandInterpreter &interpreter) 74effe5c95SGreg Clayton { 75effe5c95SGreg Clayton m_uuid.Clear(); 76effe5c95SGreg Clayton } 77