From 7022ab92ad9ab45623c90bd3018e45b07faed8b6 Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Mon, 11 Mar 2019 13:23:35 +0900 Subject: [PATCH] Fixed missing the AutoConnectElement for getElement template --- src/AutoConnectAux.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/AutoConnectAux.cpp b/src/AutoConnectAux.cpp index e3fde92..15db4c8 100644 --- a/src/AutoConnectAux.cpp +++ b/src/AutoConnectAux.cpp @@ -2,8 +2,8 @@ * Implementation of AutoConnectAux class. * @file AutoConnectAuxBasisImpl.h * @author hieromon@gmail.com - * @version 0.9.7 - * @date 2018-11-17 + * @version 0.9.8 + * @date 2019-03-11 * @copyright MIT license. */ #include @@ -363,6 +363,20 @@ void AutoConnectAux::_storeElements(WebServerClass* webServer) { #ifndef AUTOCONNECT_USE_JSON +/** + * Get AutoConnectElementBasis element. + * @param name an element name. + * @return A reference of AutoConnectElement class. + */ +template<> +AutoConnectElementBasis& AutoConnectAux::getElement(const String& name) { + AutoConnectElement* elm = getElement(name); + if (elm) { + return *(reinterpret_cast(elm)); + } + return reinterpret_cast(_nullElement()); +} + /** * Get AutoConnectButtonBasis element. * @param name An element name. @@ -484,6 +498,20 @@ AutoConnectTextBasis& AutoConnectAux::getElement(const String& name) { #else +/** + * Get AutoConnectElementJson element. + * @param name an element name. + * @return A reference of AutoConnectElement class. + */ +template<> +AutoConnectElementJson& AutoConnectAux::getElement(const String& name) { + AutoConnectElement* elm = getElement(name); + if (elm) { + return *(reinterpret_cast(elm)); + } + return reinterpret_cast(_nullElement()); +} + /** * Get AutoConnectButtonJson element. * @param name An element name.