Logbokk fligth type
This commit is contained in:
@@ -35,6 +35,7 @@ namespace file
|
||||
inline void readVersion1(std::ifstream &in)
|
||||
{
|
||||
std::string date = readString(in, 10);
|
||||
std::string flightType = readString(in, 1);
|
||||
std::string flightNumber = readString(in, 4);
|
||||
std::string aircraftType = readString(in, 4);
|
||||
std::string aircraftRegistration = readString(in, 6);
|
||||
@@ -65,6 +66,7 @@ namespace file
|
||||
std::uint8_t flags = read<std::uint8_t>(in);
|
||||
|
||||
this->addEntry(date,
|
||||
flightType,
|
||||
flightNumber,
|
||||
aircraftType,
|
||||
aircraftRegistration,
|
||||
@@ -99,7 +101,7 @@ namespace file
|
||||
{
|
||||
std::ifstream in(BASE_DIRECTORY LOGBOOK, std::ifstream::binary);
|
||||
|
||||
std::string ident = readString(in, 5);
|
||||
std::string ident = readString(in, 4);
|
||||
if (ident.compare(LOGBOOK_HEADER) != 0) {
|
||||
throw std::invalid_argument("Wrong file");
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace file
|
||||
namespace logbook
|
||||
{
|
||||
/*
|
||||
* Preamble (24)
|
||||
* CHAR[10] | CHAR[4] | CHAR[4] | CHAR[6]
|
||||
* ---------+---------------+----------+-------------
|
||||
* DATE | FLIGHT NUMBER | AIRCRAFT | REGISTRATION
|
||||
* Preamble (25)
|
||||
* CHAR[10] | CHAR[1] | CHAR[4] | CHAR[4] | CHAR[6]
|
||||
* ---------+-------------+---------------+----------+-------------
|
||||
* DATE | FLIGHT TYPE | FLIGHT NUMBER | AIRCRAFT | REGISTRATION
|
||||
|
||||
* Departure Airport Name (1...257)
|
||||
* UINT8 | CHAR[]
|
||||
@@ -89,6 +89,7 @@ namespace file
|
||||
{
|
||||
private:
|
||||
std::string date;
|
||||
std::string flightType;
|
||||
std::string flightNumber;
|
||||
std::string aircraftType;
|
||||
std::string aircraftRegistration;
|
||||
@@ -120,6 +121,7 @@ namespace file
|
||||
|
||||
public:
|
||||
inline LogbookEntry(std::string date,
|
||||
std::string flightType,
|
||||
std::string flightNumber,
|
||||
std::string aircraftType,
|
||||
std::string aircraftRegistration,
|
||||
@@ -148,7 +150,7 @@ namespace file
|
||||
std::string recordingFilename,
|
||||
float points,
|
||||
std::uint8_t flags)
|
||||
: date(date), flightNumber(flightNumber),
|
||||
: date(date), flightType(flightType), flightNumber(flightNumber),
|
||||
aircraftType(aircraftType),
|
||||
aircraftRegistration(aircraftRegistration),
|
||||
departureAirport(departureAirport), departureGate(departureGate),
|
||||
@@ -170,6 +172,7 @@ namespace file
|
||||
inline void toFile(std::ofstream &out) const
|
||||
{
|
||||
writeString(out, this->date, 10);
|
||||
writeString(out, this->flightType, 1);
|
||||
writeString(out, this->flightNumber, 4);
|
||||
writeString(out, this->aircraftType, 4);
|
||||
writeString(out, this->aircraftRegistration, 6);
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace file
|
||||
{
|
||||
std::ifstream in(BASE_DIRECTORY SIMDATABASE, std::ifstream::binary);
|
||||
|
||||
std::string ident = readString(in, 5);
|
||||
std::string ident = readString(in, 4);
|
||||
if (ident.compare(SIMDATABASE_HEADER) != 0) {
|
||||
throw std::invalid_argument("Wrong file");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user