Skip to content

Engine → Assets → asset_pack.h

pack_writer

Syntax

class CONJURE_API pack_writer

Constructors

AccessSignatureDescription
publicpack_writer();
publicpack_writer( pack_writer &&) noexcept = default;

Important

Copy constructor and assignment has been deleted.

Destructors

AccessSignatureDescription
public~pack_writer();

Variables

AccessNameTypeDefaultDescription
privatemEntriesstd::vector<entry>{}

Functions

Public

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

[[nodiscard]] std::vector<std::byte> build(
    pack_stats &outStats) const;

Serialises the pack: sorts by uuid, deduplicates payloads by (hash, size, bytes).

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

[[nodiscard]] usize size() const noexcept;

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

[[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=

pack_writer &operator=(
    pack_writer &&) noexcept = default;