2022-09-08 02:02:09 +02:00

38 lines
757 B
C++

#ifndef GERMANAIRLINESVA_GACONNECTOR_LOGBOOK_H
#define GERMANAIRLINESVA_GACONNECTOR_LOGBOOK_H
#include <cstdint>
#include <fstream>
#include <string>
#include <vector>
#include "logbookEntry.h"
namespace germanairlinesva_logbook
{
/*
* Logbook Header (6)
* CHAR[5] | UINT8
* --------+--------
* VGAL | VERSION
*
* Logbook Entries (n)
* LOGBOOKENTRY[]
*/
class Logbook
{
private:
std::ifstream fileStream;
std::vector<std::uint8_t> file{'V', 'G', 'A', 'L', '\0', 1};
void fromFile();
void readVersion1();
public:
Logbook(std::ifstream &logbook);
void addEntry(LogbookEntry entry);
void toFile(std::ofstream &logbook);
};
} // namespace germanairlinesva_logbook
#endif