From abd7f486a0fb34320e3afae6780677cfd4ff85cc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 25 Apr 2021 19:19:28 +0100 Subject: Erring toward complete JSON loader --- lib/jsonParse-persistance.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/jsonParse-persistance.h') diff --git a/lib/jsonParse-persistance.h b/lib/jsonParse-persistance.h index d5c76ed..bea93e0 100644 --- a/lib/jsonParse-persistance.h +++ b/lib/jsonParse-persistance.h @@ -11,18 +11,18 @@ namespace Persistanace { class JsonParsePersistance : public json::jsonParser { public: - explicit JsonParsePersistance(std::istream & in); - template - void - loadState(T & t) + inline T + loadState(std::istream & in) { + T t {}; stk.push(std::make_unique>(std::ref(t))); - loadState(); + loadState(in); + return t; } protected: - void loadState(); + void loadState(std::istream & in); void BeginObject() override; void BeginArray() override; @@ -34,7 +34,6 @@ namespace Persistanace { void EndArray() override; void EndObject() override; - private: Stack stk; template inline void PushValue(T && value); -- cgit v1.2.3