diff --git a/ugc/storage.cpp b/ugc/storage.cpp new file mode 100644 index 0000000000..15fd9babb6 --- /dev/null +++ b/ugc/storage.cpp @@ -0,0 +1,33 @@ +#include "ugc/storage.hpp" + +#include "indexer/feature_decl.hpp" + +namespace ugc +{ +Storage::Storage(std::string const & filename) + : m_filename(filename) +{ + Load(); +} + +UGCUpdate const * Storage::GetUGCUpdate(FeatureID const & id) const +{ + auto const it = m_ugc.find(id); + if (it != end(m_ugc)) + return &it->second; + return nullptr; +} + +void Storage::SetUGCUpdate(FeatureID const & id, UGCUpdate const & ugc) +{ + m_ugc[id] = ugc; +} + +void Storage::Load() +{ +} + +void Storage::Save() +{ +} +} // namespace ugc diff --git a/ugc/storage.hpp b/ugc/storage.hpp new file mode 100644 index 0000000000..2086dbad15 --- /dev/null +++ b/ugc/storage.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "ugc/types.hpp" + +#include +#include + +struct FeatureID; + +namespace ugc +{ +class Storage +{ +public: + explicit Storage(std::string const & filename); + + UGCUpdate const * GetUGCUpdate(FeatureID const & id) const; + void SetUGCUpdate(FeatureID const & id, UGCUpdate const & ugc); + + void Save(); + void Load(); + +private: + std::string m_filename; + std::map m_ugc; +}; +} // namespace ugc