2022-09-05 20:59:46 -04:00
|
|
|
//
|
|
|
|
// EuropaTools
|
|
|
|
//
|
|
|
|
// (C) 2021-2022 modeco80 <lily.modeco80@protonmail.ch>
|
|
|
|
//
|
2022-09-21 03:49:57 -04:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2022-09-05 20:59:46 -04:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef EUROPA_IO_PAKWRITER_H
|
|
|
|
#define EUROPA_IO_PAKWRITER_H
|
|
|
|
|
2022-09-21 03:59:16 -04:00
|
|
|
#include <europa/io/PakFile.hpp>
|
2022-09-22 20:07:56 -04:00
|
|
|
#include <europa/io/PakProgressReportSink.hpp>
|
2022-09-05 20:59:46 -04:00
|
|
|
#include <iosfwd>
|
|
|
|
#include <string>
|
2022-09-22 20:15:06 -04:00
|
|
|
#include <utility>
|
2023-08-01 18:18:40 -04:00
|
|
|
#include "europa/structs/Pak.hpp"
|
2022-09-05 20:59:46 -04:00
|
|
|
|
|
|
|
namespace europa::io {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Writer for package files.
|
|
|
|
*/
|
|
|
|
struct PakWriter {
|
2022-09-22 20:15:06 -04:00
|
|
|
using FlattenedType = std::pair<std::string, PakFile>;
|
2022-09-05 20:59:46 -04:00
|
|
|
|
2023-08-01 18:18:40 -04:00
|
|
|
//void Init(structs::PakHeader::Version version);
|
2022-09-22 13:32:28 -04:00
|
|
|
|
2023-08-01 18:18:40 -04:00
|
|
|
//const HeaderType& GetHeader() const { return pakHeader; }
|
|
|
|
|
|
|
|
void SetVersion(structs::PakVersion version);
|
2022-09-05 20:59:46 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Write the resulting archive to the given output stream.
|
|
|
|
*/
|
2022-09-22 20:15:06 -04:00
|
|
|
void Write(std::ostream& os, std::vector<FlattenedType>&& vec, PakProgressReportSink& sink);
|
2022-09-05 20:59:46 -04:00
|
|
|
|
2022-09-07 05:07:40 -04:00
|
|
|
private:
|
2023-08-01 18:18:40 -04:00
|
|
|
|
|
|
|
template<class T>
|
|
|
|
void WriteImpl(std::ostream& os, std::vector<FlattenedType>&& vec, PakProgressReportSink& sink, bool sectorAligned = true);
|
|
|
|
|
|
|
|
structs::PakVersion version{};
|
|
|
|
//HeaderType pakHeader {};
|
2022-09-05 20:59:46 -04:00
|
|
|
};
|
|
|
|
|
2022-09-07 05:07:40 -04:00
|
|
|
} // namespace europa::io
|
2022-09-05 20:59:46 -04:00
|
|
|
|
|
|
|
#endif // EUROPA_IO_PAKWRITER_H
|