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

#include <qvaluelist.h>

Inheritance diagram for QValueList< T >:
QValueStack< T >

Public Types

typedef QValueListIterator< T > Iterator
 
typedef QValueListConstIterator< T > ConstIterator
 
typedef T ValueType
 

Public Member Functions

 QValueList ()
 
 QValueList (const QValueList< T > &l)
 
 ~QValueList ()
 
QValueList< T > & operator= (const QValueList< T > &l)
 
QValueList< T > operator+ (const QValueList< T > &l) const
 
QValueList< T > & operator+= (const QValueList< T > &l)
 
bool operator== (const QValueList< T > &l) const
 
bool operator!= (const QValueList< T > &l) const
 
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
Iterator fromLast ()
 
ConstIterator fromLast () const
 
bool isEmpty () const
 
Iterator insert (Iterator it, const T &x)
 
Iterator append (const T &x)
 
Iterator prepend (const T &x)
 
Iterator remove (Iterator it)
 
void remove (const T &x)
 
T & first ()
 
const T & first () const
 
T & last ()
 
const T & last () const
 
T & operator[] (uint i)
 
const T & operator[] (uint i) const
 
Iterator at (uint i)
 
ConstIterator at (uint i) const
 
Iterator find (const T &x)
 
ConstIterator find (const T &x) const
 
Iterator find (Iterator it, const T &x)
 
ConstIterator find (ConstIterator it, const T &x) const
 
int findIndex (const T &x) const
 
uint contains (const T &x) const
 
uint count () const
 
void clear ()
 
QValueList< T > & operator+= (const T &x)
 
QValueList< T > & operator<< (const T &x)
 

Protected Member Functions

void detach ()
 

Protected Attributes

QValueListPrivate< T > * sh
 

Detailed Description

template<class T>
class QValueList< T >

Definition at line 307 of file qvaluelist.h.

Member Typedef Documentation

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

Definition at line 314 of file qvaluelist.h.

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

Typedefs

Definition at line 313 of file qvaluelist.h.

template<class T>
typedef T QValueList< T >::ValueType

Definition at line 315 of file qvaluelist.h.

Constructor & Destructor Documentation

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

API

Definition at line 320 of file qvaluelist.h.

320 { sh = new QValueListPrivate<T>; }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
QValueList< T >::QValueList ( const QValueList< T > &  l)
inline

Definition at line 321 of file qvaluelist.h.

321 { sh = l.sh; sh->ref(); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
QValueList< T >::~QValueList ( )
inline

Definition at line 322 of file qvaluelist.h.

322 { sh->derefAndDelete(); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420

Member Function Documentation

template<class T>
Iterator QValueList< T >::append ( const T &  x)
inline

Definition at line 372 of file qvaluelist.h.

372 { detach(); return sh->insert( end(), x ); }
void detach()
Definition: qvaluelist.h:415
Iterator end()
Definition: qvaluelist.h:363
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276
template<class T>
Iterator QValueList< T >::at ( uint  i)
inline

Definition at line 385 of file qvaluelist.h.

385 { detach(); return Iterator( sh->at(i) ); }
void detach()
Definition: qvaluelist.h:415
QValueListIterator< T > Iterator
Definition: qvaluelist.h:313
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
ConstIterator QValueList< T >::at ( uint  i) const
inline

Definition at line 386 of file qvaluelist.h.

386 { return ConstIterator( sh->at(i) ); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
template<class T>
Iterator QValueList< T >::begin ( )
inline

Definition at line 361 of file qvaluelist.h.

361 { detach(); return Iterator( sh->node->next ); }
void detach()
Definition: qvaluelist.h:415
QValueListIterator< T > Iterator
Definition: qvaluelist.h:313
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
ConstIterator QValueList< T >::begin ( ) const
inline

Definition at line 362 of file qvaluelist.h.

362 { return ConstIterator( sh->node->next ); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
template<class T>
void QValueList< T >::clear ( )
inline

Definition at line 396 of file qvaluelist.h.

396 { if ( sh->count == 1 ) sh->clear(); else { sh->deref(); sh = new QValueListPrivate<T>; } }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
uint QValueList< T >::contains ( const T &  x) const
inline

Definition at line 392 of file qvaluelist.h.

392 { return sh->contains( x ); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276
template<class T>
uint QValueList< T >::count ( ) const
inline

Definition at line 394 of file qvaluelist.h.

394 { return sh->nodes; }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
void QValueList< T >::detach ( )
inlineprotected

Helpers

Definition at line 415 of file qvaluelist.h.

415 { if ( sh->count > 1 ) { sh->deref(); sh = new QValueListPrivate<T>( *sh ); } }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
Iterator QValueList< T >::end ( )
inline

Definition at line 363 of file qvaluelist.h.

363 { detach(); return Iterator( sh->node ); }
void detach()
Definition: qvaluelist.h:415
QValueListIterator< T > Iterator
Definition: qvaluelist.h:313
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
ConstIterator QValueList< T >::end ( ) const
inline

Definition at line 364 of file qvaluelist.h.

364 { return ConstIterator( sh->node ); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
template<class T>
Iterator QValueList< T >::find ( const T &  x)
inline

Definition at line 387 of file qvaluelist.h.

387 { detach(); return Iterator( sh->find( sh->node->next, x) ); }
void detach()
Definition: qvaluelist.h:415
QValueListIterator< T > Iterator
Definition: qvaluelist.h:313
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276
template<class T>
ConstIterator QValueList< T >::find ( const T &  x) const
inline

Definition at line 388 of file qvaluelist.h.

388 { return ConstIterator( sh->find( sh->node->next, x) ); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
template<class T>
Iterator QValueList< T >::find ( Iterator  it,
const T &  x 
)
inline

Definition at line 389 of file qvaluelist.h.

389 { detach(); return Iterator( sh->find( it.node, x ) ); }
void detach()
Definition: qvaluelist.h:415
QValueListIterator< T > Iterator
Definition: qvaluelist.h:313
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276
template<class T>
ConstIterator QValueList< T >::find ( ConstIterator  it,
const T &  x 
) const
inline

Definition at line 390 of file qvaluelist.h.

390 { return ConstIterator( sh->find( it.node, x ) ); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
template<class T>
int QValueList< T >::findIndex ( const T &  x) const
inline

Definition at line 391 of file qvaluelist.h.

391 { return sh->findIndex( sh->node->next, x) ; }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276
template<class T>
T& QValueList< T >::first ( )
inline

Definition at line 378 of file qvaluelist.h.

378 { detach(); return sh->node->next->data; }
void detach()
Definition: qvaluelist.h:415
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
const T& QValueList< T >::first ( ) const
inline

Definition at line 379 of file qvaluelist.h.

379 { return sh->node->next->data; }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
Iterator QValueList< T >::fromLast ( )
inline

Definition at line 365 of file qvaluelist.h.

365 { detach(); return Iterator( sh->node->prev ); }
void detach()
Definition: qvaluelist.h:415
QValueListIterator< T > Iterator
Definition: qvaluelist.h:313
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
ConstIterator QValueList< T >::fromLast ( ) const
inline

Definition at line 366 of file qvaluelist.h.

366 { return ConstIterator( sh->node->prev ); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
template<class T>
Iterator QValueList< T >::insert ( Iterator  it,
const T &  x 
)
inline

Definition at line 370 of file qvaluelist.h.

370 { detach(); return sh->insert( it, x ); }
void detach()
Definition: qvaluelist.h:415
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276
template<class T>
bool QValueList< T >::isEmpty ( ) const
inline

Definition at line 368 of file qvaluelist.h.

368 { return ( sh->nodes == 0 ); }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
T& QValueList< T >::last ( )
inline

Definition at line 380 of file qvaluelist.h.

380 { detach(); return sh->node->prev->data; }
void detach()
Definition: qvaluelist.h:415
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
const T& QValueList< T >::last ( ) const
inline

Definition at line 381 of file qvaluelist.h.

381 { return sh->node->prev->data; }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
bool QValueList< T >::operator!= ( const QValueList< T > &  l) const
inline

Definition at line 359 of file qvaluelist.h.

359 { return !( *this == l ); }
static QStrList * l
Definition: config.cpp:1044
template<class T>
QValueList<T> QValueList< T >::operator+ ( const QValueList< T > &  l) const
inline

Definition at line 332 of file qvaluelist.h.

333  {
334  QValueList<T> l2( *this );
335  for( ConstIterator it = l.begin(); it != l.end(); ++it )
336  l2.append( *it );
337  return l2;
338  }
Iterator end()
Definition: qvaluelist.h:363
Iterator begin()
Definition: qvaluelist.h:361
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
template<class T>
QValueList<T>& QValueList< T >::operator+= ( const QValueList< T > &  l)
inline

Definition at line 340 of file qvaluelist.h.

341  {
342  for( ConstIterator it = l.begin(); it != l.end(); ++it )
343  append( *it );
344  return *this;
345  }
Iterator append(const T &x)
Definition: qvaluelist.h:372
Iterator end()
Definition: qvaluelist.h:363
Iterator begin()
Definition: qvaluelist.h:361
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
template<class T>
QValueList<T>& QValueList< T >::operator+= ( const T &  x)
inline

Definition at line 399 of file qvaluelist.h.

400  {
401  append( x );
402  return *this;
403  }
Iterator append(const T &x)
Definition: qvaluelist.h:372
list x
Definition: train.py:276
template<class T>
QValueList<T>& QValueList< T >::operator<< ( const T &  x)
inline

Definition at line 404 of file qvaluelist.h.

405  {
406  append( x );
407  return *this;
408  }
Iterator append(const T &x)
Definition: qvaluelist.h:372
list x
Definition: train.py:276
template<class T>
QValueList<T>& QValueList< T >::operator= ( const QValueList< T > &  l)
inline

Definition at line 324 of file qvaluelist.h.

325  {
326  l.sh->ref();
327  sh->derefAndDelete();
328  sh = l.sh;
329  return *this;
330  }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
bool QValueList< T >::operator== ( const QValueList< T > &  l) const
inline

Definition at line 347 of file qvaluelist.h.

348  {
349  if ( count() != l.count() )
350  return FALSE;
351  ConstIterator it2 = begin();
352  ConstIterator it = l.begin();
353  for( ; it != l.end(); ++it, ++it2 )
354  if ( !( *it == *it2 ) )
355  return FALSE;
356  return TRUE;
357  }
Iterator end()
Definition: qvaluelist.h:363
const bool FALSE
Definition: qglobal.h:370
uint count() const
Definition: qvaluelist.h:394
Iterator begin()
Definition: qvaluelist.h:361
QValueListConstIterator< T > ConstIterator
Definition: qvaluelist.h:314
const bool TRUE
Definition: qglobal.h:371
template<class T>
T& QValueList< T >::operator[] ( uint  i)
inline

Definition at line 383 of file qvaluelist.h.

383 { detach(); return sh->at(i)->data; }
void detach()
Definition: qvaluelist.h:415
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
const T& QValueList< T >::operator[] ( uint  i) const
inline

Definition at line 384 of file qvaluelist.h.

384 { return sh->at(i)->data; }
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
Iterator QValueList< T >::prepend ( const T &  x)
inline

Definition at line 373 of file qvaluelist.h.

373 { detach(); return sh->insert( begin(), x ); }
void detach()
Definition: qvaluelist.h:415
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
Iterator begin()
Definition: qvaluelist.h:361
list x
Definition: train.py:276
template<class T>
Iterator QValueList< T >::remove ( Iterator  it)
inline

Definition at line 375 of file qvaluelist.h.

375 { detach(); return sh->remove( it ); }
void detach()
Definition: qvaluelist.h:415
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
template<class T>
void QValueList< T >::remove ( const T &  x)
inline

Definition at line 376 of file qvaluelist.h.

376 { detach(); sh->remove( x ); }
void detach()
Definition: qvaluelist.h:415
QValueListPrivate< T > * sh
Definition: qvaluelist.h:420
list x
Definition: train.py:276

Member Data Documentation

template<class T>
QValueListPrivate<T>* QValueList< T >::sh
protected

Variables

Definition at line 420 of file qvaluelist.h.


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