Porytiles
Loading...
Searching...
No Matches
porytiles2::TilesetArtifactReader Class Referenceabstract

Abstract interface for reading tileset artifacts from a backing store into a Tileset object. More...

#include <tileset_artifact_reader.hpp>

Inheritance diagram for porytiles2::TilesetArtifactReader:
[legend]

Public Member Functions

virtual ~TilesetArtifactReader ()=default
 
virtual ChainableResult< void > read (Tileset &dest, const ArtifactKey &src_key, const TilesetArtifact &artifact) const =0
 Reads an artifact from the backing store and updates the target Tileset.
 

Detailed Description

Abstract interface for reading tileset artifacts from a backing store into a Tileset object.

The TilesetArtifactReader provides the capability to read various types of tileset artifacts (PNG files, binary data, CSV files, etc.) from their stored locations and populate the appropriate fields in a Tileset object. This interface abstracts the reading logic from the specific storage format and location.

Implementations handle the details of parsing different artifact types and updating the correct components within the target Tileset. The interface uses ArtifactKey to support different backing store implementations (filesystem paths, database keys, URLs, etc.), as long as the key is string-representable.

Definition at line 23 of file tileset_artifact_reader.hpp.

Constructor & Destructor Documentation

◆ ~TilesetArtifactReader()

virtual porytiles2::TilesetArtifactReader::~TilesetArtifactReader ( )
virtualdefault

Member Function Documentation

◆ read()

virtual ChainableResult< void > porytiles2::TilesetArtifactReader::read ( Tileset dest,
const ArtifactKey src_key,
const TilesetArtifact artifact 
) const
pure virtual

Reads an artifact from the backing store and updates the target Tileset.

This method reads the specified artifact from the backing store location identified by the src_key and updates the appropriate fields or components within the destination Tileset object. The TilesetArtifact parameter specifies the type and metadata needed to determine how to read and where to store the data. The implementation should handle parsing the specific artifact format (PNG images, binary data, CSV files, etc.) and updating the correct Tileset components (Porymap or Porytiles components, palettes, animations, etc.).

Precondition: the TilesetRepo checks that src_key actually exists before performing a read. Thus, the TilesetArtifactReader's read method can assume the specified artifact really does exist. If the artifact does not exist, the result is implementation-defined but will probably panic.

Parameters
destThe Tileset object to be updated with the read artifact data
src_keyThe ArtifactKey identifying the artifact location in the backing store
artifactThe TilesetArtifact specification including type and optional metadata
Returns
Empty Result on success, otherwise an error description

Implemented in porytiles2::ProjectTilesetArtifactReader.


The documentation for this class was generated from the following file: