4namespace StevEngine::Utilities {
15 template <
typename T> T
Read(
const std::string& key)
const {
17 stream.
GetStream() << data.at(key).GetStream().str();
18 return stream.
Read<T>();
27 template <
typename T>
void Write(
const std::string& key,
const T& input) {
28 if(data.contains(key)) {
33 data.emplace(key, stream);
40 void Erase(std::string key);
47 bool Contains(std::string key)
const;
70 std::map<std::string, Stream> data;
72 void ReadFromStream(
Stream& stream);
Container for loaded resource data.
Definition ResourceManager.hpp:11
void WriteToFile(const char *path) const
Write full content to a file.
Definition KeyValueStore.cpp:13
void ReadFromFile(const Resources::Resource &file)
Read content from a file.
Definition KeyValueStore.cpp:22
void Write(const std::string &key, const T &input)
Write data of specified type.
Definition KeyValueStore.hpp:27
bool Contains(std::string key) const
Erase key from store.
Definition KeyValueStore.cpp:8
T Read(const std::string &key) const
Read data of specified type.
Definition KeyValueStore.hpp:15
void Erase(std::string key)
Erase key from store.
Definition KeyValueStore.cpp:4
Stream for serialization of data.
Definition Stream.hpp:20
T Read()
Read data of specified type from stream.
std::stringstream & GetStream()
Get underlying std::stringstream object.
Definition Stream.hpp:88