KVIrc 5.2.4
Developer APIs
KviPtrListIterator.h
Go to the documentation of this file.
1#ifndef _KVI_PTR_LIST_ITERATOR_H_
2#define _KVI_PTR_LIST_ITERATOR_H_
3//=============================================================================
4//
5// File : KviPtrListIterator.h
6// Creation date : Tue July 30 2016 06:18:52 by Matt Ullman
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2016 Matt Ullman (staticfox at staticfox dot net)
10//
11// This program is FREE software. You can redistribute it and/or
12// modify it under the terms of the GNU General Public License
13// as published by the Free Software Foundation; either version 2
14// of the License, or (at your option) any later version.
15//
16// This program is distributed in the HOPE that it will be USEFUL,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19// See the GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program. If not, write to the Free Software Foundation,
23// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24//
25//=============================================================================
26
27#include "KviPointerList.h"
28
29template<typename T>
31
33 T * c;
34
35public:
36
39 c(c)
40 {
41 }
42
43 T &operator*() const
44 {
45 return *this->c;
46 }
47
49 {
50 this->c = this->ptrList->next();
51 return *this;
52 }
53
54 bool operator!=(const KviPtrListIterator & other) const
55 {
56 return this->c != other.c;
57 }
58
59};
60
61template<typename T>
63{
64 return KviPtrListIterator<T>(ptrList, ptrList->first());
65}
66
67template<typename T>
69{
70 return KviPtrListIterator<T>(ptrList, nullptr);
71}
72
73#endif
C++ Template based double linked pointer list class.
KviPtrListIterator< T > end(KviPointerList< T > *ptrList)
Definition KviPtrListIterator.h:68
KviPtrListIterator< T > begin(KviPointerList< T > *ptrList)
Definition KviPtrListIterator.h:62
A template double linked list of pointers.
Definition KviPointerList.h:371
T * first()
Returns the first item in the list.
Definition KviPointerList.h:632
T * next()
Returns the next item in the list.
Definition KviPointerList.h:781
Definition KviPtrListIterator.h:30
T * c
Definition KviPtrListIterator.h:33
T & operator*() const
Definition KviPtrListIterator.h:43
bool operator!=(const KviPtrListIterator &other) const
Definition KviPtrListIterator.h:54
KviPtrListIterator & operator++()
Definition KviPtrListIterator.h:48
KviPointerList< T > * ptrList
Definition KviPtrListIterator.h:32
KviPtrListIterator(KviPointerList< T > *ptrList, T *c)
Definition KviPtrListIterator.h:37