EuropaTools/include/europa/io/PakReader.h

54 lines
875 B
C
Raw Normal View History

2022-09-04 17:11:14 -04:00
//
// EuropaTools
//
// (C) 2021-2022 modeco80 <lily.modeco80@protonmail.ch>
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//
#ifndef EUROPA_IO_PAKREADER_H
#define EUROPA_IO_PAKREADER_H
#include <europa/io/PakFile.h>
#include <europa/structs/Pak.h>
2022-09-04 17:11:14 -04:00
#include <iosfwd>
#include <string>
#include <unordered_map>
namespace europa::io {
struct PakReader {
using MapType = std::unordered_map<std::string, PakFile>;
2022-09-04 17:11:14 -04:00
explicit PakReader(std::istream& is);
void ReadData();
void ReadFiles();
/**
* Read in a specific file.
*/
void ReadFile(const std::string& file);
2022-09-04 17:11:14 -04:00
bool Invalid() const {
return invalid;
}
MapType& GetFiles();
const MapType& GetFiles() const;
2022-09-04 17:11:14 -04:00
private:
std::istream& stream;
bool invalid { false };
2022-09-04 17:11:14 -04:00
structs::PakHeader header {};
2022-09-04 17:11:14 -04:00
MapType files;
2022-09-04 17:11:14 -04:00
};
} // namespace europa::io
2022-09-04 17:11:14 -04:00
#endif // EUROPA_IO_PAKREADER_H