Porytiles
Loading...
Searching...
No Matches
project_tileset_artifact_writer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "gsl/pointers"
4
11
12namespace porytiles2 {
13
22 public:
24 gsl::not_null<InfraConfig *> config,
25 std::filesystem::path project_root,
26 gsl::not_null<PngRgbaImageSaver *> png_rgba_saver,
27 gsl::not_null<PngIndexedImageSaver *> png_indexed_saver,
28 gsl::not_null<FilePalSaver *> pal_saver)
29 : config_{config}, project_root_{std::move(project_root)}, png_rgba_saver_{png_rgba_saver},
30 png_indexed_saver_{png_indexed_saver}, pal_saver_{pal_saver}
31 {
32 }
33
34 [[nodiscard]] Result<void> begin_transaction() override;
35
36 [[nodiscard]] ChainableResult<void> commit() override;
37
38 [[nodiscard]] Result<void> rollback() override;
39
40 [[nodiscard]] ChainableResult<void>
41 write(const ArtifactKey &dest_key, const TilesetArtifact &artifact, const Tileset &src) override;
42
43 private:
44 InfraConfig *config_;
45 std::filesystem::path project_root_;
46 std::filesystem::path transaction_root_;
47 PngRgbaImageSaver *png_rgba_saver_;
48 PngIndexedImageSaver *png_indexed_saver_;
49 FilePalSaver *pal_saver_;
50};
51
52} // namespace porytiles2
A type-safe wrapper for artifact keys.
A result type that maintains a chainable sequence of errors for debugging and error reporting.
A service interface that saves a Palette to a given file.
Interface that defines a complete infra layer configuration.
An image saver that saves PNG files from an Image with an index pixel type.
An image saver that saves PNG files from an Image with an Rgba32 pixel type.
Provides a filesystem-based implementation for TilesetArtifactWriter.
Result< void > rollback() override
Rolls back all buffered write operations in the current transaction.
ChainableResult< void > write(const ArtifactKey &dest_key, const TilesetArtifact &artifact, const Tileset &src) override
Writes an artifact from a Tileset to the backing store.
ChainableResult< void > commit() override
Commits all buffered write operations in the current transaction.
ProjectTilesetArtifactWriter(gsl::not_null< InfraConfig * > config, std::filesystem::path project_root, gsl::not_null< PngRgbaImageSaver * > png_rgba_saver, gsl::not_null< PngIndexedImageSaver * > png_indexed_saver, gsl::not_null< FilePalSaver * > pal_saver)
Result< void > begin_transaction() override
Begins a new transaction for atomic write operations.
Abstract interface for writing tileset artifacts from a Tileset object to a backing store.
Represents a Pokémon Generation III decomp tileset artifact with type and optional metadata.
A complete tileset containing both Porytiles and Porymap components.
Definition tileset.hpp:14
std::expected< T, E > Result
A result with some type T on success, otherwise an error of type E.
Definition result.hpp:25