Engine → Assets → asset_pack.h
pack_writer
| Type | Class |
| Namespace | conjure::assets |
| Include File Path | engine/include/conjure/assets/asset_pack.h |
| Source File Path | engine/src/assets/asset_pack.cpp |
| API ↗ | Cooking, caches and packs, Assets |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | pack_writer(); | |
| public | pack_writer(
pack_writer &&) noexcept = default; |
Important
Copy constructor and assignment has been deleted.
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~pack_writer(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mEntries | std::vector<entry> | {} |
Functions
Public
add
add[[nodiscard]] core::result<void> add(
cooked_blob blob,
std::string_view assetPath);Adds a blob (re-verifying its payload hash) with the asset path recorded in the string table. CACHE_CORRUPT when the hash does not match, ALREADY_EXISTS for a uuid already added.
build
build[[nodiscard]] std::vector<std::byte> build(
pack_stats &outStats) const;Serialises the pack: sorts by uuid, deduplicates payloads by (hash, size, bytes).
build_manifest
build_manifest[[nodiscard]] std::string build_manifest() const;The manifest: a JSON array of {uuid, type, name, size, hash, dependencies[]} sorted by uuid, canonical form, newline terminated.
size
size[[nodiscard]] usize size() const noexcept;write
write[[nodiscard]] core::result<pack_stats> write(
core::vfs::file_system &fileSystem,
std::string_view packPath) const;Writes the pack through tmp + rename.
write_manifest
write_manifest[[nodiscard]] core::result<void> write_manifest(
core::vfs::file_system &fileSystem,
std::string_view manifestPath) const;Writes build_manifest() through tmp + rename.
Operator Overloads
Public
operator=
operator=pack_writer &operator=(
pack_writer &&) noexcept = default;