osb/source/base/StarMemoryAssetSource.hpp

32 lines
699 B
C++
Raw Normal View History

#pragma once
#include "StarAssetSource.hpp"
#include "StarIODevice.hpp"
namespace Star {
STAR_CLASS(MemoryAssetSource);
class MemoryAssetSource : public AssetSource {
public:
2024-03-15 13:02:51 +00:00
MemoryAssetSource(String const& name, JsonObject metadata = JsonObject());
2024-03-15 13:02:51 +00:00
String name() const;
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);
2024-03-15 13:02:51 +00:00
void set(String const& path, ByteArray data);
ByteArray read(String const& path) override;
private:
2024-03-15 13:02:51 +00:00
String m_name;
JsonObject m_metadata;
StringMap<ByteArrayPtr> m_files;
};
}