mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-07-03 13:15:11 +08:00
Code refactoring
Thanks a lot @treepleks
This commit is contained in:
parent
60326f3aba
commit
a07daf9e40
@ -39,20 +39,12 @@ bool STORESTRINGS_CLASS::setsize(int size)
|
||||
_maxsize=size;
|
||||
return true;
|
||||
}
|
||||
bool STORESTRINGS_CLASS::setlenght(int lenght)
|
||||
bool STORESTRINGS_CLASS::setlength(int len)
|
||||
{
|
||||
if (lenght<4)return false;
|
||||
_maxstringlength=lenght;
|
||||
if (len < 4) return false;
|
||||
_maxstringlength = len;
|
||||
return true;
|
||||
}
|
||||
int STORESTRINGS_CLASS::getsize()
|
||||
{
|
||||
return _maxsize;
|
||||
}
|
||||
int STORESTRINGS_CLASS::getlenght()
|
||||
{
|
||||
return _maxstringlength;
|
||||
}
|
||||
|
||||
//Clear list and content
|
||||
void STORESTRINGS_CLASS::clear(){
|
||||
@ -65,11 +57,6 @@ void STORESTRINGS_CLASS::clear(){
|
||||
}
|
||||
}
|
||||
|
||||
bool STORESTRINGS_CLASS::add (String & string)
|
||||
{
|
||||
return add(string.c_str());
|
||||
}
|
||||
|
||||
bool STORESTRINGS_CLASS::add (const __FlashStringHelper *str)
|
||||
{
|
||||
String stmp;
|
||||
@ -138,10 +125,4 @@ int STORESTRINGS_CLASS::get_index(const char * string)
|
||||
//if not found return -1
|
||||
return -1;
|
||||
}
|
||||
//Number of elements in list
|
||||
int STORESTRINGS_CLASS::size()
|
||||
{
|
||||
return _charlist.size();
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,17 +28,18 @@ class STORESTRINGS_CLASS
|
||||
STORESTRINGS_CLASS (int maxsize = -1, int maxstringlength=-1);
|
||||
~STORESTRINGS_CLASS ();
|
||||
bool add (const char * string);
|
||||
bool add (String & string);
|
||||
inline bool add (String & string) {return add(string.c_str());};
|
||||
bool add (const __FlashStringHelper *str);
|
||||
bool remove(int pos);
|
||||
const char * get(int pos);
|
||||
int get_index(const char * string);
|
||||
void clear();
|
||||
int size();
|
||||
inline int size() {return _charlist.size();};
|
||||
bool setsize(int size);
|
||||
bool setlenght(int lenght);
|
||||
int getsize();
|
||||
int getlenght();
|
||||
bool setlength(int len);
|
||||
inline int getsize() {return _maxsize;};
|
||||
inline int getlength() {return _maxstringlength;};
|
||||
|
||||
private:
|
||||
int _maxsize;
|
||||
int _maxstringlength;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user