EuropaTools/include/europa/io/PakReader.hpp
modeco80 a95d104e7f *: Introduce "eupak" utility
I have been preparing for this for a while. Instead of having a bunch
of strewn out utilities, let's just have one solid multitool
which is nice to use.

This commit also removes europa_pack_extractor, as it's now unnesscary
and replaced with a better utility, that does more.

Creation wasn't implemented yet, but I really need to sleep. It can be done later, and pakcreate can be used as a temporary stopgap.
2022-09-22 05:43:35 -05:00

55 lines
1,010 B
C++

//
// EuropaTools
//
// (C) 2021-2022 modeco80 <lily.modeco80@protonmail.ch>
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#ifndef EUROPA_IO_PAKREADER_H
#define EUROPA_IO_PAKREADER_H
#include <europa/io/PakFile.hpp>
#include <europa/structs/Pak.hpp>
#include <iosfwd>
#include <string>
#include <unordered_map>
namespace europa::io {
struct PakReader {
using MapType = std::unordered_map<std::string, PakFile>;
explicit PakReader(std::istream& is);
void ReadData();
void ReadFiles();
/**
* Read in a specific file.
*/
void ReadFile(const std::string& file);
bool Invalid() const {
return invalid;
}
MapType& GetFiles();
const MapType& GetFiles() const;
// implement in cpp later, lazy and just wanna get this out :vvv
const structs::PakHeader& GetHeader() const { return header; }
private:
std::istream& stream;
bool invalid { false };
structs::PakHeader header {};
MapType files;
};
} // namespace europa::io
#endif // EUROPA_IO_PAKREADER_H