Framework patch.

This commit is contained in:
stephb9959
2021-10-28 08:59:23 -07:00
parent 7977c73d24
commit 6273d562af
2 changed files with 11 additions and 1 deletions

2
build
View File

@@ -1 +1 @@
3
5

View File

@@ -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<class T> 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<class T> 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);