Fixed a minor coding style

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

@ -115,7 +115,7 @@ bool AutoConnect::begin(const char* ssid, const char* passphrase, unsigned long
if (_apConfig.hostName.length())
WiFi.hostname(_apConfig.hostName.c_str());
// If the portal is requested promptly skip the first WiFi.begin and
// If the portal is requested promptly skip the first WiFi.begin and
// immediately start the portal.
if (_apConfig.immediateStart) {
cs = false;

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

@ -58,8 +58,6 @@ class AutoConnectAux : public PageBuilder {
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 */
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, 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 */
@ -78,7 +76,7 @@ class AutoConnectAux : public PageBuilder {
protected:
void _concat(AutoConnectAux& aux); /**< Make up chain of AutoConnectAux */
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 _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 */

@ -121,11 +121,11 @@ 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) {
_type = AC_Radio;
_type = AC_Radio;
}
virtual ~AutoConnectRadioBasis() {}
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)); }
const String& at(const std::size_t n) const { return _values.at(n); }
void check(const String& value);
@ -154,7 +154,7 @@ class AutoConnectSelectBasis : virtual public AutoConnectElementBasis {
}
virtual ~AutoConnectSelectBasis() {}
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)); }
const String& at(const std::size_t n) const { return _options.at(n); }
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.
*/
class AutoConnectButtonJson : public AutoConnectElementJson, public AutoConnectButtonBasis {
public:
public:
explicit AutoConnectButtonJson(const char* name = "", const char* value = "", const String action = String()) {
AutoConnectButtonBasis::name = name;
AutoConnectButtonBasis::value = value;
@ -137,7 +137,7 @@ class AutoConnectInputJson : public AutoConnectElementJson, public AutoConnectIn
*/
class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRadioBasis {
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::_values = values;
AutoConnectRadioBasis::label = label;
@ -160,7 +160,7 @@ class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRa
*/
class AutoConnectSelectJson : public AutoConnectElementJson, public AutoConnectSelectBasis {
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::_options = options;
AutoConnectSelectBasis::label = label;

Loading…
Cancel
Save