/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #pragma once #include "ArchiveBase.hpp" #include "Data/Containers/Array.hpp" #include #include #include #include namespace openVulkanoCpp { class ArchiveReader final : public ArchiveBase { bool m_eof = false; void ReadNextHeader(); public: explicit ArchiveReader(const char* archiveFile, const std::shared_ptr& logger = nullptr); explicit ArchiveReader(const std::string& archiveFile, const std::shared_ptr& logger = nullptr); ArchiveReader(const void* archiveBuffer, size_t size, const std::shared_ptr& logger = nullptr); ~ArchiveReader() override; size_t ExtractRemaining(std::string_view targetDir); // Element wise operations [[nodiscard]] bool HasNext() const; void SkipNext(); bool SkipTill(std::filesystem::file_type type = std::filesystem::file_type::regular); [[nodiscard]] FileDescription GetNextDescription() const; std::optional GetNextDirectory(); std::optional ExtractNext(std::string_view targetDir); std::optional>> GetNextFile(); std::optional StreamNextFile(std::ostream& stream); bool GetNextFileAsStream(const std::function& streamReader); }; }