From 5b779a1aa8e59f63f26ee2fd5cec908bf5ce1159 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 4 Jan 2023 01:07:59 +0100 Subject: Added stub Json repository --- universe/CMakeLists.txt | 1 + universe/include/kurator/universe.h | 1 + universe/src/JsonRepository.cpp | 49 +++++++++++++++++++++++++++++++++++++ universe/src/JsonRepository.h | 29 ++++++++++++++++++++++ universe/src/universe.cpp | 8 ++++++ 5 files changed, 88 insertions(+) create mode 100644 universe/src/JsonRepository.cpp create mode 100644 universe/src/JsonRepository.h (limited to 'universe') diff --git a/universe/CMakeLists.txt b/universe/CMakeLists.txt index daf55bc..7e8a795 100644 --- a/universe/CMakeLists.txt +++ b/universe/CMakeLists.txt @@ -1,6 +1,7 @@ project(universe) add_library( ${PROJECT_NAME} + src/JsonRepository.cpp src/NotFound.cpp src/SampleRepository.cpp src/TurretType.cpp diff --git a/universe/include/kurator/universe.h b/universe/include/kurator/universe.h index 73d06ae..6a00804 100644 --- a/universe/include/kurator/universe.h +++ b/universe/include/kurator/universe.h @@ -11,6 +11,7 @@ namespace universe { +auto load_json(const char* path) -> std::shared_ptr; auto load_sample() -> std::shared_ptr; 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 +#include + +#include +#include +#include + + +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) const +{ +} + + +void +JsonRepository::for_turret_types(std::function) 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 +#include + +#include +#include +#include + + +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 func) const; + void for_turret_types(std::function 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 +#include "JsonRepository.h" #include "SampleRepository.h" @@ -14,6 +15,13 @@ namespace universe std::shared_ptr +load_json(const char* path) +{ + return std::make_shared(path); +} + + +std::shared_ptr load_sample() { return std::make_shared(); -- cgit v1.1