diff options
Diffstat (limited to 'universe/src')
-rw-r--r-- | universe/src/JsonRepository.cpp | 49 | ||||
-rw-r--r-- | universe/src/JsonRepository.h | 29 | ||||
-rw-r--r-- | universe/src/universe.cpp | 8 |
3 files changed, 86 insertions, 0 deletions
diff --git a/universe/src/JsonRepository.cpp b/universe/src/JsonRepository.cpp new file mode 100644 index 0000000..ddbbfcf --- /dev/null +++ b/universe/src/JsonRepository.cpp @@ -0,0 +1,49 @@ +#include "JsonRepository.h" + +#include <functional> +#include <string> + +#include <kurator/universe/NotFound.h> +#include <kurator/universe/ShipType.h> +#include <kurator/universe/TurretType.h> + + +namespace kurator +{ +namespace universe +{ + + +JsonRepository::JsonRepository(const char*) +{ +} + + +ShipType +JsonRepository::ship_type(const std::string& id) const +{ + throw NotFound(id); +} + + +TurretType +JsonRepository::turret_type(const std::string& id) const +{ + throw NotFound(id); +} + + +void +JsonRepository::for_ship_types(std::function<void(const ShipType&)>) const +{ +} + + +void +JsonRepository::for_turret_types(std::function<void(const TurretType&)>) const +{ +} + + +} // namespace universe +} // namespace kurator diff --git a/universe/src/JsonRepository.h b/universe/src/JsonRepository.h new file mode 100644 index 0000000..dc6e7f1 --- /dev/null +++ b/universe/src/JsonRepository.h @@ -0,0 +1,29 @@ +#pragma once + +#include <functional> +#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 char* 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; +}; + + +} // namespace universe +} // namespace kurator diff --git a/universe/src/universe.cpp b/universe/src/universe.cpp index b77ce7c..649b553 100644 --- a/universe/src/universe.cpp +++ b/universe/src/universe.cpp @@ -4,6 +4,7 @@ #include <kurator/universe/Repository.h> +#include "JsonRepository.h" #include "SampleRepository.h" @@ -14,6 +15,13 @@ namespace universe std::shared_ptr<Repository> +load_json(const char* path) +{ + return std::make_shared<JsonRepository>(path); +} + + +std::shared_ptr<Repository> load_sample() { return std::make_shared<SampleRepository>(); |