summaryrefslogtreecommitdiff
path: root/universe/src/JsonRepository.h
blob: 13df7e40d66114a965b9a321c8804bc95ba47a32 (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
34
35
#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 override;
	ShipType ship_type(const std::string& id) const override;
	TurretType turret_type() 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