mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-07-04 10:05:10 +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;
|
_maxsize=size;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool STORESTRINGS_CLASS::setlenght(int lenght)
|
bool STORESTRINGS_CLASS::setlength(int len)
|
||||||
{
|
{
|
||||||
if (lenght<4)return false;
|
if (len < 4) return false;
|
||||||
_maxstringlength=lenght;
|
_maxstringlength = len;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int STORESTRINGS_CLASS::getsize()
|
|
||||||
{
|
|
||||||
return _maxsize;
|
|
||||||
}
|
|
||||||
int STORESTRINGS_CLASS::getlenght()
|
|
||||||
{
|
|
||||||
return _maxstringlength;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Clear list and content
|
//Clear list and content
|
||||||
void STORESTRINGS_CLASS::clear(){
|
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)
|
bool STORESTRINGS_CLASS::add (const __FlashStringHelper *str)
|
||||||
{
|
{
|
||||||
String stmp;
|
String stmp;
|
||||||
@ -138,10 +125,4 @@ int STORESTRINGS_CLASS::get_index(const char * string)
|
|||||||
//if not found return -1
|
//if not found return -1
|
||||||
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 (int maxsize = -1, int maxstringlength=-1);
|
||||||
~STORESTRINGS_CLASS ();
|
~STORESTRINGS_CLASS ();
|
||||||
bool add (const char * string);
|
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 add (const __FlashStringHelper *str);
|
||||||
bool remove(int pos);
|
bool remove(int pos);
|
||||||
const char * get(int pos);
|
const char * get(int pos);
|
||||||
int get_index(const char * string);
|
int get_index(const char * string);
|
||||||
void clear();
|
void clear();
|
||||||
int size();
|
inline int size() {return _charlist.size();};
|
||||||
bool setsize(int size);
|
bool setsize(int size);
|
||||||
bool setlenght(int lenght);
|
bool setlength(int len);
|
||||||
int getsize();
|
inline int getsize() {return _maxsize;};
|
||||||
int getlenght();
|
inline int getlength() {return _maxstringlength;};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _maxsize;
|
int _maxsize;
|
||||||
int _maxstringlength;
|
int _maxstringlength;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user