Supports the posterior attribute with each element

pull/99/head
Hieromon Ikasamo 5 years ago
parent 6b696c9ccf
commit a56ce43d8f
  1. 5
      examples/Elements/Elements.ino
  2. 30
      src/AutoConnectElementBasis.h
  3. 48
      src/AutoConnectElementBasisImpl.h
  4. 46
      src/AutoConnectElementJson.h
  5. 50
      src/AutoConnectElementJsonImpl.h

@ -74,11 +74,6 @@ static const char PAGE_ELEMENTS[] PROGMEM = R"(
"label": "Select",
"selected": 2
},
{
"name": "element",
"type": "ACElement",
"value": "<br>"
},
{
"name": "load",
"type": "ACSubmit",

@ -2,8 +2,8 @@
* Declaration of AutoConnectElement basic class.
* @file AutoConnectElementBasis.h
* @author hieromon@gmail.com
* @version 0.9.8
* @date 2019-03-11
* @version 0.9.11
* @date 2019-06-25
* @copyright MIT license.
*/
@ -38,6 +38,12 @@ typedef enum {
AC_File_Extern
} ACFile_t; /**< AutoConnectFile media type */
typedef enum {
AC_Tag_None = 0,
AC_Tag_BR = 1,
AC_Tag_P = 2
} ACPosterior_t; /**< Tag to be generated following element */
/**
* AutoConnectAux element base.
* Placed a raw text that can be added by user sketch.
@ -46,12 +52,13 @@ typedef enum {
*/
class AutoConnectElementBasis {
public:
explicit AutoConnectElementBasis(const char* name = "", const char* value = "") : name(String(name)), value(String(value)), enable(true) {
explicit AutoConnectElementBasis(const char* name = "", const char* value = "", const ACPosterior_t post = AC_Tag_None) : name(String(name)), value(String(value)), post(post), enable(true) {
_type = AC_Element;
}
virtual ~AutoConnectElementBasis() {}
virtual const String toHTML(void) const { return enable ? value : String(""); }
ACElement_t typeOf(void) const { return _type; }
const String posterior(const String& s) const;
#ifndef AUTOCONNECT_USE_JSON
template<typename T>
T& as(void);
@ -59,6 +66,7 @@ class AutoConnectElementBasis {
String name; /**< Element name */
String value; /**< Element value */
ACPosterior_t post; /**< Tag to be generated with posterior */
bool enable; /**< Enabling the element */
protected:
@ -74,7 +82,7 @@ class AutoConnectElementBasis {
*/
class AutoConnectButtonBasis : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectButtonBasis(const char* name = "", const char* value = "", const String& action = String("")) : AutoConnectElementBasis(name, value), action(String(action)) {
explicit AutoConnectButtonBasis(const char* name = "", const char* value = "", const String& action = String(""), const ACPosterior_t post = AC_Tag_None) : AutoConnectElementBasis(name, value, post), action(String(action)) {
_type = AC_Button;
}
~AutoConnectButtonBasis() {}
@ -93,7 +101,7 @@ class AutoConnectButtonBasis : virtual public AutoConnectElementBasis {
*/
class AutoConnectCheckboxBasis : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectCheckboxBasis(const char* name = "", const char* value = "", const char* label = "", const bool checked = false) : AutoConnectElementBasis(name, value), label(String(label)), checked(checked) {
explicit AutoConnectCheckboxBasis(const char* name = "", const char* value = "", const char* label = "", const bool checked = false, const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, value, post), label(String(label)), checked(checked) {
_type = AC_Checkbox;
}
virtual ~AutoConnectCheckboxBasis() {}
@ -113,7 +121,7 @@ class AutoConnectCheckboxBasis : virtual public AutoConnectElementBasis {
*/
class AutoConnectFileBasis : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectFileBasis(const char* name = "", const char* value = "", const char* label = "", const ACFile_t store = AC_File_FS) : AutoConnectElementBasis(name, value), label(String(label)), store(store) {
explicit AutoConnectFileBasis(const char* name = "", const char* value = "", const char* label = "", const ACFile_t store = AC_File_FS, const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, value, post), label(String(label)), store(store), size(0) {
_type = AC_File;
_upload.reset();
}
@ -142,7 +150,7 @@ class AutoConnectFileBasis : virtual public AutoConnectElementBasis {
*/
class AutoConnectInputBasis : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectInputBasis(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "") : AutoConnectElementBasis(name, value), label(String(label)), pattern(String(pattern)), placeholder(String(placeholder)) {
explicit AutoConnectInputBasis(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "", const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, value, post), label(String(label)), pattern(String(pattern)), placeholder(String(placeholder)) {
_type = AC_Input;
}
virtual ~AutoConnectInputBasis() {}
@ -164,7 +172,7 @@ class AutoConnectInputBasis : virtual public AutoConnectElementBasis {
*/
class AutoConnectRadioBasis : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectRadioBasis(const char* name = "", std::vector<String> const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0) : AutoConnectElementBasis(name, ""), label(label), order(order), checked(checked), _values(values) {
explicit AutoConnectRadioBasis(const char* name = "", std::vector<String> const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0, const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, "", post), label(label), order(order), checked(checked), _values(values) {
_type = AC_Radio;
}
virtual ~AutoConnectRadioBasis() {}
@ -195,7 +203,7 @@ class AutoConnectRadioBasis : virtual public AutoConnectElementBasis {
*/
class AutoConnectSelectBasis : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectSelectBasis(const char* name = "", std::vector<String> const& options = {}, const char* label = "", const uint8_t selected = 0) : AutoConnectElementBasis(name, ""), label(String(label)), selected(selected), _options(options) {
explicit AutoConnectSelectBasis(const char* name = "", std::vector<String> const& options = {}, const char* label = "", const uint8_t selected = 0, const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, "", post), label(String(label)), selected(selected), _options(options) {
_type = AC_Select;
}
virtual ~AutoConnectSelectBasis() {}
@ -226,7 +234,7 @@ class AutoConnectSelectBasis : virtual public AutoConnectElementBasis {
*/
class AutoConnectSubmitBasis : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectSubmitBasis(const char* name = "", const char* value = "", const char* uri = "") : AutoConnectElementBasis(name, value), uri(String(uri)) {
explicit AutoConnectSubmitBasis(const char* name = "", const char* value = "", const char* uri = "", const ACPosterior_t post = AC_Tag_None) : AutoConnectElementBasis(name, value, post), uri(String(uri)) {
_type = AC_Submit;
}
virtual ~AutoConnectSubmitBasis() {}
@ -247,7 +255,7 @@ class AutoConnectSubmitBasis : virtual public AutoConnectElementBasis {
*/
class AutoConnectTextBasis : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectTextBasis(const char* name = "", const char* value = "", const char* style = "", const char* format = "") : AutoConnectElementBasis(name, value), style(String(style)), format(String(format)) {
explicit AutoConnectTextBasis(const char* name = "", const char* value = "", const char* style = "", const char* format = "", const ACPosterior_t post = AC_Tag_None) : AutoConnectElementBasis(name, value, post), style(String(style)), format(String(format)) {
_type = AC_Text;
}
virtual ~AutoConnectTextBasis() {}

@ -2,8 +2,8 @@
* Implementation of AutoConnectElementBasis classes.
* @file AutoConnectElementImpl.h
* @author hieromon@gmail.com
* @version 0.9.9
* @date 2019-05-23
* @version 0.9.11
* @date 2019-06-25
* @copyright MIT license.
*/
@ -19,13 +19,35 @@
#endif
#include "AutoConnectElementBasis.h"
/**
* Append post-tag accoring by the post attribute.
* @param s An original string
* @return A string that appended the post tag
*/
const String AutoConnectElementBasis::posterior(const String& s) const {
String html;
if (post == AC_Tag_BR)
html = s + String(F("<br>"));
else if (post == AC_Tag_P)
html = String("<p>") + s + String(F("</p>"));
else
html = s;
return html;
}
/**
* Generate an HTML <button> element. The onclick behavior depends on
* the code held in factionf member.
* @return An HTML string.
*/
const String AutoConnectButtonBasis::toHTML(void) const {
return enable ? String(F("<button type=\"button\" name=\"")) + name + String(F("\" value=\"")) + value + String(F("\" onclick=\"")) + action + String("\">") + value + String(F("</button>")) : String("");
String html = String("");
if (enable) {
html = String(F("<button type=\"button\" name=\"")) + name + String(F("\" value=\"")) + value + String(F("\" onclick=\"")) + action + String("\">") + value + String(F("</button>"));
html = AutoConnectElementBasis::posterior(html);
}
return html;
}
/**
@ -45,7 +67,8 @@ const String AutoConnectCheckboxBasis::toHTML(void) const {
html += String(F(" checked"));
if (label.length())
html += String(F(" id=\"")) + name + String(F("\"><label for=\"")) + name + String("\">") + label + String(F("</label"));
html += String(F("><br>"));
html += String(">");
html = AutoConnectElementBasis::posterior(html);
}
return html;
}
@ -63,7 +86,8 @@ const String AutoConnectFileBasis::toHTML(void) const {
if (enable) {
if (label.length())
html = String(F("<label for=\"")) + name + String(F("\">")) + label + String(F("</label>"));
html += String(F("<input type=\"file\" id=\"")) + name + String(F("\" name=\"")) + name + String(F("\"><br>"));
html += String(F("<input type=\"file\" id=\"")) + name + String(F("\" name=\"")) + name + String("\">");
html = AutoConnectElementBasis::posterior(html);
}
return html;
}
@ -115,7 +139,8 @@ const String AutoConnectInputBasis::toHTML(void) const {
html += String(F(" placeholder=\"")) + placeholder + String("\"");
if (value.length())
html += String(F(" value=\"")) + value + String("\"");
html += String(F("><br>"));
html += String(">");
html = AutoConnectElementBasis::posterior(html);
}
return html;
}
@ -199,6 +224,7 @@ const String AutoConnectRadioBasis::toHTML(void) const {
if (order == AC_Vertical)
html += String(F("<br>"));
}
html = AutoConnectElementBasis::posterior(html);
}
return html;
}
@ -261,6 +287,7 @@ const String AutoConnectSelectBasis::toHTML(void) const {
html += ">" + option + String(F("</option>"));
}
html += String(F("</select>"));
html = AutoConnectElementBasis::posterior(html);
}
return html;
}
@ -280,7 +307,13 @@ const String& AutoConnectSelectBasis::value(void) const {
* @return String an HTML string.
*/
const String AutoConnectSubmitBasis::toHTML(void) const {
return enable ? String(F("<input type=\"button\" name=\"")) + name + String(F("\" value=\"")) + value + String(F("\" onclick=\"_sa('")) + uri + String("')\">") : String("");
String html = String("");
if (enable) {
html = String(F("<input type=\"button\" name=\"")) + name + String(F("\" value=\"")) + value + String(F("\" onclick=\"_sa('")) + uri + String("')\">");
html = AutoConnectElementBasis::posterior(html);
}
return html;
}
/**
@ -308,6 +341,7 @@ const String AutoConnectTextBasis::toHTML(void) const {
}
}
html += value_f + String(F("</div>"));
html = AutoConnectElementBasis::posterior(html);
}
return html;
}

@ -2,8 +2,8 @@
* Declaration of AutoConnectElement extended classes using JSON.
* @file AutoConnectElementJson.h
* @author hieromon@gmail.com
* @version 0.9.9
* @date 2019-05-23
* @version 0.9.11
* @date 2019-06-25
* @copyright MIT license.
*/
@ -24,6 +24,7 @@
#define AUTOCONNECT_JSON_KEY_OPTION "option"
#define AUTOCONNECT_JSON_KEY_PATTERN "pattern"
#define AUTOCONNECT_JSON_KEY_PLACEHOLDER "placeholder"
#define AUTOCONNECT_JSON_KEY_POSTERIOR "posterior"
#define AUTOCONNECT_JSON_KEY_SELECTED "selected"
#define AUTOCONNECT_JSON_KEY_STORE "store"
#define AUTOCONNECT_JSON_KEY_STYLE "style"
@ -40,9 +41,12 @@
#define AUTOCONNECT_JSON_TYPE_ACSELECT "ACSelect"
#define AUTOCONNECT_JSON_TYPE_ACSUBMIT "ACSubmit"
#define AUTOCONNECT_JSON_TYPE_ACTEXT "ACText"
#define AUTOCONNECT_JSON_VALUE_BR "br"
#define AUTOCONNECT_JSON_VALUE_EXTERNAL "extern"
#define AUTOCONNECT_JSON_VALUE_FS "fs"
#define AUTOCONNECT_JSON_VALUE_HORIZONTAL "horizontal"
#define AUTOCONNECT_JSON_VALUE_NONE "none"
#define AUTOCONNECT_JSON_VALUE_PAR "par"
#define AUTOCONNECT_JSON_VALUE_SD "sd"
#define AUTOCONNECT_JSON_VALUE_VERTICAL "vertical"
@ -104,9 +108,10 @@ using ArduinoJsonBuffer = DynamicJsonDocument;
*/
class AutoConnectElementJson : virtual public AutoConnectElementBasis {
public:
explicit AutoConnectElementJson(const char* name = "", const char* value = "") {
explicit AutoConnectElementJson(const char* name = "", const char* value = "", const ACPosterior_t post = AC_Tag_None) : _defaultPost(AC_Tag_None) {
AutoConnectElementBasis::name = String(name);
AutoConnectElementBasis::value = String(value);
AutoConnectElementBasis::post = post;
}
~AutoConnectElementJson() {}
virtual size_t getObjectSize(void) const;
@ -118,6 +123,9 @@ class AutoConnectElementJson : virtual public AutoConnectElementBasis {
protected:
void _setMember(const JsonObject& json);
void _serialize(JsonObject& json);
protected:
ACPosterior_t _defaultPost;
};
/**
@ -130,10 +138,12 @@ class AutoConnectElementJson : virtual public AutoConnectElementBasis {
*/
class AutoConnectButtonJson : public AutoConnectElementJson, public AutoConnectButtonBasis {
public:
explicit AutoConnectButtonJson(const char* name = "", const char* value = "", const String& action = String("")) {
explicit AutoConnectButtonJson(const char* name = "", const char* value = "", const String& action = String(""), const ACPosterior_t post = AC_Tag_None) {
AutoConnectButtonBasis::name = String(name);
AutoConnectButtonBasis::value = String(value);
AutoConnectButtonBasis::action = String(action);
AutoConnectButtonBasis::post = post;
_defaultPost = AC_Tag_None;
}
~AutoConnectButtonJson() {}
size_t getObjectSize(void) const override;
@ -152,11 +162,13 @@ class AutoConnectButtonJson : public AutoConnectElementJson, public AutoConnectB
*/
class AutoConnectCheckboxJson : public AutoConnectElementJson, public AutoConnectCheckboxBasis {
public:
explicit AutoConnectCheckboxJson(const char* name = "", const char* value = "", const char* label = "", const bool checked = false) {
explicit AutoConnectCheckboxJson(const char* name = "", const char* value = "", const char* label = "", const bool checked = false, const ACPosterior_t post = AC_Tag_BR) {
AutoConnectCheckboxBasis::name = String(name);
AutoConnectCheckboxBasis::value = String(value);
AutoConnectCheckboxBasis::label = String(label);
AutoConnectCheckboxBasis::checked = checked;
AutoConnectCheckboxBasis::post = post;
_defaultPost = AC_Tag_BR;
}
~AutoConnectCheckboxJson() {}
size_t getObjectSize(void) const override;
@ -175,11 +187,13 @@ class AutoConnectCheckboxJson : public AutoConnectElementJson, public AutoConnec
*/
class AutoConnectFileJson : public AutoConnectElementJson, public AutoConnectFileBasis {
public:
explicit AutoConnectFileJson(const char* name = "", const char* value= "", const char* label = "", const ACFile_t store = AC_File_FS) {
explicit AutoConnectFileJson(const char* name = "", const char* value= "", const char* label = "", const ACFile_t store = AC_File_FS, const ACPosterior_t post = AC_Tag_BR) {
AutoConnectFileBasis::name = String(name);
AutoConnectFileBasis::value = String(value);
AutoConnectFileBasis::label = String(label);
AutoConnectFileBasis::store = store;
AutoConnectFileBasis::post = post;
_defaultPost = AC_Tag_BR;
}
~AutoConnectFileJson() {}
size_t getObjectSize(void) const override;
@ -198,12 +212,14 @@ class AutoConnectFileJson : public AutoConnectElementJson, public AutoConnectFil
*/
class AutoConnectInputJson : public AutoConnectElementJson, public AutoConnectInputBasis {
public:
explicit AutoConnectInputJson(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "") {
explicit AutoConnectInputJson(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "", const ACPosterior_t post = AC_Tag_BR) {
AutoConnectInputBasis::name = String(name);
AutoConnectInputBasis::value = String(value);
AutoConnectInputBasis::label = String(label);
AutoConnectInputBasis::pattern = String(pattern);
AutoConnectInputBasis::placeholder = String(placeholder);
AutoConnectInputBasis::post = post;
_defaultPost = AC_Tag_BR;
}
~AutoConnectInputJson() {}
size_t getObjectSize(void) const override;
@ -221,12 +237,14 @@ class AutoConnectInputJson : public AutoConnectElementJson, public AutoConnectIn
*/
class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRadioBasis {
public:
explicit AutoConnectRadioJson(const char* name = "", std::vector<String> const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0) {
explicit AutoConnectRadioJson(const char* name = "", std::vector<String> const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0, const ACPosterior_t post = AC_Tag_BR) {
AutoConnectRadioBasis::name = String(name);
AutoConnectRadioBasis::_values = values;
AutoConnectRadioBasis::label = String(label);
AutoConnectRadioBasis::order = order;
AutoConnectRadioBasis::checked = checked;
AutoConnectRadioBasis::post = post;
_defaultPost = AC_Tag_BR;
}
~AutoConnectRadioJson() {}
size_t getObjectSize(void) const override;
@ -244,11 +262,13 @@ class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRa
*/
class AutoConnectSelectJson : public AutoConnectElementJson, public AutoConnectSelectBasis {
public:
explicit AutoConnectSelectJson(const char* name = "", std::vector<String> const& options = {}, const char* label = "", const uint8_t selected = 0) {
explicit AutoConnectSelectJson(const char* name = "", std::vector<String> const& options = {}, const char* label = "", const uint8_t selected = 0, const ACPosterior_t post = AC_Tag_BR) {
AutoConnectSelectBasis::name = String(name);
AutoConnectSelectBasis::_options = options;
AutoConnectSelectBasis::label = String(label);
AutoConnectSelectBasis::selected = selected;
AutoConnectSelectBasis::post = post;
_defaultPost = AC_Tag_BR;
}
~AutoConnectSelectJson() {}
size_t getObjectSize(void) const override;
@ -267,10 +287,12 @@ class AutoConnectSelectJson : public AutoConnectElementJson, public AutoConnectS
*/
class AutoConnectSubmitJson : public AutoConnectElementJson, public AutoConnectSubmitBasis {
public:
explicit AutoConnectSubmitJson(const char* name = "", const char* value = "", const char* uri = "") {
explicit AutoConnectSubmitJson(const char* name = "", const char* value = "", const char* uri = "", const ACPosterior_t post = AC_Tag_None) {
AutoConnectSubmitBasis::name = String(name);
AutoConnectSubmitBasis::value = String(value);
AutoConnectSubmitBasis::uri = String(uri);
AutoConnectSubmitBasis::post = post;
_defaultPost = AC_Tag_None;
}
~AutoConnectSubmitJson() {}
size_t getObjectSize(void) const override;
@ -289,11 +311,13 @@ class AutoConnectSubmitJson : public AutoConnectElementJson, public AutoConnectS
*/
class AutoConnectTextJson : public AutoConnectElementJson, public AutoConnectTextBasis {
public:
explicit AutoConnectTextJson(const char* name = "", const char* value = "", const char* style = "", const char* format = "") {
explicit AutoConnectTextJson(const char* name = "", const char* value = "", const char* style = "", const char* format = "", const ACPosterior_t post = AC_Tag_None) {
AutoConnectTextBasis::name = String(name);
AutoConnectTextBasis::value = String(value);
AutoConnectTextBasis::style = String(style);
AutoConnectTextBasis::format = String(format);
AutoConnectTextBasis::post = post;
_defaultPost = AC_Tag_None;
}
~AutoConnectTextJson() {}
size_t getObjectSize(void) const override;

@ -2,8 +2,8 @@
* Implementation of AutoConnectElementJson classes.
* @file AutoConnectElementImpl.h
* @author hieromon@gmail.com
* @version 0.9.9
* @date 2019-05-23
* @version 0.9.11
* @date 2019-06-25
* @copyright MIT license.
*/
@ -16,10 +16,12 @@
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectElementJson::getObjectSize() const {
size_t AutoConnectElementJson::getObjectSize(void) const {
size_t size = JSON_OBJECT_SIZE(3);
size += sizeof(AUTOCONNECT_JSON_KEY_NAME) + sizeof(AUTOCONNECT_JSON_KEY_TYPE) + sizeof(AUTOCONNECT_JSON_KEY_VALUE) + sizeof(AUTOCONNECT_JSON_TYPE_ACELEMENT);
size += name.length() + 1 + value.length() + 1;
if (post != _defaultPost)
size += sizeof(AUTOCONNECT_JSON_KEY_POSTERIOR) + (sizeof(AUTOCONNECT_JSON_VALUE_BR) > sizeof(AUTOCONNECT_JSON_VALUE_PAR) ? sizeof(AUTOCONNECT_JSON_VALUE_BR) : sizeof(AUTOCONNECT_JSON_VALUE_PAR));
return size;
}
@ -55,6 +57,21 @@ void AutoConnectElementJson::serialize(JsonObject& json) {
*/
void AutoConnectElementJson::_serialize(JsonObject& json) {
json[F(AUTOCONNECT_JSON_KEY_NAME)] = name;
if (post != _defaultPost) {
String posterior;
switch (post) {
case AC_Tag_None:
posterior = AUTOCONNECT_JSON_VALUE_NONE;
break;
case AC_Tag_BR:
posterior = AUTOCONNECT_JSON_VALUE_BR;
break;
case AC_Tag_P:
posterior = AUTOCONNECT_JSON_VALUE_PAR;
break;
}
json[F(AUTOCONNECT_JSON_KEY_POSTERIOR)] = posterior;
}
}
/**
@ -65,13 +82,24 @@ void AutoConnectElementJson::_setMember(const JsonObject& json) {
name = json[F(AUTOCONNECT_JSON_KEY_NAME)].as<String>();
if (json.containsKey(F(AUTOCONNECT_JSON_KEY_VALUE)))
value = json[F(AUTOCONNECT_JSON_KEY_VALUE)].as<String>();
if (json.containsKey(F(AUTOCONNECT_JSON_KEY_POSTERIOR))) {
String posterior = json[F(AUTOCONNECT_JSON_KEY_POSTERIOR)].as<String>();
if (posterior.equalsIgnoreCase(F(AUTOCONNECT_JSON_VALUE_NONE)))
post = AC_Tag_None;
else if (posterior.equalsIgnoreCase(F(AUTOCONNECT_JSON_VALUE_BR)))
post = AC_Tag_BR;
else if (posterior.equalsIgnoreCase(F(AUTOCONNECT_JSON_VALUE_PAR)))
post = AC_Tag_P;
else
AC_DBG("Warning '%s' loading, unknown posterior '%s'\n", name.c_str(), posterior.c_str());
}
}
/**
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectButtonJson::getObjectSize() const {
size_t AutoConnectButtonJson::getObjectSize(void) const {
size_t size = AutoConnectElementJson::getObjectSize() + JSON_OBJECT_SIZE(1);
size += sizeof(AUTOCONNECT_JSON_KEY_ACTION) + action.length() + 1;
return size;
@ -109,7 +137,7 @@ void AutoConnectButtonJson::serialize(JsonObject& json) {
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectCheckboxJson::getObjectSize() const {
size_t AutoConnectCheckboxJson::getObjectSize(void) const {
size_t size = AutoConnectElementJson::getObjectSize() + JSON_OBJECT_SIZE(2);
size += sizeof(AUTOCONNECT_JSON_KEY_LABEL) + label.length() + 1 + sizeof(AUTOCONNECT_JSON_KEY_CHECKED);
return size;
@ -151,7 +179,7 @@ void AutoConnectCheckboxJson::serialize(JsonObject& json) {
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectFileJson::getObjectSize() const {
size_t AutoConnectFileJson::getObjectSize(void) const {
size_t size = AutoConnectElementJson::getObjectSize() + JSON_OBJECT_SIZE(2);
size += sizeof(AUTOCONNECT_JSON_KEY_LABEL) + label.length() + 1 + sizeof(AUTOCONNECT_JSON_KEY_STORE) + sizeof(AUTOCONNECT_JSON_VALUE_EXTERNAL);
return size;
@ -213,7 +241,7 @@ void AutoConnectFileJson::serialize(JsonObject& json) {
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectInputJson::getObjectSize() const {
size_t AutoConnectInputJson::getObjectSize(void) const {
size_t size = AutoConnectElementJson::getObjectSize() + JSON_OBJECT_SIZE(3);
size += sizeof(AUTOCONNECT_JSON_KEY_LABEL) + label.length() + 1 + sizeof(AUTOCONNECT_JSON_KEY_PATTERN) + pattern.length() + 1 + sizeof(AUTOCONNECT_JSON_KEY_PLACEHOLDER) + placeholder.length() + 1;
return size;
@ -257,7 +285,7 @@ void AutoConnectInputJson::serialize(JsonObject& json) {
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectRadioJson::getObjectSize() const {
size_t AutoConnectRadioJson::getObjectSize(void) const {
size_t size = AutoConnectElementJson::getObjectSize() + JSON_OBJECT_SIZE(3) + JSON_ARRAY_SIZE(_values.size());
size += sizeof(AUTOCONNECT_JSON_KEY_LABEL) + label.length() + 1 + sizeof(AUTOCONNECT_JSON_KEY_ARRANGE) + sizeof(AUTOCONNECT_JSON_VALUE_HORIZONTAL) + sizeof(AUTOCONNECT_JSON_KEY_CHECKED);
for (const String& _value : _values)
@ -328,7 +356,7 @@ void AutoConnectRadioJson::serialize(JsonObject& json) {
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectSelectJson::getObjectSize() const {
size_t AutoConnectSelectJson::getObjectSize(void) const {
size_t size = AutoConnectElementJson::getObjectSize() + JSON_OBJECT_SIZE(2) + JSON_ARRAY_SIZE(_options.size());
size += sizeof(AUTOCONNECT_JSON_KEY_LABEL) + label.length() + 1 + sizeof(AUTOCONNECT_JSON_KEY_SELECTED);
for (const String& _option : _options)
@ -380,7 +408,7 @@ void AutoConnectSelectJson::serialize(JsonObject& json) {
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectSubmitJson::getObjectSize() const {
size_t AutoConnectSubmitJson::getObjectSize(void) const {
size_t size = AutoConnectElementJson::getObjectSize();
size += sizeof(AUTOCONNECT_JSON_KEY_URI) + uri.length() + 1;
return size;
@ -418,7 +446,7 @@ void AutoConnectSubmitJson::serialize(JsonObject& json) {
* Returns JSON object size.
* @return An object size for JsonBuffer.
*/
size_t AutoConnectTextJson::getObjectSize() const {
size_t AutoConnectTextJson::getObjectSize(void) const {
size_t size = AutoConnectElementJson::getObjectSize() + JSON_OBJECT_SIZE(2);
size += sizeof(AUTOCONNECT_JSON_KEY_STYLE) + style.length() + 1 + sizeof(AUTOCONNECT_JSON_KEY_FORMAT) + format.length() + 1;
return size;

Loading…
Cancel
Save