50 lines
No EOL
784 B
C++
50 lines
No EOL
784 B
C++
#pragma once
|
|
|
|
#include <asset.hpp>
|
|
#include <utility.hpp>
|
|
#include <json.hpp>
|
|
|
|
class Map : public Asset
|
|
{
|
|
public:
|
|
Map(const std::string& path);
|
|
|
|
nlohmann::json GetContents()
|
|
{
|
|
return m_contents;
|
|
}
|
|
|
|
void SetContents(nlohmann::json contents)
|
|
{
|
|
m_contents = contents;
|
|
}
|
|
|
|
void SaveToFile()
|
|
{
|
|
std::ofstream out;
|
|
out.open(m_filepath);
|
|
|
|
out << m_contents.dump(1);
|
|
out.close();
|
|
}
|
|
|
|
std::string GetName() override
|
|
{
|
|
return Utility::GetFilename(m_filepath);
|
|
}
|
|
|
|
std::string GetPath() override
|
|
{
|
|
return m_filepath;
|
|
}
|
|
|
|
std::type_index GetType() override
|
|
{
|
|
return typeid(Map);
|
|
}
|
|
|
|
private:
|
|
nlohmann::json m_contents;
|
|
|
|
std::string m_filepath;
|
|
}; |