mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-21 23:29:39 +00:00
31 lines
880 B
C++
31 lines
880 B
C++
|
//---------------------------------------------------------------------------
|
||
|
//
|
||
|
// SCSI Target Emulator RaSCSI Reloaded
|
||
|
// for Raspberry Pi
|
||
|
//
|
||
|
// Copyright (C) 2022 Uwe Seimet
|
||
|
//
|
||
|
//---------------------------------------------------------------------------
|
||
|
|
||
|
#include "rasctl_parser.h"
|
||
|
|
||
|
PbOperation RasctlParser::ParseOperation(const string& operation) const
|
||
|
{
|
||
|
const auto& it = operations.find(tolower(operation[0]));
|
||
|
return it != operations.end() ? it->second : NO_OPERATION;
|
||
|
}
|
||
|
|
||
|
PbDeviceType RasctlParser::ParseType(const string& type) const
|
||
|
{
|
||
|
string t = type;
|
||
|
transform(t.begin(), t.end(), t.begin(), ::toupper);
|
||
|
|
||
|
if (PbDeviceType parsed_type; PbDeviceType_Parse(t, &parsed_type)) {
|
||
|
return parsed_type;
|
||
|
}
|
||
|
|
||
|
// Handle convenience device types (shortcuts)
|
||
|
const auto& it = device_types.find(tolower(type[0]));
|
||
|
return it != device_types.end() ? it->second : UNDEFINED;
|
||
|
}
|