#pragma once #include #include #include #include #include class DDLArchive { public: struct FileRec { uint32_t offset; std::filesystem::path source; }; using Directory = std::map >; bool open(std::filesystem::path ar_file); const Directory &get_directory() const {return _directory;} const std::filesystem::path& get_ar_file() const {return _ar_file;} struct Extracted { std::string_view name; bool found; std::vector data; }; template CB> void extract(Iter from, Iter to, CB &&cb) { std::ifstream f = begin_read(); while (from != to) { std::string_view n = *from; cb(extract_file(f, n)); ++from; } } protected: std::filesystem::path _ar_file; Directory _directory; std::ifstream begin_read(); Extracted extract_file(std::ifstream &s, std::string_view fname); };