mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
favour of pod objects, which allows STL contains. Lots of shared_ptrs everywhere. Much simpler and more effective code. The reader works with one of the decoders; still have to do the rest of them and the encoders.
33 lines
999 B
C++
33 lines
999 B
C++
#include "globals.h"
|
|
#include "sector.h"
|
|
#include "fmt/format.h"
|
|
|
|
const std::string Sector::statusToString(Status status)
|
|
{
|
|
switch (status)
|
|
{
|
|
case Status::OK: return "OK";
|
|
case Status::BAD_CHECKSUM: return "bad checksum";
|
|
case Status::MISSING: return "sector not found";
|
|
case Status::DATA_MISSING: return "present but no data found";
|
|
case Status::CONFLICT: return "conflicting data";
|
|
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;
|
|
}
|
|
|