1#ifndef SPUDPLATE_SPUDPACK_H
2#define SPUDPLATE_SPUDPACK_H
25 std::vector<std::uint8_t>
data;
45 std::vector<std::uint8_t>
bytes;
61 std::vector<SpudpackDep>
deps;
77 std::optional<std::size_t>
offset() const noexcept {
return offset_; }
80 std::optional<std::size_t> offset_;
96std::vector<std::uint8_t> spudpack_encode(
const Spudpack& pack);
111Spudpack spudpack_decode(
const std::uint8_t* data, std::size_t size);
119void spudpack_write_file(
const std::filesystem::path& path,
const Spudpack& pack);
122Spudpack spudpack_read_file(
const std::filesystem::path& path);
133std::string normalize_asset_path(std::string_view raw);
141bool is_normalized_asset_path(std::string_view path)
noexcept;
150bool is_valid_dep_name(std::string_view name)
noexcept;
161inline constexpr std::string_view kArchiveDir =
".archive";
170std::filesystem::path archive_path_for(
const std::filesystem::path& install_root,
171 std::string_view name,
172 std::uint32_t version_tag);
Raised on any encode or decode failure.
Definition spudpack.h:72
std::optional< std::size_t > offset() const noexcept
Byte offset where decoding failed, if known.
Definition spudpack.h:77
One bundled asset entry inside a spudpack.
Definition spudpack.h:22
std::uint16_t mode
POSIX mode bits, masked to 0o0777.
Definition spudpack.h:24
std::vector< std::uint8_t > data
Raw asset bytes; empty for an empty leaf directory.
Definition spudpack.h:25
std::string path
Normalised asset path inside the pack.
Definition spudpack.h:23
One bundled dependency inside a spudpack.
Definition spudpack.h:43
std::uint32_t version_tag
Monotonic install counter the dep carried when bundled. Defaults to 1 for v3 decodes.
Definition spudpack.h:46
std::string name
Bare include name, matching <name>.spp on the install root.
Definition spudpack.h:44
std::vector< std::uint8_t > bytes
Full byte stream of the bundled dep's spudpack.
Definition spudpack.h:45
A decoded spudpack - the source text, the opaque compiled program, every bundled asset,...
Definition spudpack.h:57
std::vector< std::uint8_t > program_bytes
Opaque serialised AST; decoded by the binary serializer.
Definition spudpack.h:59
std::uint8_t version
Spudpack format version that produced these bytes. Threaded into the binary serializer so trailing-op...
Definition spudpack.h:62
std::string source
Original .spud source text.
Definition spudpack.h:58
std::uint32_t version_tag
Monotonic install counter for this template. Bumped on each install that produces different content....
Definition spudpack.h:63
std::vector< SpudpackAsset > assets
Every bundled asset referenced by the program.
Definition spudpack.h:60
std::vector< SpudpackDep > deps
Every bundled dependency referenced by include statements.
Definition spudpack.h:61