Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Diff: Core/LinkedList.h
- Revision:
- 18:d849f3ada858
- Parent:
- 15:e69fd74d42e4
--- a/Core/LinkedList.h Sun May 22 16:35:23 2016 +0000 +++ b/Core/LinkedList.h Sat May 28 14:50:14 2016 +0000 @@ -17,6 +17,30 @@ }; template<class T> +class LinkedListIterator { + public: + LinkedListIterator(LinkedListNode<T> *first) { + _current = first; + } + + ~LinkedListIterator() {} + + T* next() { + + LinkedListNode<T>* p = _current; + if(p != NULL) { + _current = _current->next; + return p->data; + } + + return NULL; + } + +private: + LinkedListNode<T>* _current; +}; + +template<class T> class LinkedList { @@ -24,7 +48,11 @@ LinkedList() : _first(NULL), _next(NULL), _current(NULL), _size(0) {} ~LinkedList() {} - + + LinkedListIterator<T> getIterator() { + LinkedListIterator<T> iterator(_first); + return iterator; + } void append(T* data) {