38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
/********************\
|
|
| Copyright 2024, |
|
|
| Ulysse Cura |
|
|
\********************/
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// Declaration de la classe MapManager, elle sert a charger des //
|
|
// map dans la memoire pour eviter de les recharger tout le temps. //
|
|
// //
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef MAPMANAGER_HPP
|
|
#define MAPMANAGER_HPP
|
|
|
|
#include <memory> // unique_ptr
|
|
#include <string> // string
|
|
#include <unordered_map> // unordered_map
|
|
#include "externLibs/nlohmann/json.hpp" // json::
|
|
|
|
using std::string, std::unordered_map, std::unique_ptr;
|
|
|
|
using json = nlohmann::json;
|
|
|
|
class MapManager {
|
|
public:
|
|
json *LoadMap(const string &); // Renvoie une map depuis l'unordered_map ou charge depuis le disque puis renvoie la map
|
|
|
|
void Erase(const string &); // Efface dans l'unordered_map la map correspondante
|
|
void Clear(); // Clear tout l'unordered_map
|
|
|
|
private:
|
|
using json_ptr = unique_ptr<json>;
|
|
unordered_map<string, json_ptr> m_maps;
|
|
};
|
|
|
|
#endif
|