summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/persistence.cpp5
-rw-r--r--lib/persistence.h10
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/persistence.cpp b/lib/persistence.cpp
index 8c7c6a4..06e40c7 100644
--- a/lib/persistence.cpp
+++ b/lib/persistence.cpp
@@ -41,6 +41,11 @@ namespace Persistence {
return ss.str();
}
+ void
+ Persistable::postLoad()
+ {
+ }
+
PersistenceSelect::PersistenceSelect(const std::string & n) : name {n} { }
PersistenceStore::NameAction
diff --git a/lib/persistence.h b/lib/persistence.h
index 35d60ca..1cb3af0 100644
--- a/lib/persistence.h
+++ b/lib/persistence.h
@@ -311,8 +311,9 @@ namespace Persistence {
void
endObject(Persistence::Stack & stk) override
{
+ // TODO test with unique_ptr
map.emplace(std::invoke(Key, s), std::move(s));
- stk.pop();
+ Persistence::SelectionT<Type>::endObject(stk);
}
private:
@@ -327,8 +328,9 @@ namespace Persistence {
void
endObject(Persistence::Stack & stk) override
{
+ // TODO test with unique_ptr
container.emplace_back(std::move(s));
- stk.pop();
+ Persistence::SelectionT<Type>::endObject(stk);
}
private:
@@ -342,6 +344,7 @@ namespace Persistence {
DEFAULT_MOVE_COPY(Persistable);
virtual bool persist(PersistenceStore & store) = 0;
+ virtual void postLoad();
[[nodiscard]] virtual std::string getId() const;
@@ -484,6 +487,9 @@ namespace Persistence {
endObject(Stack & stk) override
{
make_default_as_needed(this->v);
+ if (this->v) {
+ this->v->postLoad();
+ }
stk.pop();
}