VR-Forces 4.2 Class Documentation
linkedList.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2007 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: linkedList.h,v $ $Revision: 1.3 $ $State: Exp $
7 *******************************************************************************/
8 
11 
12 #ifndef DTLINKEDLIST_H_
13 #define DTLINKEDLIST_H_
14 
15 #include <QtCore/QLinkedList>
16 
19 
20 template <typename T>
21 class DtLinkedList : public QLinkedList<T>
22 {
23 
24 public:
27  virtual ~DtLinkedList<T>() {};
28 
29 public:
32  typename DtLinkedList<T>::iterator find(const T& t)
33  {
34  typename DtLinkedList<T>::iterator from = this->begin();
35  while (from != this->end() && !(*from == t))
36  {
37  ++ from;
38  }
39  return from;
40  };
41 
42  typename DtLinkedList<T>::const_iterator find(const T& t) const
43  {
44  typename DtLinkedList<T>::const_iterator from = this->begin();
45  while (from != this->end() && !(*from == t))
46  {
47  ++ from;
48  }
49  return from;
50  };
51 
52  T& operator[](int i)
53  {
54  typename DtLinkedList<T>::iterator from = this->begin();
55  int index = 0;
56  while ((from != this->end()) && (index != i))
57  {
58  ++from;
59  ++index;
60  }
61  return *from;
62  };
63 
64  const T& operator[](int i) const
65  {
66  typename DtLinkedList<T>::const_iterator from = this->begin();
67  int index = 0;
68  while ((from != this->end()) && (index != i))
69  {
70  ++from;
71  ++index;
72  }
73  return *from;
74  };
75 
76 };
77 
78 #endif //DTLINKEDLIST_H_

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)