Skip to content

Instantly share code, notes, and snippets.

@RChehowski
Created February 8, 2021 21:23
Show Gist options
  • Save RChehowski/24e75ed8c09a76a26e7849374d6d8882 to your computer and use it in GitHub Desktop.
Save RChehowski/24e75ed8c09a76a26e7849374d6d8882 to your computer and use it in GitHub Desktop.
//
// Created by ASUS on 30/12/2020.
//
#include "Platform/Misc.h"
#include <optional>
#include <Allocation.h>
class CFileEntry
{
public:
const std::string& GetFileName() const
{
return FileName;
}
const Util::CAllocation& GetAllocation() const
{
if (!OptionalAllocation.has_value())
{
// Lazy
// Read into OptionalAllocation from ZipFileHandle
}
return *OptionalAllocation;
}
private:
std::string FileName;
mutable std::optional<Util::CAllocation> OptionalAllocation;
void* ZipFileHandle = nullptr;
};
class CZipFilesystem
{
void Walk(const std::string& PathToArchive, std::function<void(const CFileEntry&)> Consumer)
{
// Open PathToArchive
// For each Entry -> Consumer(Entry)
// Close archive
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment