diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
commit | 6352e8e3196f78388b6c771073f9e03eaa612673 (patch) | |
tree | e23772f79a7fbc41bc9108951e9e136857484bf4 /source/base/StarAssetSource.hpp | |
parent | 6741a057e5639280d85d0f88ba26f000baa58f61 (diff) |
everything everywhere
all at once
Diffstat (limited to 'source/base/StarAssetSource.hpp')
-rw-r--r-- | source/base/StarAssetSource.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/base/StarAssetSource.hpp b/source/base/StarAssetSource.hpp new file mode 100644 index 0000000..b2cb245 --- /dev/null +++ b/source/base/StarAssetSource.hpp @@ -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 |