diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-03-15 22:47:02 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-03-15 22:47:02 +1100 |
commit | 7eec15098e054915fb2c92008be8137f6b5e5b9c (patch) | |
tree | 31a0fe81dcccec557b05244b3b4d8454a90c8bf8 /source/base/StarMemoryAssetSource.hpp | |
parent | 13f91aa1959ef18410ea5b8afdede13ba128bbdd (diff) |
asset onLoad scripts can add and patch assets now
Diffstat (limited to 'source/base/StarMemoryAssetSource.hpp')
-rw-r--r-- | source/base/StarMemoryAssetSource.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/base/StarMemoryAssetSource.hpp b/source/base/StarMemoryAssetSource.hpp new file mode 100644 index 0000000..353a132 --- /dev/null +++ b/source/base/StarMemoryAssetSource.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include "StarAssetSource.hpp" +#include "StarIODevice.hpp" + +namespace Star { + +STAR_CLASS(MemoryAssetSource); + +class MemoryAssetSource : public AssetSource { +public: + MemoryAssetSource(JsonObject metadata = JsonObject()); + + JsonObject metadata() const override; + StringList assetPaths() const override; + + IODevicePtr open(String const& path) override; + + bool empty() const; + bool contains(String const& path) const; + bool erase(String const& path); + bool set(String const& path, ByteArray data); + ByteArray read(String const& path) override; +private: + JsonObject m_metadata; + StringMap<ByteArrayPtr> m_files; +}; + +} |