This commit is contained in:
Aria 2025-03-21 22:23:30 +11:00
commit 9c94d113d3
Signed by untrusted user who does not match committer: aria
GPG key ID: 19AB7AA462B8AB3B
10260 changed files with 1237388 additions and 0 deletions

View file

@ -0,0 +1,35 @@
#ifndef STAR_ASSET_SOURCE_HPP
#define STAR_ASSET_SOURCE_HPP
#include "StarIODevice.hpp"
#include "StarJson.hpp"
namespace Star {
STAR_CLASS(AssetSource);
STAR_EXCEPTION(AssetSourceException, StarException);
// An asset source could be a directory on a filesystem, where assets are
// pulled directly from files, or a single pak-like file containing all assets,
// where assets are pulled from the correct region of the pak-like file.
class AssetSource {
public:
virtual ~AssetSource() = default;
// An asset source can have arbitrary metadata attached.
virtual JsonObject metadata() const = 0;
// Should return all the available assets in this source
virtual StringList assetPaths() const = 0;
// Open the given path in this source and return an IODevicePtr to it.
virtual IODevicePtr open(String const& path) = 0;
// Read the entirety of the given path into a buffer.
virtual ByteArray read(String const& path) = 0;
};
}
#endif