Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/base/StarMemoryAssetSource.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-03-25 03:46:21 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2024-03-25 03:46:21 +1100
commit560ae08424956bb495bc2453973467d138029c7c (patch)
treef506d79185388e7217af75a43074884f17349cb2 /source/base/StarMemoryAssetSource.hpp
parentff6e349aef9c5504896d1249b2d4a3b862c37d09 (diff)
Add support for directly setting image assets and processing Image userdata
Diffstat (limited to 'source/base/StarMemoryAssetSource.hpp')
-rw-r--r--source/base/StarMemoryAssetSource.hpp9
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;
};
}