Public Types | Public Member Functions | Public Attributes | List of all members
QValueListPrivate< T > Class Template Reference

#include <qvaluelist.h>

Inheritance diagram for QValueListPrivate< T >:
QShared

Public Types

typedef QValueListIterator< T > Iterator
 
typedef QValueListConstIterator< T > ConstIterator
 
typedef QValueListNode< T > Node
 
typedef QValueListNode< T > * NodePtr
 

Public Member Functions

 QValueListPrivate ()
 
 QValueListPrivate (const QValueListPrivate< T > &_p)
 
void derefAndDelete ()
 
 ~QValueListPrivate ()
 
Iterator insert (Iterator it, const T &x)
 
Iterator remove (Iterator it)
 
NodePtr find (NodePtr start, const T &x) const
 
int findIndex (NodePtr start, const T &x) const
 
uint contains (const T &x) const
 
void remove (const T &x)
 
NodePtr at (uint i) const
 
void clear ()
 
- Public Member Functions inherited from QShared
 QShared ()
 
void ref ()
 
bool deref ()
 

Public Attributes

NodePtr node
 
uint nodes
 
- Public Attributes inherited from QShared
uint count
 

Detailed Description

template<class T>
class QValueListPrivate< T >

Definition at line 171 of file qvaluelist.h.

Member Typedef Documentation

template<class T>
typedef QValueListConstIterator<T> QValueListPrivate< T >::ConstIterator

Definition at line 178 of file qvaluelist.h.

template<class T>
typedef QValueListIterator<T> QValueListPrivate< T >::Iterator

Typedefs

Definition at line 177 of file qvaluelist.h.

template<class T>
typedef QValueListNode<T> QValueListPrivate< T >::Node

Definition at line 179 of file qvaluelist.h.

template<class T>
typedef QValueListNode<T>* QValueListPrivate< T >::NodePtr

Definition at line 180 of file qvaluelist.h.

Constructor & Destructor Documentation

template<class T>
QValueListPrivate< T >::QValueListPrivate ( )
inline

Functions

Definition at line 185 of file qvaluelist.h.

185 { node = new Node; node->next = node->prev = node; nodes = 0; }
QValueListNode< T > Node
Definition: qvaluelist.h:179
QValueListNode< T > * prev
Definition: qvaluelist.h:62
QValueListNode< T > * next
Definition: qvaluelist.h:61
template<class T>
QValueListPrivate< T >::QValueListPrivate ( const QValueListPrivate< T > &  _p)
inline

Definition at line 186 of file qvaluelist.h.

186  : QShared() {
187  node = new Node; node->next = node->prev = node; nodes = 0;
188  Iterator b( _p.node->next );
189  Iterator e( _p.node );
190  Iterator i( node );
191  while( b != e )
192  insert( i, *b++ );
193  }
QValueListNode< T > Node
Definition: qvaluelist.h:179
QValueListIterator< T > Iterator
Definition: qvaluelist.h:177
const double e
QShared()
Definition: qshared.h:48
Iterator insert(Iterator it, const T &x)
Definition: qvaluelist.h:215
static bool * b
Definition: config.cpp:1043
QValueListNode< T > * prev
Definition: qvaluelist.h:62
QValueListNode< T > * next
Definition: qvaluelist.h:61
template<class T>
QValueListPrivate< T >::~QValueListPrivate ( )
inline

Definition at line 205 of file qvaluelist.h.

205  {
206  NodePtr p = node->next;
207  while( p != node ) {
208  NodePtr x = p->next;
209  delete p;
210  p = x;
211  }
212  delete node;
213  }
p
Definition: test.py:223
list x
Definition: train.py:276
QValueListNode< T > * next
Definition: qvaluelist.h:61

Member Function Documentation

template<class T>
NodePtr QValueListPrivate< T >::at ( uint  i) const
inline

Definition at line 283 of file qvaluelist.h.

283  {
284  ASSERT( i <= nodes );
285  NodePtr p = node->next;
286  for( uint x = 0; x < i; ++x )
287  p = p->next;
288  return p;
289  }
p
Definition: test.py:223
list x
Definition: train.py:276
QValueListNode< T > * next
Definition: qvaluelist.h:61
unsigned uint
Definition: qglobal.h:351
#define ASSERT(x)
Definition: qglobal.h:590
template<class T>
void QValueListPrivate< T >::clear ( )
inline

Definition at line 291 of file qvaluelist.h.

291  {
292  nodes = 0;
293  NodePtr p = node->next;
294  while( p != node ) {
295  NodePtr next = p->next;
296  delete p;
297  p = next;
298  }
299  node->next = node->prev = node;
300  }
p
Definition: test.py:223
QValueListNode< T > * prev
Definition: qvaluelist.h:62
QValueListNode< T > * next
Definition: qvaluelist.h:61
template<class T>
uint QValueListPrivate< T >::contains ( const T &  x) const
inline

Definition at line 260 of file qvaluelist.h.

260  {
261  uint result = 0;
262  Iterator first = Iterator( node->next );
263  Iterator last = Iterator( node );
264  while( first != last) {
265  if ( *first == x )
266  ++result;
267  ++first;
268  }
269  return result;
270  }
static QCString result
QValueListIterator< T > Iterator
Definition: qvaluelist.h:177
list x
Definition: train.py:276
QValueListNode< T > * next
Definition: qvaluelist.h:61
unsigned uint
Definition: qglobal.h:351
template<class T>
void QValueListPrivate< T >::derefAndDelete ( )
inline

Definition at line 195 of file qvaluelist.h.

196  {
197  if ( deref() )
198  delete this;
199  }
bool deref()
Definition: qshared.h:50
template<class T>
NodePtr QValueListPrivate< T >::find ( NodePtr  start,
const T &  x 
) const
inline

Definition at line 236 of file qvaluelist.h.

236  {
237  ConstIterator first( start );
238  ConstIterator last( node );
239  while( first != last) {
240  if ( *first == x )
241  return first.node;
242  ++first;
243  }
244  return last.node;
245  }
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:178
list x
Definition: train.py:276
template<class T>
int QValueListPrivate< T >::findIndex ( NodePtr  start,
const T &  x 
) const
inline

Definition at line 247 of file qvaluelist.h.

247  {
248  ConstIterator first( start );
249  ConstIterator last( node );
250  int pos = 0;
251  while( first != last) {
252  if ( *first == x )
253  return pos;
254  ++first;
255  ++pos;
256  }
257  return -1;
258  }
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:178
list x
Definition: train.py:276
template<class T>
Iterator QValueListPrivate< T >::insert ( Iterator  it,
const T &  x 
)
inline

Definition at line 215 of file qvaluelist.h.

215  {
216  NodePtr p = new Node( x );
217  p->next = it.node;
218  p->prev = it.node->prev;
219  it.node->prev->next = p;
220  it.node->prev = p;
221  nodes++;
222  return p;
223  }
QValueListNode< T > Node
Definition: qvaluelist.h:179
p
Definition: test.py:223
list x
Definition: train.py:276
template<class T>
Iterator QValueListPrivate< T >::remove ( Iterator  it)
inline

Definition at line 225 of file qvaluelist.h.

225  {
226  ASSERT ( it.node != node );
227  NodePtr next = it.node->next;
228  NodePtr prev = it.node->prev;
229  prev->next = next;
230  next->prev = prev;
231  delete it.node;
232  nodes--;
233  return Iterator( next );
234  }
QValueListIterator< T > Iterator
Definition: qvaluelist.h:177
#define ASSERT(x)
Definition: qglobal.h:590
template<class T>
void QValueListPrivate< T >::remove ( const T &  x)
inline

Definition at line 272 of file qvaluelist.h.

272  {
273  Iterator first = Iterator( node->next );
274  Iterator last = Iterator( node );
275  while( first != last) {
276  if ( *first == x )
277  first = remove( first );
278  else
279  ++first;
280  }
281  }
QValueListIterator< T > Iterator
Definition: qvaluelist.h:177
list x
Definition: train.py:276
QValueListNode< T > * next
Definition: qvaluelist.h:61

Member Data Documentation

template<class T>
NodePtr QValueListPrivate< T >::node

Definition at line 302 of file qvaluelist.h.

template<class T>
uint QValueListPrivate< T >::nodes

Definition at line 303 of file qvaluelist.h.


The documentation for this class was generated from the following file: