Fixed a minor coding style

pull/41/head
Hieromon Ikasamo 6 years ago
parent 661f4c3463
commit d5ca170a86
  1. 6
      src/AutoConnectAux.cpp
  2. 4
      src/AutoConnectAux.h
  3. 6
      src/AutoConnectElementBasis.h
  4. 6
      src/AutoConnectElementJson.h

@ -285,10 +285,6 @@ const String AutoConnectAux::_insertElement(PageArgument& args) {
for (AutoConnectElement& addon : _addonElm) for (AutoConnectElement& addon : _addonElm)
body += addon.toHTML(); body += addon.toHTML();
//for (std::size_t n = 0; n < _addonElm.size(); n++) {
// AutoConnectElement& addon = _addonElm[n];
// body += addon.toHTML();
//}
if (_handler) { if (_handler) {
if (_order & AC_EXIT_LATER) { if (_order & AC_EXIT_LATER) {
@ -308,7 +304,7 @@ const String AutoConnectAux::_insertElement(PageArgument& args) {
* @param uri An uri of the auxiliary page. * @param uri An uri of the auxiliary page.
* @return A PageElement of auxiliary page. * @return A PageElement of auxiliary page.
*/ */
PageElement* AutoConnectAux::_setupPage(String uri) { PageElement* AutoConnectAux::_setupPage(const String& uri) {
PageElement* elm = nullptr; PageElement* elm = nullptr;
if (_ac) { if (_ac) {

@ -58,8 +58,6 @@ class AutoConnectAux : public PageBuilder {
AutoConnectElement* getElement(const String& name); /**< Get registered AutoConnectElement as specified name */ AutoConnectElement* getElement(const String& name); /**< Get registered AutoConnectElement as specified name */
void menu(const bool post) { _menu = post; } /**< Set or reset the display as menu item for this aux */ void menu(const bool post) { _menu = post; } /**< Set or reset the display as menu item for this aux */
bool release(const String& name); /**< Release an AutoConnectElement */ bool release(const String& name); /**< Release an AutoConnectElement */
// bool setElementValue(const String& name, const bool checked); /**< Set checked value to specified AutoConnectChechbox element */
// bool setElementValue(const String& name, const uint8_t checked); /**< Set checked value to specified AutoConnectRadio element */
bool setElementValue(const String& name, const String value); /**< Set value to specified element */ bool setElementValue(const String& name, const String value); /**< Set value to specified element */
bool setElementValue(const String& name, std::vector<String> const& values); /**< Set values collection to specified element */ bool setElementValue(const String& name, std::vector<String> const& values); /**< Set values collection to specified element */
void setTitle(const String title) { _title = title; } /**< Set a title of the auxiliary page */ void setTitle(const String title) { _title = title; } /**< Set a title of the auxiliary page */
@ -78,7 +76,7 @@ class AutoConnectAux : public PageBuilder {
protected: protected:
void _concat(AutoConnectAux& aux); /**< Make up chain of AutoConnectAux */ void _concat(AutoConnectAux& aux); /**< Make up chain of AutoConnectAux */
void _join(AutoConnect& ac); /**< Make a link to AutoConnect */ void _join(AutoConnect& ac); /**< Make a link to AutoConnect */
PageElement* _setupPage(String uri); /**< AutoConnectAux page builder */ PageElement* _setupPage(const String& uri); /**< AutoConnectAux page builder */
const String _insertElement(PageArgument& args); /**< Insert a generated HTML to the page built by PageBuilder */ const String _insertElement(PageArgument& args); /**< Insert a generated HTML to the page built by PageBuilder */
const String _injectTitle(PageArgument& args) const { (void)(args); return _title; } /**< Returns title of this page to PageBuilder */ const String _injectTitle(PageArgument& args) const { (void)(args); return _title; } /**< Returns title of this page to PageBuilder */
const String _injectMenu(PageArgument& args); /**< Inject menu title of this page to PageBuilder */ const String _injectMenu(PageArgument& args); /**< Inject menu title of this page to PageBuilder */

@ -121,11 +121,11 @@ class AutoConnectInputBasis : virtual public AutoConnectElementBasis {
class AutoConnectRadioBasis : virtual public AutoConnectElementBasis { class AutoConnectRadioBasis : virtual public AutoConnectElementBasis {
public: 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) : AutoConnectElementBasis(name, ""), label(label), order(order), checked(checked), _values(values) {
_type = AC_Radio; _type = AC_Radio;
} }
virtual ~AutoConnectRadioBasis() {} virtual ~AutoConnectRadioBasis() {}
const String toHTML(void) const override; const String toHTML(void) const override;
const String& operator [] (const std::size_t n) const { return at(n); } const String& operator[] (const std::size_t n) const { return at(n); }
void add(const String& value) { _values.push_back(String(value)); } void add(const String& value) { _values.push_back(String(value)); }
const String& at(const std::size_t n) const { return _values.at(n); } const String& at(const std::size_t n) const { return _values.at(n); }
void check(const String& value); void check(const String& value);
@ -154,7 +154,7 @@ class AutoConnectSelectBasis : virtual public AutoConnectElementBasis {
} }
virtual ~AutoConnectSelectBasis() {} virtual ~AutoConnectSelectBasis() {}
const String toHTML(void) const override; const String toHTML(void) const override;
const String& operator [] (const std::size_t n) const { return at(n); } const String& operator[] (const std::size_t n) const { return at(n); }
void add(const String& option) { _options.push_back(String(option)); } void add(const String& option) { _options.push_back(String(option)); }
const String& at(const std::size_t n) const { return _options.at(n); } const String& at(const std::size_t n) const { return _options.at(n); }
void empty(const size_t reserve = 0); void empty(const size_t reserve = 0);

@ -69,7 +69,7 @@ class AutoConnectElementJson : virtual public AutoConnectElementBasis {
* @param action Script code to execute with the button pushed. * @param action Script code to execute with the button pushed.
*/ */
class AutoConnectButtonJson : public AutoConnectElementJson, public AutoConnectButtonBasis { class AutoConnectButtonJson : public AutoConnectElementJson, public AutoConnectButtonBasis {
public: 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()) {
AutoConnectButtonBasis::name = name; AutoConnectButtonBasis::name = name;
AutoConnectButtonBasis::value = value; AutoConnectButtonBasis::value = value;
@ -137,7 +137,7 @@ class AutoConnectInputJson : public AutoConnectElementJson, public AutoConnectIn
*/ */
class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRadioBasis { class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRadioBasis {
public: public:
explicit AutoConnectRadioJson(const char* name = "", std::vector<String> 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) {
AutoConnectRadioBasis::name = name; AutoConnectRadioBasis::name = name;
AutoConnectRadioBasis::_values = values; AutoConnectRadioBasis::_values = values;
AutoConnectRadioBasis::label = label; AutoConnectRadioBasis::label = label;
@ -160,7 +160,7 @@ class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRa
*/ */
class AutoConnectSelectJson : public AutoConnectElementJson, public AutoConnectSelectBasis { class AutoConnectSelectJson : public AutoConnectElementJson, public AutoConnectSelectBasis {
public: public:
explicit AutoConnectSelectJson(const char* name = "", std::vector<String> options = {}, const char* label = "") { explicit AutoConnectSelectJson(const char* name = "", std::vector<String> const& options = {}, const char* label = "") {
AutoConnectSelectBasis::name = name; AutoConnectSelectBasis::name = name;
AutoConnectSelectBasis::_options = options; AutoConnectSelectBasis::_options = options;
AutoConnectSelectBasis::label = label; AutoConnectSelectBasis::label = label;

Loading…
Cancel
Save