5namespace StevEngine::Utilities {
16 template <
typename T> T
Read(
const std::string& key)
const {
18 stream.
GetStream() << data.at(key).GetStream().str();
19 return stream.
Read<T>();
28 template <
typename T>
void Write(
const std::string& key,
const T& input) {
29 if(data.contains(key)) {
34 data.emplace(key, stream);
41 void Erase(std::string key);
48 bool Contains(std::string key)
const;
71 std::map<std::string, Stream> data;
73 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:15
void ReadFromFile(const Resources::Resource &file)
Read content from a file.
Definition KeyValueStore.cpp:24
void Write(const std::string &key, const T &input)
Write data of specified type.
Definition KeyValueStore.hpp:28
bool Contains(std::string key) const
Erase key from store.
Definition KeyValueStore.cpp:10
T Read(const std::string &key) const
Read data of specified type.
Definition KeyValueStore.hpp:16
void Erase(std::string key)
Erase key from store.
Definition KeyValueStore.cpp:6
Stream for serialization of data.
Definition Stream.hpp:22
T Read()
Read data of specified type from stream.
std::stringstream & GetStream()
Get underlying std::stringstream object.
Definition Stream.hpp:100