UILList.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef UILList_H
00038 #define UILList_H
00039
00040 #include "label.H"
00041 #include "uLabel.H"
00042
00043
00044
00045 namespace Foam
00046 {
00047
00048 class Ostream;
00049
00050
00051
00052 template<class LListBase, class T>
00053 class UILList;
00054
00055 template<class LListBase, class T>
00056 Ostream& operator<<
00057 (
00058 Ostream&,
00059 const UILList<LListBase, T>&
00060 );
00061
00062
00063
00064
00065
00066
00067 template<class LListBase, class T>
00068 class UILList
00069 :
00070 public LListBase
00071 {
00072
00073 public:
00074
00075
00076
00077 class iterator;
00078 friend class iterator;
00079
00080 class const_iterator;
00081 friend class const_iterator;
00082
00083
00084
00085
00086
00087 UILList()
00088 {}
00089
00090
00091 UILList(T* a)
00092 :
00093 LListBase(a)
00094 {}
00095
00096
00097 UILList(const UILList<LListBase, T>&);
00098
00099
00100
00101
00102
00103
00104
00105 T* first()
00106 {
00107 return static_cast<T*>(LListBase::first());
00108 }
00109
00110
00111 const T* first() const
00112 {
00113 return static_cast<const T*>(LListBase::first());
00114 }
00115
00116
00117 T* last()
00118 {
00119 return static_cast<T*>(LListBase::last());
00120 }
00121
00122
00123 const T* last() const
00124 {
00125 return static_cast<const T*>(LListBase::last());
00126 }
00127
00128
00129
00130
00131
00132 T* removeHead()
00133 {
00134 return static_cast<T*>(LListBase::removeHead());
00135 }
00136
00137
00138 T* remove(T* p)
00139 {
00140 return static_cast<T*>(LListBase::remove(p));
00141 }
00142
00143
00144 T* remove(iterator& it)
00145 {
00146 return static_cast<T*>(LListBase::remove(it));
00147 }
00148
00149
00150
00151
00152 void operator=(const UILList<LListBase, T>&);
00153
00154
00155
00156
00157
00158 typedef T value_type;
00159
00160
00161
00162 typedef T& reference;
00163
00164
00165
00166 typedef const T& const_reference;
00167
00168
00169 typedef label size_type;
00170
00171
00172
00173
00174 typedef typename LListBase::iterator LListBase_iterator;
00175
00176
00177 class iterator
00178 :
00179 public LListBase_iterator
00180 {
00181
00182 public:
00183
00184
00185 iterator
00186 (
00187 LListBase_iterator baseIter
00188 )
00189 :
00190 LListBase_iterator(baseIter)
00191 {}
00192
00193
00194
00195
00196 T& operator*()
00197 {
00198 return static_cast<T&>(LListBase_iterator::operator*());
00199 }
00200
00201 T& operator()()
00202 {
00203 return operator*();
00204 }
00205
00206 iterator& operator++()
00207 {
00208 LListBase_iterator::operator++();
00209 return *this;
00210 }
00211 };
00212
00213
00214
00215
00216 typedef typename LListBase::const_iterator LListBase_const_iterator;
00217
00218
00219 class const_iterator
00220 :
00221 public LListBase_const_iterator
00222 {
00223
00224 public:
00225
00226
00227 const_iterator
00228 (
00229 LListBase_const_iterator baseIter
00230 )
00231 :
00232 LListBase_const_iterator(baseIter)
00233 {}
00234
00235
00236 const_iterator
00237 (
00238 LListBase_iterator baseIter
00239 )
00240 :
00241 LListBase_const_iterator(baseIter)
00242 {}
00243
00244
00245
00246
00247 const T& operator*()
00248 {
00249 return
00250 static_cast<const T&>
00251 (LListBase_const_iterator::operator*());
00252 }
00253
00254 const T& operator()()
00255 {
00256 return operator*();
00257 }
00258
00259 const_iterator& operator++()
00260 {
00261 LListBase_const_iterator::operator++();
00262 return *this;
00263 }
00264 };
00265
00266
00267
00268
00269
00270
00271
00272 bool operator==(const UILList<LListBase, T>&) const;
00273
00274
00275 bool operator!=(const UILList<LListBase, T>&) const;
00276
00277
00278
00279
00280 friend Ostream& operator<< <LListBase, T>
00281 (
00282 Ostream&,
00283 const UILList<LListBase, T>&
00284 );
00285 };
00286
00287
00288
00289
00290 }
00291
00292
00293
00294 #ifdef NoRepository
00295 # include "UILList.C"
00296 #endif
00297
00298
00299
00300 #endif
00301
00302
Copyright © 2000-2009 OpenCFD Ltd