From 893568052a79823bb1de80e8ab2d9bb22072d25a Mon Sep 17 00:00:00 2001 From: Flavio Fernandes Date: Fri, 7 Feb 2020 07:31:52 -0500 Subject: [PATCH] trivial: WiFiManagerParameter get accessors should work on const instances Enhancement: It should be okay to invoke getID() and getValue() in a const instance of the WiFiManagerParameter class. See: https://github.com/flavio-fernandes/persistWifiSetting/commit/135adb1c7e436db1ed92ccd5eb522b9ae418b216 --- WiFiManager.cpp | 14 +++++++------- WiFiManager.h | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 1ecc949..abda41f 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -88,25 +88,25 @@ void WiFiManagerParameter::setValue(const char *defaultValue, int length) { strncpy(_value, defaultValue, _length); } } -const char* WiFiManagerParameter::getValue() { +const char* WiFiManagerParameter::getValue() const { return _value; } -const char* WiFiManagerParameter::getID() { +const char* WiFiManagerParameter::getID() const { return _id; } -const char* WiFiManagerParameter::getPlaceholder() { +const char* WiFiManagerParameter::getPlaceholder() const { return _label; } -const char* WiFiManagerParameter::getLabel() { +const char* WiFiManagerParameter::getLabel() const { return _label; } -int WiFiManagerParameter::getValueLength() { +int WiFiManagerParameter::getValueLength() const { return _length; } -int WiFiManagerParameter::getLabelPlacement() { +int WiFiManagerParameter::getLabelPlacement() const { return _labelPlacement; } -const char* WiFiManagerParameter::getCustomHTML() { +const char* WiFiManagerParameter::getCustomHTML() const { return _customHTML; } diff --git a/WiFiManager.h b/WiFiManager.h index 97f6784..0c23aa4 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -115,13 +115,13 @@ class WiFiManagerParameter { WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length, const char *custom, int labelPlacement); ~WiFiManagerParameter(); - const char *getID(); - const char *getValue(); - const char *getLabel(); - const char *getPlaceholder(); // @deprecated, use getLabel - int getValueLength(); - int getLabelPlacement(); - const char *getCustomHTML(); + const char *getID() const; + const char *getValue() const; + const char *getLabel() const; + const char *getPlaceholder() const; // @deprecated, use getLabel + int getValueLength() const; + int getLabelPlacement() const; + const char *getCustomHTML() const; void setValue(const char *defaultValue, int length); protected: