RASCSI/cpp/scsictl/scsictl_parser.cpp
Daniel Markstedt 52c2aa474f
Rebrand project to PiSCSI (#1016)
* Rebrand project to PiSCSI
- rascsi ->piscsi
- rasctl -> scsictl
- rasdump -> scsidump
- ras* -> piscsi* (rasutil -> piscsi_util, etc.)

* Refined the formatting and wording of the app startup banner
* Kept some references to rascsi and rasctl where backwards compatibility is concerned
* Point to the new github repo URL

Co-authored-by: nucleogenic <nr@nucleogenic.com>
Co-authored-by: Uwe Seimet <Uwe.Seimet@seimet.de>
2022-12-05 09:58:23 -08:00

31 lines
874 B
C++

//---------------------------------------------------------------------------
//
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2022 Uwe Seimet
//
//---------------------------------------------------------------------------
#include "scsictl_parser.h"
PbOperation ScsictlParser::ParseOperation(const string& 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 = 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;
}