diff options
Diffstat (limited to 'source/base/StarMemoryAssetSource.hpp')
-rw-r--r-- | source/base/StarMemoryAssetSource.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/base/StarMemoryAssetSource.hpp b/source/base/StarMemoryAssetSource.hpp index e5ef740..1fc5733 100644 --- a/source/base/StarMemoryAssetSource.hpp +++ b/source/base/StarMemoryAssetSource.hpp @@ -6,6 +6,7 @@ namespace Star { STAR_CLASS(MemoryAssetSource); +STAR_CLASS(Image); class MemoryAssetSource : public AssetSource { public: @@ -15,17 +16,23 @@ public: JsonObject metadata() const override; StringList assetPaths() const override; + // do not use the returned IODevice after the file is gone or bad things will happen IODevicePtr open(String const& path) override; bool empty() const; bool contains(String const& path) const; bool erase(String const& path); void set(String const& path, ByteArray data); + void set(String const& path, Image const& image); + void set(String const& path, Image&& image); ByteArray read(String const& path) override; + ImageConstPtr image(String const& path); private: + typedef Variant<ByteArray, ImagePtr> FileEntry; + String m_name; JsonObject m_metadata; - StringMap<ByteArrayPtr> m_files; + StringMap<FileEntry> m_files; }; } |