EntropyEngine::Core::IO::PackageReader
EntropyEngine::Core::IO::PackageReader
Section titled “EntropyEngine::Core::IO::PackageReader”Reads assets from EntropyPackage files. More…
#include <PackageReader.h>
Public Classes
Section titled “Public Classes”| Name | |
|---|---|
| struct | Impl |
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| ~PackageReader() | |
| std::string_view | sceneRoot() const Get the scene root path. |
| PackageResult< std::vector< uint8_t > > | read(std::string_view virtualPath) Read and decompress an asset. |
| const std::filesystem::path & | path() const Get the path to the opened package file. |
| PackageReader & | operator=(const PackageReader & ) =delete |
| PackageReader & | operator=(PackageReader && ) |
| PackageResult< std::unique_ptr< PackageReader > > | open(const std::filesystem::path & path) Open an unencrypted package. |
| PackageResult< std::unique_ptr< PackageReader > > | open(const std::filesystem::path & path, std::span< const uint8_t, 32 > symmetricKey) Open an encrypted package. |
| const PackageManifest & | manifest() const Get the package manifest. |
| std::vector< std::string > | listDirectory(std::string_view directory) const List files in a virtual directory. |
| std::vector< AssetInfo > | list() const Get all assets in the package. |
| bool | isEncrypted() const Check if package is encrypted. |
| std::optional< AssetInfo > | getInfo(std::string_view virtualPath) const Get asset info without reading content. |
| bool | exists(std::string_view virtualPath) const Check if a virtual path exists in the package. |
| PackageReader(const PackageReader & ) =delete | |
| PackageReader(PackageReader && ) |
Detailed Description
Section titled “Detailed Description”class EntropyEngine::Core::IO::PackageReader;Reads assets from EntropyPackage files.
Thread-safe for concurrent read operations. Memory-maps the package file for efficient streaming access to individual assets.
Usage:
auto result = PackageReader::open("content.epak");if (result.failed()) { // Handle error}auto& reader = result.value;
// List assetsfor (const auto& asset : reader->list()) { std::cout << asset.path << " (" << asset.uncompressedSize << " bytes)\n";}
// Read an assetauto data = reader->read("meshes/character.mesh");if (data.success()) { // Use data.value}Public Functions Documentation
Section titled “Public Functions Documentation”function ~PackageReader
Section titled “function ~PackageReader”~PackageReader()function sceneRoot
Section titled “function sceneRoot”std::string_view sceneRoot() constGet the scene root path.
function read
Section titled “function read”PackageResult< std::vector< uint8_t > > read( std::string_view virtualPath)Read and decompress an asset.
Parameters:
- virtualPath Path within the package
Return: Result containing decompressed data or error
Automatically decrypts if package is encrypted and verifies hash.
function path
Section titled “function path”const std::filesystem::path & path() constGet the path to the opened package file.
function operator=
Section titled “function operator=”PackageReader & operator=( const PackageReader &) =deletefunction operator=
Section titled “function operator=”PackageReader & operator=( PackageReader &&)function open
Section titled “function open”static PackageResult< std::unique_ptr< PackageReader > > open( const std::filesystem::path & path)Open an unencrypted package.
Parameters:
- path Path to .epak file
Return: Result containing reader or error
function open
Section titled “function open”static PackageResult< std::unique_ptr< PackageReader > > open( const std::filesystem::path & path, std::span< const uint8_t, 32 > symmetricKey)Open an encrypted package.
Parameters:
- path Path to .epak file
- symmetricKey 32-byte AES-256 key
Return: Result containing reader or error
function manifest
Section titled “function manifest”const PackageManifest & manifest() constGet the package manifest.
function listDirectory
Section titled “function listDirectory”std::vector< std::string > listDirectory( std::string_view directory) constList files in a virtual directory.
Parameters:
- directory Virtual directory path (e.g., “meshes/”)
Return: Paths of files in that directory (not recursive)
function list
Section titled “function list”std::vector< AssetInfo > list() constGet all assets in the package.
function isEncrypted
Section titled “function isEncrypted”bool isEncrypted() constCheck if package is encrypted.
function getInfo
Section titled “function getInfo”std::optional< AssetInfo > getInfo( std::string_view virtualPath) constGet asset info without reading content.
function exists
Section titled “function exists”bool exists( std::string_view virtualPath) constCheck if a virtual path exists in the package.
function PackageReader
Section titled “function PackageReader”PackageReader( const PackageReader &) =deletefunction PackageReader
Section titled “function PackageReader”PackageReader( PackageReader &&)Updated on 2026-01-26 at 16:50:32 -0500