![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2007 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: linkedList.h,v $ $Revision: 1.3 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00012 #ifndef DTLINKEDLIST_H_ 00013 #define DTLINKEDLIST_H_ 00014 00015 #include <QtCore/QLinkedList> 00016 00019 00020 template <typename T> 00021 class DtLinkedList : public QLinkedList<T> 00022 { 00023 00024 public: 00025 DtLinkedList<T>() : QLinkedList<T>() {}; 00026 DtLinkedList<T>(const DtLinkedList<T>& orig) : QLinkedList<T>(orig) {}; 00027 virtual ~DtLinkedList<T>() {}; 00028 00029 public: 00032 typename DtLinkedList<T>::iterator find(const T& t) 00033 { 00034 typename DtLinkedList<T>::iterator from = this->begin(); 00035 while (from != this->end() && !(*from == t)) 00036 { 00037 ++ from; 00038 } 00039 return from; 00040 }; 00041 00042 typename DtLinkedList<T>::const_iterator find(const T& t) const 00043 { 00044 typename DtLinkedList<T>::const_iterator from = this->begin(); 00045 while (from != this->end() && !(*from == t)) 00046 { 00047 ++ from; 00048 } 00049 return from; 00050 }; 00051 00052 T& operator[](int i) 00053 { 00054 typename DtLinkedList<T>::iterator from = this->begin(); 00055 int index = 0; 00056 while ((from != this->end()) && (index != i)) 00057 { 00058 ++from; 00059 ++index; 00060 } 00061 return *from; 00062 }; 00063 00064 const T& operator[](int i) const 00065 { 00066 typename DtLinkedList<T>::const_iterator from = this->begin(); 00067 int index = 0; 00068 while ((from != this->end()) && (index != i)) 00069 { 00070 ++from; 00071 ++index; 00072 } 00073 return *from; 00074 }; 00075 00076 }; 00077 00078 #endif //DTLINKEDLIST_H_