summaryrefslogtreecommitdiff
path: root/universe/src/JsonRepository.h
blob: ea6bf46830a3e8aa92a746f1cd76e1b0ff7ee7e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <functional>
#include <map>
#include <string>

#include <kurator/universe/Repository.h>
#include <kurator/universe/ShipType.h>
#include <kurator/universe/TurretType.h>


namespace kurator
{
namespace universe
{


class JsonRepository : public Repository
{
public:
	explicit JsonRepository(const std::string& path);
	ShipType ship_type(const std::string& id) const override;
	TurretType turret_type(const std::string& id) const override;
	void for_ship_types(std::function<void(const ShipType&)> func) const;
	void for_turret_types(std::function<void(const TurretType&)> func) const;
private:
	std::map<std::string, ShipType> ships;
	std::map<std::string, TurretType> turrets;
};


}  // namespace universe
}  // namespace kurator