The standalone visualiser functions.

This commit is contained in:
David Given
2021-04-18 01:21:52 +02:00
parent c7eb8ad5c8
commit daf83db9b3
6 changed files with 120 additions and 5 deletions

View File

@@ -14,3 +14,18 @@ const std::string Sector::statusToString(Status status)
default: return fmt::format("unknown error {}", status);
}
}
Sector::Status Sector::stringToStatus(const std::string& value)
{
if (value == "OK")
return Status::OK;
if (value == "bad checksum")
return Status::BAD_CHECKSUM;
if ((value == "sector not found") || (value == "MISSING"))
return Status::MISSING;
if (value == "present but no data found")
return Status::DATA_MISSING;
if (value == "conflicting data")
return Status::CONFLICT;
return Status::INTERNAL_ERROR;
}