mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-28 08:30:21 +00:00
41bdcd4aed
* Update logging * Remove duplicate code * Update unit tests * Clean up includes * Merge ProtobufSerializer into protobuf_util namespace * Precompile regex * Add const * Add Split() convenience method, update log level/ID parsing * Move log.h to legacy folder * Elimininate gotos * Fixes for gcc 13 * Update compiler flags * Update default folder handling * Use references instead of pointers * Move code for better encapsulation * Move code * Remove unused method argument * Move device logger * Remove redundant to_string * Rename for consistency * Update handling of protobuf pointers * Simplify protobuf usage * Memory handling update * Add hasher
31 lines
871 B
C++
31 lines
871 B
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022-2023 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include "scsictl_parser.h"
|
|
|
|
PbOperation ScsictlParser::ParseOperation(string_view operation) const
|
|
{
|
|
const auto& it = operations.find(tolower(operation[0]));
|
|
return it != operations.end() ? it->second : NO_OPERATION;
|
|
}
|
|
|
|
PbDeviceType ScsictlParser::ParseType(const string& type) const
|
|
{
|
|
string t;
|
|
ranges::transform(type, back_inserter(t), ::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;
|
|
}
|