From 6273d562af22dc48522e5d0bc0da37f4ed29c795 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Thu, 28 Oct 2021 08:59:23 -0700 Subject: [PATCH] Framework patch. --- build | 2 +- src/framework/MicroService.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build b/build index e440e5c..7813681 100644 --- a/build +++ b/build @@ -1 +1 @@ -3 \ No newline at end of file +5 \ No newline at end of file diff --git a/src/framework/MicroService.h b/src/framework/MicroService.h index 11350b6..c6f6893 100644 --- a/src/framework/MicroService.h +++ b/src/framework/MicroService.h @@ -204,6 +204,10 @@ namespace OpenWifi::RESTAPI_utils { Obj.set(Field, Arr); } + inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, int Value) { + Obj.set(Field, Value); + } + template void field_to_json(Poco::JSON::Object &Obj, const char *Field, const T &Value) { Poco::JSON::Object Answer; Value.to_json(Answer); @@ -222,6 +226,12 @@ namespace OpenWifi::RESTAPI_utils { } } + inline void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field, int &Value) { + if(Obj->isObject(Field)) { + Value = Obj->get(Field); + } + } + template void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field, T &Value) { if(Obj->isObject(Field)) { Poco::JSON::Object::Ptr A = Obj->getObject(Field);