From 2d6772cb1c592e4bd75be40f1fdfa924bbbc3c07 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 14 Mar 2023 18:14:54 +0000 Subject: Add postLoad support to persistence --- lib/persistence.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/persistence.h') 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::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::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(); } -- cgit v1.2.3