summaryrefslogtreecommitdiff
path: root/lib/persistance.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-04-30 01:03:42 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-11-07 16:41:37 +0000
commita31858d29048735b812d385f75db4ed6a6a94556 (patch)
treefffd08d958c4970be617b3ad36905b54f2445bad /lib/persistance.cpp
parentImplement shared_ptr support (diff)
downloadilt-a31858d29048735b812d385f75db4ed6a6a94556.tar.bz2
ilt-a31858d29048735b812d385f75db4ed6a6a94556.tar.xz
ilt-a31858d29048735b812d385f75db4ed6a6a94556.zip
Fix the fact I've been spelling persistence wrong this whole time
Diffstat (limited to 'lib/persistance.cpp')
-rw-r--r--lib/persistance.cpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/lib/persistance.cpp b/lib/persistance.cpp
deleted file mode 100644
index 204e8f0..0000000
--- a/lib/persistance.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#include "persistance.h"
-#include <map>
-
-namespace Persistanace {
- using Factories
- = std::pair<std::function<std::unique_ptr<Persistable>()>, std::function<std::shared_ptr<Persistable>()>>;
- using NamedTypeFactories = std::map<std::string_view, Factories>;
- static NamedTypeFactories namedTypeFactories;
-
- void
- Persistable::addFactory(const std::string_view t, std::function<std::unique_ptr<Persistable>()> fu,
- std::function<std::shared_ptr<Persistable>()> fs)
- {
- namedTypeFactories.emplace(t, std::make_pair(std::move(fu), std::move(fs)));
- }
-
- std::unique_ptr<Persistable>
- Persistable::callFactory(const std::string_view t)
- {
- return namedTypeFactories.at(t).first();
- }
-
- std::shared_ptr<Persistable>
- Persistable::callSharedFactory(const std::string_view t)
- {
- return namedTypeFactories.at(t).second();
- }
-
- void
- Selection::setValue(float &)
- {
- throw std::runtime_error("Unexpected float");
- }
-
- void
- Selection::setValue(bool &)
- {
- throw std::runtime_error("Unexpected bool");
- }
-
- void
- Selection::setValue(const std::nullptr_t &)
- {
- throw std::runtime_error("Unexpected null");
- }
-
- void
- Selection::setValue(std::string &)
- {
- throw std::runtime_error("Unexpected string");
- }
-
- void
- Selection::beginArray(Stack &)
- {
- throw std::runtime_error("Unexpected array");
- }
-
- void
- Selection::beginObject(Stack &)
- {
- throw std::runtime_error("Unexpected object");
- }
-
- void
- Selection::beforeValue(Stack &)
- {
- throw std::runtime_error("Unexpected value");
- }
-
- SelectionPtr
- Selection::select(const std::string &)
- {
- throw std::runtime_error("Unexpected select");
- }
-
- void
- Selection::endObject(Stack &)
- {
- }
-}