From e81b990a31399532dd70bdf9ef285d1de4049c0c Mon Sep 17 00:00:00 2001 From: Jim Kowalkowski Date: Wed, 14 Aug 1996 12:32:09 +0000 Subject: [PATCH] added first() to list class, added first()/last() to iterator. --- src/cxxTemplates/tsDLList.h | 26 ++++++++++++++++++++++++++ src/libCom/cxxTemplates/tsDLList.h | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/cxxTemplates/tsDLList.h b/src/cxxTemplates/tsDLList.h index c2ada4fc6..7de4d4699 100644 --- a/src/cxxTemplates/tsDLList.h +++ b/src/cxxTemplates/tsDLList.h @@ -31,6 +31,9 @@ * * History * $Log$ + * Revision 1.3 1996/07/25 18:01:41 jhill + * use pointer (not ref) for list in iter class + * * Revision 1.2 1996/07/24 22:12:03 jhill * added remove() to iter class + made node's prev/next private * @@ -259,6 +262,11 @@ public: // int find(T &item); + T *first(void) const { return pFirst; } + +protected: + T *getFirst(void) const { return pFirst; } + T *getLast(void) const { return pLast; } private: T *pFirst; T *pLast; @@ -279,6 +287,10 @@ public: // do _not_ change the node pointers // void operator = (tsDLNode &) {} + +protected: + T *getNext(void) { return pNext; } + T *getPrev(void) { return pPrev; } private: T *pNext; T *pPrev; @@ -340,6 +352,18 @@ public: return pCur; } + T * first() + { + this->pCurrent = this->pList->pFirst; + return this->pCurrent; + } + + T * last() + { + this->pCurrent = this->pList->pLast; + return this->pCurrent; + } + T * operator () () { return this->next(); @@ -365,6 +389,8 @@ public: this->pList->remove(*pCur); } } +protected: + tsDLList *getList() { return pList; } private: tsDLList *pList; T *pCurrent; diff --git a/src/libCom/cxxTemplates/tsDLList.h b/src/libCom/cxxTemplates/tsDLList.h index c2ada4fc6..7de4d4699 100644 --- a/src/libCom/cxxTemplates/tsDLList.h +++ b/src/libCom/cxxTemplates/tsDLList.h @@ -31,6 +31,9 @@ * * History * $Log$ + * Revision 1.3 1996/07/25 18:01:41 jhill + * use pointer (not ref) for list in iter class + * * Revision 1.2 1996/07/24 22:12:03 jhill * added remove() to iter class + made node's prev/next private * @@ -259,6 +262,11 @@ public: // int find(T &item); + T *first(void) const { return pFirst; } + +protected: + T *getFirst(void) const { return pFirst; } + T *getLast(void) const { return pLast; } private: T *pFirst; T *pLast; @@ -279,6 +287,10 @@ public: // do _not_ change the node pointers // void operator = (tsDLNode &) {} + +protected: + T *getNext(void) { return pNext; } + T *getPrev(void) { return pPrev; } private: T *pNext; T *pPrev; @@ -340,6 +352,18 @@ public: return pCur; } + T * first() + { + this->pCurrent = this->pList->pFirst; + return this->pCurrent; + } + + T * last() + { + this->pCurrent = this->pList->pLast; + return this->pCurrent; + } + T * operator () () { return this->next(); @@ -365,6 +389,8 @@ public: this->pList->remove(*pCur); } } +protected: + tsDLList *getList() { return pList; } private: tsDLList *pList; T *pCurrent;