Add callback option for extract all

This commit is contained in:
Georg Hagen
2025-02-09 17:32:19 +01:00
parent b72962e27f
commit 5c132ecd77
2 changed files with 14 additions and 0 deletions

View File

@@ -217,6 +217,18 @@ namespace OpenVulkano
return count; return count;
} }
size_t ArchiveReader::ExtractRemaining(const std::filesystem::path& targetDir, const std::function<void(const FileDescription&)> extractionCallback)
{
size_t count = 0;
std::optional<FileDescription> fd;
while (fd = ExtractNext(targetDir))
{
extractionCallback(fd.value());
count++;
}
return count;
}
bool ArchiveReader::HasNext() const bool ArchiveReader::HasNext() const
{ {
return m_archiveEntry != nullptr; return m_archiveEntry != nullptr;

View File

@@ -56,6 +56,8 @@ namespace OpenVulkano
size_t ExtractRemaining(const std::filesystem::path& targetDir); size_t ExtractRemaining(const std::filesystem::path& targetDir);
size_t ExtractRemaining(const std::filesystem::path& targetDir, const std::function<void(const FileDescription&)> extractionCallback);
// Element wise operations // Element wise operations
[[nodiscard]] bool HasNext() const; [[nodiscard]] bool HasNext() const;