From 8e8d707db19c12ffa7c018206ebe2582f0d86355 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 25 Apr 2021 19:39:26 +0100 Subject: Support chaining persist calls for subclasses --- test/test-persistance.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test-persistance.cpp b/test/test-persistance.cpp index fb90de2..ffc8a3c 100644 --- a/test/test-persistance.cpp +++ b/test/test-persistance.cpp @@ -13,10 +13,10 @@ struct AbsObject : public Persistanace::Persistable { std::string base; - void + bool persist(Persistanace::PersistanceStore & store) override { - STORE_MEMBER(base); + return STORE_MEMBER(base); } virtual void dummy() const = 0; @@ -25,11 +25,10 @@ struct AbsObject : public Persistanace::Persistable { struct SubObject : public AbsObject { std::string sub; - void + bool persist(Persistanace::PersistanceStore & store) override { - AbsObject::persist(store); - STORE_MEMBER(sub); + return AbsObject::persist(store) && STORE_MEMBER(sub); } void @@ -52,10 +51,10 @@ struct TestObject : public Persistanace::Persistable { std::unique_ptr aptr; std::vector> vptr; - void + bool persist(Persistanace::PersistanceStore & store) override { - STORE_MEMBER(flt) && STORE_MEMBER(str) && STORE_MEMBER(bl) && STORE_MEMBER(pos) && STORE_MEMBER(flts) + return STORE_MEMBER(flt) && STORE_MEMBER(str) && STORE_MEMBER(bl) && STORE_MEMBER(pos) && STORE_MEMBER(flts) && STORE_MEMBER(poss) && STORE_MEMBER(nest) && STORE_MEMBER(ptr) && STORE_MEMBER(aptr) && STORE_MEMBER(vptr); } -- cgit v1.2.3