Testovani forku od Otto Wintera a ESPHome (je vyrazne dal, nez puvodni knihovna)
This commit is contained in:
@ -47,10 +47,19 @@ class LinkedList {
|
||||
|
||||
class Iterator {
|
||||
ItemType* _node;
|
||||
ItemType* _nextNode = nullptr;
|
||||
public:
|
||||
Iterator(ItemType* current = nullptr) : _node(current) {}
|
||||
Iterator(ItemType* current = nullptr) : _node(current) {
|
||||
if (_node != nullptr) {
|
||||
_nextNode = current->next;
|
||||
}
|
||||
}
|
||||
Iterator(const Iterator& i) : _node(i._node) {}
|
||||
Iterator& operator ++() { _node = _node->next; return *this; }
|
||||
Iterator& operator ++() {
|
||||
_node = _nextNode;
|
||||
_nextNode = _node != nullptr ? _node->next : nullptr;
|
||||
return *this;
|
||||
}
|
||||
bool operator != (const Iterator& i) const { return _node != i._node; }
|
||||
const T& operator * () const { return _node->value(); }
|
||||
const T* operator -> () const { return &_node->value(); }
|
||||
@ -171,4 +180,23 @@ class LinkedList {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class StringArray : public LinkedList<String> {
|
||||
public:
|
||||
|
||||
StringArray() : LinkedList(nullptr) {}
|
||||
|
||||
bool containsIgnoreCase(const String& str){
|
||||
for (const auto& s : *this) {
|
||||
if (str.equalsIgnoreCase(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* STRINGARRAY_H_ */
|
||||
|
Reference in New Issue
Block a user