Blame qtools/qvaluelist.doc

Packit 1c1d7e
/****************************************************************************
Packit 1c1d7e
** 
Packit 1c1d7e
**
Packit 1c1d7e
** QValueList and QValueListIterator class documentation
Packit 1c1d7e
**
Packit 1c1d7e
** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
Packit 1c1d7e
**
Packit 1c1d7e
** This file is part of the Qt GUI Toolkit.
Packit 1c1d7e
**
Packit 1c1d7e
** This file may be distributed under the terms of the Q Public License
Packit 1c1d7e
** as defined by Trolltech AS of Norway and appearing in the file
Packit 1c1d7e
** LICENSE.QPL included in the packaging of this file.
Packit 1c1d7e
**
Packit 1c1d7e
** This file may be distributed and/or modified under the terms of the
Packit 1c1d7e
** GNU General Public License version 2 as published by the Free Software
Packit 1c1d7e
** Foundation and appearing in the file LICENSE.GPL included in the
Packit 1c1d7e
** packaging of this file.
Packit 1c1d7e
**
Packit 1c1d7e
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
Packit 1c1d7e
** licenses may use this file in accordance with the Qt Commercial License
Packit 1c1d7e
** Agreement provided with the Software.
Packit 1c1d7e
**
Packit 1c1d7e
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
Packit 1c1d7e
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Packit 1c1d7e
**
Packit 1c1d7e
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
Packit 1c1d7e
**   information about Qt Commercial License Agreements.
Packit 1c1d7e
** See http://www.trolltech.com/qpl/ for QPL licensing information.
Packit 1c1d7e
** See http://www.trolltech.com/gpl/ for GPL licensing information.
Packit 1c1d7e
**
Packit 1c1d7e
** Contact info@trolltech.com if any conditions of this licensing are
Packit 1c1d7e
** not clear to you.
Packit 1c1d7e
**
Packit 1c1d7e
**********************************************************************/
Packit 1c1d7e
Packit 1c1d7e
Packit 1c1d7e
/*****************************************************************************
Packit 1c1d7e
  QValueList documentation
Packit 1c1d7e
 *****************************************************************************/
Packit 1c1d7e
Packit 1c1d7e
/*!
Packit 1c1d7e
  \class QValueList qvaluelist.h
Packit 1c1d7e
  \brief The QValueList class is a value based template class that provides doubly linked lists.
Packit 1c1d7e
Packit 1c1d7e
  \ingroup qtl
Packit 1c1d7e
  \ingroup tools
Packit 1c1d7e
  \ingroup shared
Packit 1c1d7e
Packit 1c1d7e
  Define a template instance QValueList\<X\> to create a list of values which all
Packit 1c1d7e
  have the class X. Please notice that QValueList does not store pointers to the
Packit 1c1d7e
  members of the list. It holds a copy of every member. That is the reason why this
Packit 1c1d7e
  kind of classes are called "value based" while QList and QDict are "reference based".
Packit 1c1d7e
Packit 1c1d7e
  Some classes can not be used within a QValueList,  for example everything
Packit 1c1d7e
  derived from QObject and thus all classes that implement widgets.
Packit 1c1d7e
  Only values can be used in a QValueList. To qualify as a value, the class
Packit 1c1d7e
  must provide
Packit 1c1d7e
  
    Packit 1c1d7e
      
  • a copy constructor,
  • Packit 1c1d7e
      
  • an assignment operator and
  • Packit 1c1d7e
      
  • a default constructor, i.e. a constructor that does not take any arguments.
  • Packit 1c1d7e
      
    Packit 1c1d7e
    Packit 1c1d7e
      Note that C++ defaults to field-by-field assignment operators and
    Packit 1c1d7e
      copy constructors if no explicit version is supplied. In many cases,
    Packit 1c1d7e
      this is sufficient.
    Packit 1c1d7e
    Packit 1c1d7e
      Example:
    Packit 1c1d7e
      \code
    Packit 1c1d7e
        #include <qvaluelist.h>
    Packit 1c1d7e
        #include <qstring.h>
    Packit 1c1d7e
        #include <stdio.h>
    Packit 1c1d7e
    Packit 1c1d7e
        class Employee
    Packit 1c1d7e
        {
    Packit 1c1d7e
        public:
    Packit 1c1d7e
    	Employee(): s(0) {}
    Packit 1c1d7e
    	Employee( const QString& name, int salary )
    Packit 1c1d7e
    	    : n(name), s(salary)
    Packit 1c1d7e
    	{}
    Packit 1c1d7e
    Packit 1c1d7e
    	QString     name()   const	 	{ return n; }
    Packit 1c1d7e
    	int	    salary() const	 	{ return s; }
    Packit 1c1d7e
    	void	    setSalary( int salary )	{ s = salary; }
    Packit 1c1d7e
        private:
    Packit 1c1d7e
    	QString     n;
    Packit 1c1d7e
    	int         s;
    Packit 1c1d7e
        };
    Packit 1c1d7e
    Packit 1c1d7e
        void main()
    Packit 1c1d7e
        {
    Packit 1c1d7e
    	typedef QValueList<Employee> EmployeeList;
    Packit 1c1d7e
    	EmployeeList list;		// list of Employee
    Packit 1c1d7e
    Packit 1c1d7e
    	list.append( Employee("Bill", 50000) );
    Packit 1c1d7e
    	list.append( Employee("Steve",80000) );
    Packit 1c1d7e
    	list.append( Employee("Ron",  60000) );
    Packit 1c1d7e
    Packit 1c1d7e
    	Employee joe( "Joe", 50000 );
    Packit 1c1d7e
    	list.append( joe );
    Packit 1c1d7e
    	joe.setSalary( 4000 );
    Packit 1c1d7e
    	
    Packit 1c1d7e
    	EmployeeList::Iterator it;
    Packit 1c1d7e
    	for( it = list.begin(); it != list.end(); ++it )
    Packit 1c1d7e
    	    printf( "%s earns %d\n", (*it).name().latin1(), (*it).salary().latin1() );
    Packit 1c1d7e
        }
    Packit 1c1d7e
      \endcode
    Packit 1c1d7e
    Packit 1c1d7e
      Program output:
    Packit 1c1d7e
      \code
    Packit 1c1d7e
    	Bill earns 50000
    Packit 1c1d7e
    	Steve earns 80000
    Packit 1c1d7e
    	Ron earns 60000
    Packit 1c1d7e
    	Joe earns 50000
    Packit 1c1d7e
      \endcode
    Packit 1c1d7e
    Packit 1c1d7e
      As you can see, the latest changes to Joes salary did not affect the value
    Packit 1c1d7e
      in the list because the list created a copy of Joes entry.
    Packit 1c1d7e
    Packit 1c1d7e
      There are three ways of finding items in the list. The first one is by using
    Packit 1c1d7e
      the at() function. It returns an iterator. The advantages of
    Packit 1c1d7e
      getting an iterator is that you can now move forward or backward from this
    Packit 1c1d7e
      position by incrementing/decrementing the iterator. To get the amount of
    Packit 1c1d7e
      items in the list call count(). Valid indices are 0..count().
    Packit 1c1d7e
    Packit 1c1d7e
      The second way of accessing a list is with operator[]. That means you can address
    Packit 1c1d7e
      it like an array. The return value is a reference to the value stored in the list.
    Packit 1c1d7e
      There exist two versions of this operator. The first one is const and returns a
    Packit 1c1d7e
      const reference to the value. The second on is non const and returns a non const
    Packit 1c1d7e
      reference to the value. It is up to your compiler to choose the correct one.
    Packit 1c1d7e
    Packit 1c1d7e
      The third method is to use the functions begin() and end().
    Packit 1c1d7e
      With a simple for loop as shown in the example you can iterate over the complete list.
    Packit 1c1d7e
      It is save to have multiple iterators at the same time. If some member of the list is
    Packit 1c1d7e
      removed then only iterators pointing to the removed member become invalid. Inserting in
    Packit 1c1d7e
      the list does not invalidate any iterator. For convenience the function last() returns
    Packit 1c1d7e
      an iterator for the last and first() for the first element in the list.
    Packit 1c1d7e
    Packit 1c1d7e
      In addition you can search items in the list with the find() function. It exists in a const
    Packit 1c1d7e
      and a non const version. It starts searching from the beginning of the list, but another
    Packit 1c1d7e
      flavor of the find() function allows you to specify where searching should start.
    Packit 1c1d7e
      If you just want to know whether a certain item is at least once in the list, then you
    Packit 1c1d7e
      can use the contains() function.
    Packit 1c1d7e
    Packit 1c1d7e
      Since QValueList is value based there is no need to care about deleting elements in the
    Packit 1c1d7e
      list. The list holds its own copies and will free them if the corresponding member or
    Packit 1c1d7e
      the list itself is deleted. You can force the list to free all of its item with clear().
    Packit 1c1d7e
    Packit 1c1d7e
      QValueList is implicitly shared. That means you can just make copies of the list
    Packit 1c1d7e
      in time O(1). If multiple QValueList instances share the same data and one
    Packit 1c1d7e
      is doing a modification of the lists data then this modifying instance makes a copy
    Packit 1c1d7e
      and modifies its private copy. So it does not affect the other instances.
    Packit 1c1d7e
      From a developers point of view you can think that a QValueList and a copy of this
    Packit 1c1d7e
      list have nothing to do with each other. Developers may only notice that copying is
    Packit 1c1d7e
      very fast. People known to a CPUs MMU architecture will know this pattern as "copy on write".
    Packit 1c1d7e
    Packit 1c1d7e
      There exist three functions to insert items in the list. append()
    Packit 1c1d7e
      inserts an item at the end, prepend() inserts at the beginning
    Packit 1c1d7e
      and insert() inserts in front of the position given by an iterator.
    Packit 1c1d7e
    Packit 1c1d7e
      Items can be removed from the list in two ways. The first is to pass an iterator to
    Packit 1c1d7e
      the remove(). The other possibility is to pass a value to remove() which will
    Packit 1c1d7e
      delete all members which match this value.
    Packit 1c1d7e
    Packit 1c1d7e
      Lists can be sorted with the algorithms provided by the 
    Packit 1c1d7e
      href="qtl.html">Qt Template Library, for example with
    Packit 1c1d7e
      qHeapSort():
    Packit 1c1d7e
    Packit 1c1d7e
      Example:
    Packit 1c1d7e
      \code
    Packit 1c1d7e
    	  QValueList l;
    Packit 1c1d7e
    	  l.append( 5 );
    Packit 1c1d7e
    	  l.append( 8 );
    Packit 1c1d7e
    	  l.append( 3 );
    Packit 1c1d7e
    	  l.append( 4 );
    Packit 1c1d7e
    	  qHeapSort( l );
    Packit 1c1d7e
      \endcode
    Packit 1c1d7e
    Packit 1c1d7e
      \sa QValueListIterator
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueList::QValueList()
    Packit 1c1d7e
      Constructs an empty list.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueList::QValueList( const QValueList<T>& l )
    Packit 1c1d7e
      Constructs a copy of \e l.
    Packit 1c1d7e
    Packit 1c1d7e
      This operation costs O(1) time since QValueList is implicit shared.
    Packit 1c1d7e
      The first instance applying modifications to a shared list will create
    Packit 1c1d7e
      a copy which takes in turn O(n) time. However returning a QValueList from
    Packit 1c1d7e
      a function is very fast.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueList::~QValueList()
    Packit 1c1d7e
      Destroys the list. References to the values in the list and all iterators
    Packit 1c1d7e
      of this list become invalidated. Since QValueList is highly tuned for performance
    Packit 1c1d7e
      you wont see warnings if you use invalid iterators,
    Packit 1c1d7e
      because it is impossible for
    Packit 1c1d7e
      an iterator to check whether it is valid or not.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueList<T>& QValueList::operator= ( const QValueList<T>& l )
    Packit 1c1d7e
      Assigns \e l to this list and returns a reference to this list.
    Packit 1c1d7e
    Packit 1c1d7e
      All iterators of the current list become invalidated by this operation.
    Packit 1c1d7e
      The cost of such an assignment is O(1) since QValueList is implicitly shared.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueList<T> QValueList::operator+ ( const QValueList<T>& l ) const
    Packit 1c1d7e
      Creates a new list and fills it with the elements of this list. Then the
    Packit 1c1d7e
      elements of \e l are appended.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns the new list.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueList<T>& QValueList::operator+= ( const QValueList<T>& l )
    Packit 1c1d7e
      Adds \e list to this list.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns a reference to this list.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn bool QValueList::operator== ( const QValueList<T>& l ) const
    Packit 1c1d7e
      Compares both lists.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns TRUE if both list are equal.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn bool QValueList::operator!= ( const QValueList<T>& l ) const
    Packit 1c1d7e
      Compares both lists.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns TRUE if both list are unequal.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueList<T>& QValueList::operator+= ( const T& x )
    Packit 1c1d7e
      Adds the value \e x to the end of the list.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns a reference to the list.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueList<T>& QValueList::operator<< ( const T& x )
    Packit 1c1d7e
      Adds the value \e x to the end of the list.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns a reference to the list.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn const T& QValueList::operator[] ( uint i ) const
    Packit 1c1d7e
      Returns a const reference to the item with index \e i in the list.
    Packit 1c1d7e
      It is up to you to check whether this item really exists. You can do that easily
    Packit 1c1d7e
      with the count() function. However this operator does not check whether \e i
    Packit 1c1d7e
      is in range and will deliver undefined results if it does not exist.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn T& QValueList::operator[] ( uint i )
    Packit 1c1d7e
      Returns a reference to the item with index \e i in the list.
    Packit 1c1d7e
      It is up to you to check whether this item really exists. You can do that easily
    Packit 1c1d7e
      with the count() function. However this operator does not check whether \e i
    Packit 1c1d7e
      is in range and will deliver undefined results if it does not exist.
    Packit 1c1d7e
      In contrast to the const operator[] you may manipulate the value returned by this
    Packit 1c1d7e
      operator.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn uint QValueList::count() const
    Packit 1c1d7e
      Returns the number of items in the list.
    Packit 1c1d7e
      \sa isEmpty()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn bool QValueList::isEmpty() const
    Packit 1c1d7e
      Returns TRUE if the list is empty, i.e. count() == 0. Returns FALSE
    Packit 1c1d7e
       otherwise.
    Packit 1c1d7e
      \sa count()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::insert( Iterator it, const T& x )
    Packit 1c1d7e
      Inserts the value \e x in front of the iterator \e it.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns an iterator pointing at the inserted item.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa append(), prepend()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::append( const T& x )
    Packit 1c1d7e
      Inserts the value \e x at the end of the list.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns an iterator pointing at the inserted item.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa insert(), prepend()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::prepend( const T& x )
    Packit 1c1d7e
      Inserts the value \e x at the beginning of the list.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns an iterator pointing at the inserted item.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa insert(), append()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::remove( Iterator it )
    Packit 1c1d7e
      Removes the item at position \e it in the list.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns an iterator pointing to the item following the
    Packit 1c1d7e
      removed on or end() if the last item was deleted.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa clear()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn void QValueList::remove( const T& x )
    Packit 1c1d7e
      Removes all items which have the value \e x.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa clear()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn void QValueList::clear()
    Packit 1c1d7e
      Removes all items from the list.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa remove()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::find( const T& x )
    Packit 1c1d7e
      Finds the first occurrence of \e x in the list.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns end() if no item did match.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn ConstIterator QValueList::find( const T& x ) const
    Packit 1c1d7e
      Finds the first occurrence of \e x in the list.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns end() if no item did match.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::find( Iterator it, const T& x )
    Packit 1c1d7e
      Finds the first occurrence of \e x in the list starting at
    Packit 1c1d7e
      the position given by \e it.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns end() if no item did match.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn ConstIterator QValueList::find( ConstIterator it, const T& x ) const
    Packit 1c1d7e
      Finds the first occurrence of \e x in the list starting at
    Packit 1c1d7e
      the position given by \e it.
    Packit 1c1d7e
    Packit 1c1d7e
      Returns end() if no item did match.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn uint QValueList::contains( const T& x ) const
    Packit 1c1d7e
      Counts and returns the number of occurrences of the value \e x in the list.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn int QValueList::findIndex( const T& x ) const
    Packit 1c1d7e
      Returns the first index of the value \e x in the list or -1 if no such value
    Packit 1c1d7e
      can be found in the list.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::at( uint i )
    Packit 1c1d7e
      Returns an iterator pointing to the item at position \e i in the list, or
    Packit 1c1d7e
      end() if the index is out of range.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn ConstIterator QValueList::at( uint i ) const
    Packit 1c1d7e
      Returns an iterator pointing to the item at position \e i in the list, or
    Packit 1c1d7e
      end() if the index is out of range.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn T& QValueList::first()
    Packit 1c1d7e
      Returns a reference to the first item in the list or the item
    Packit 1c1d7e
      referenced by end()
    Packit 1c1d7e
      if no such items exists. Please note that you may not change
    Packit 1c1d7e
      the value the end() Iterator is pointing to.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa begin(), last()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn const T& QValueList::first() const
    Packit 1c1d7e
      Returns a reference to the first item in the list or the item
    Packit 1c1d7e
      referenced by end() if
    Packit 1c1d7e
      no such items exists.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa begin(), last()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::fromLast()
    Packit 1c1d7e
      Returns an iterator pointing to the last element in the list or
    Packit 1c1d7e
      end() if no such item exists.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa last()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn ConstIterator QValueList::fromLast() const
    Packit 1c1d7e
      Returns an iterator pointing to the last element in the list or
    Packit 1c1d7e
      end() if no such item exists.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa last()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn T& QValueList::last()
    Packit 1c1d7e
      Returns a reference to the last item in the list or the item
    Packit 1c1d7e
      referenced by end() if no
    Packit 1c1d7e
      such item exists. Please note that you may not change
    Packit 1c1d7e
      the value the end() Iterator is pointing to.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa end(), first(), fromLast()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn const T& QValueList::last() const
    Packit 1c1d7e
      Returns a reference to the last item in the list or the item
    Packit 1c1d7e
      referenced by end() if no such item exists.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa end(), first(), fromLast()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::begin()
    Packit 1c1d7e
      Returns an iterator pointing to the first element in the list. This
    Packit 1c1d7e
      iterator equals end() if the list is empty;
    Packit 1c1d7e
      \sa first(), end()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn ConstIterator QValueList::begin() const
    Packit 1c1d7e
      Returns an iterator pointing to the first element in the list. This
    Packit 1c1d7e
      iterator equals end() if the list is empty;
    Packit 1c1d7e
      \sa first(), end()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn Iterator QValueList::end()
    Packit 1c1d7e
      Returns an iterator pointing behind the last element in the list. This
    Packit 1c1d7e
      iterator equals begin() if the list is empty.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa last(), begin()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn ConstIterator QValueList::end() const
    Packit 1c1d7e
      Returns an iterator pointing behind the last element in the list. This
    Packit 1c1d7e
      iterator equals begin() if the list is empty.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa last(), begin()
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn void QValueList::detach()
    Packit 1c1d7e
      If the list does not share its data with another QValueList instance, then nothing
    Packit 1c1d7e
      happens, otherwise the function creates a new copy of this data and detaches
    Packit 1c1d7e
      from the shared one. This function is called whenever the list is modified.
    Packit 1c1d7e
      The implicit sharing mechanism is implemented this way.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QDataStream& operator>>( QDataStream& s, QValueList<T>& l )
    Packit 1c1d7e
      \relates QValueList
    Packit 1c1d7e
      Reads a list from the stream. The type \e T stored in the list must implement
    Packit 1c1d7e
      the streaming operator, too.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QDataStream& operator<<( QDataStream& s, const QValueList<T>& l )
    Packit 1c1d7e
      \relates QValueList
    Packit 1c1d7e
      Writes a list to the stream. The type \e T stored in the list must implement
    Packit 1c1d7e
      the streaming operator, too.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*****************************************************************************
    Packit 1c1d7e
      QValueListIterator documentation
    Packit 1c1d7e
     *****************************************************************************/
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \class QValueListIterator qvaluelist.h
    Packit 1c1d7e
      \brief The QValueListIterator class provides an iterator for QValueList.
    Packit 1c1d7e
    Packit 1c1d7e
      \ingroup qtl
    Packit 1c1d7e
      \ingroup tools
    Packit 1c1d7e
    Packit 1c1d7e
      You can not create an iterator by yourself. Instead you have to
    Packit 1c1d7e
      ask a list to give you one. An iterator has only the size of a pointer.
    Packit 1c1d7e
      On 32 bit machines that means 4 bytes otherwise 8 bytes. That makes them
    Packit 1c1d7e
      very fast. In fact they resemble the semantics of pointers as good as possible
    Packit 1c1d7e
      and they are almost as fast as usual pointers.
    Packit 1c1d7e
    Packit 1c1d7e
      Example:
    Packit 1c1d7e
      \code
    Packit 1c1d7e
        #include <qvaluelist.h>
    Packit 1c1d7e
        #include <qstring.h>
    Packit 1c1d7e
        #include <stdio.h>
    Packit 1c1d7e
    Packit 1c1d7e
        class Employee
    Packit 1c1d7e
        {
    Packit 1c1d7e
        public:
    Packit 1c1d7e
    	Employee(): s(0) {}
    Packit 1c1d7e
    	Employee( const QString& name, int salary )
    Packit 1c1d7e
    	    : n(name), s(salary)
    Packit 1c1d7e
    	{}
    Packit 1c1d7e
    Packit 1c1d7e
    	QString     name()   const		{ return n; }
    Packit 1c1d7e
    	int	    salary() const		{ return s; }
    Packit 1c1d7e
    	void	    setSalary( int salary )	{ s = salary; }
    Packit 1c1d7e
        private:
    Packit 1c1d7e
    	QString     n;
    Packit 1c1d7e
    	int         s;
    Packit 1c1d7e
        };
    Packit 1c1d7e
    Packit 1c1d7e
        void main()
    Packit 1c1d7e
    	{
    Packit 1c1d7e
    	    typedef QValueList<Employee> EmployeeList;
    Packit 1c1d7e
    	    EmployeeList list;		// list of Employee
    Packit 1c1d7e
    Packit 1c1d7e
    	    list.append( Employee("Bill", 50000) );
    Packit 1c1d7e
    	    list.append( Employee("Steve",80000) );
    Packit 1c1d7e
    	    list.append( Employee("Ron",  60000) );
    Packit 1c1d7e
    Packit 1c1d7e
    	    Employee joe( "Joe", 50000 );
    Packit 1c1d7e
    	    list.append( joe );
    Packit 1c1d7e
    	    joe.setSalary( 4000 );
    Packit 1c1d7e
    	
    Packit 1c1d7e
    	    EmployeeList::Iterator it;
    Packit 1c1d7e
    	    for( it = list.begin(); it != list.end(); ++it )
    Packit 1c1d7e
    		printf( "%s earns %d\n", (*it).name().latin1(), (*it).salary() );
    Packit 1c1d7e
    	}
    Packit 1c1d7e
      \endcode
    Packit 1c1d7e
    Packit 1c1d7e
      Program output:
    Packit 1c1d7e
      \code
    Packit 1c1d7e
    	Bill earns 50000
    Packit 1c1d7e
    	Steve earns 80000
    Packit 1c1d7e
    	Ron earns 60000
    Packit 1c1d7e
    	Joe earns 50000
    Packit 1c1d7e
      \endcode
    Packit 1c1d7e
    Packit 1c1d7e
      In contrast to QList there are no built in functions in QValueList to
    Packit 1c1d7e
      traverse the list. The only way to do this is to use iterators.
    Packit 1c1d7e
      QValueList is highly optimized for performance and memory usage.
    Packit 1c1d7e
      On the other hand that means that you have to be a bit more careful
    Packit 1c1d7e
      by what you are doing. QValueList does not know about all its iterators
    Packit 1c1d7e
      and the iterators don't even know to which list they belong. That makes
    Packit 1c1d7e
      things fast and slim but a bit dangerous because it is up to you to make
    Packit 1c1d7e
      sure that iterators you are using are still valid. QListIterator will be able
    Packit 1c1d7e
      to give warnings while QValueListIterator may end up in an undefined state.
    Packit 1c1d7e
    Packit 1c1d7e
      For every Iterator there is a ConstIterator. When accessing a QValueList
    Packit 1c1d7e
      in a const environment or if the reference or pointer to the list is itself
    Packit 1c1d7e
      const, then you have to use the ConstIterator. Its semantics are the same,
    Packit 1c1d7e
      but it returns only const references to the item it points to.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa QValueList, QValueListConstIterator
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListIterator::QValueListIterator()
    Packit 1c1d7e
      Creates un uninitialized iterator.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListIterator::QValueListIterator( NodePtr p )
    Packit 1c1d7e
      Internal function.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListIterator::QValueListIterator( const QValueListIterator<T>& it )
    Packit 1c1d7e
      Constructs a copy of the iterator \e it.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListIterator::~QValueListIterator()
    Packit 1c1d7e
      Destroys the iterator.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /* Unfortunately not with MSVC
    Packit 1c1d7e
      \fn T *QValueListIterator::operator->()
    Packit 1c1d7e
      Pointer operator. Returns a pointer to the current iterator item.
    Packit 1c1d7e
      The great advantage of this operator is that you can treat the
    Packit 1c1d7e
      iterator like a pointer.
    Packit 1c1d7e
    Packit 1c1d7e
      Example:
    Packit 1c1d7e
      \code
    Packit 1c1d7e
    	QValueList<int>::Iterator it = list.begin();
    Packit 1c1d7e
    	for( ; it != end(); ++it )
    Packit 1c1d7e
    		it->show();
    Packit 1c1d7e
      \endcode
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn T& QValueListIterator::operator*()
    Packit 1c1d7e
      Asterix operator. Returns a reference to the current iterator item.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn const T& QValueListIterator::operator*() const
    Packit 1c1d7e
      Asterix operator. Returns a reference to the current iterator item.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListIterator<T>& QValueListIterator::operator++()
    Packit 1c1d7e
      Prefix ++ makes the succeeding item current and returns
    Packit 1c1d7e
      an iterator pointing to the new current item.
    Packit 1c1d7e
      The iterator can not check whether it reached the end of the list. Incrementing
    Packit 1c1d7e
      the iterator as returned by end() causes undefined results.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListIterator<T> QValueListIterator::operator++(int)
    Packit 1c1d7e
      Postfix ++ makes the succeeding item current and returns
    Packit 1c1d7e
      an iterator pointing to the new current item.
    Packit 1c1d7e
      The iterator can not check whether it reached the end of the list. Incrementing
    Packit 1c1d7e
      the iterator as returned by end() causes undefined results.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListIterator<T>& QValueListIterator::operator--()
    Packit 1c1d7e
      Prefix -- makes the previous item current and returns
    Packit 1c1d7e
      an iterator pointing to the new current item.
    Packit 1c1d7e
      The iterator can not check whether it reached the beginning of the list. Decrementing
    Packit 1c1d7e
      the iterator as returned by begin() causes undefined results.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListIterator<T> QValueListIterator::operator--(int)
    Packit 1c1d7e
      Postfix -- makes the previous item current and returns
    Packit 1c1d7e
      an iterator pointing to the new current item.
    Packit 1c1d7e
      The iterator can not check whether it reached the beginning of the list. Decrementing
    Packit 1c1d7e
      the iterator as returned by begin() causes undefined results.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn bool QValueListIterator::operator==( const QValueListIterator<T>& it ) const
    Packit 1c1d7e
      Compares both iterators and returns TRUE if they point to the same item.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn bool QValueListIterator::operator!=( const QValueListIterator<T>& it ) const
    Packit 1c1d7e
      Compares both iterators and returns TRUE if they point to different items.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*****************************************************************************
    Packit 1c1d7e
      QValueListConstIterator documentation
    Packit 1c1d7e
     *****************************************************************************/
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \class QValueListConstIterator qvaluelist.h
    Packit 1c1d7e
      \brief The QValueListConstIterator class provides an iterator for QValueList.
    Packit 1c1d7e
    Packit 1c1d7e
      \ingroup qtl
    Packit 1c1d7e
      \ingroup tools
    Packit 1c1d7e
    Packit 1c1d7e
      In contrast to QValueListIterator this class is used to iterate over a const
    Packit 1c1d7e
      list. It does not allow to modify the values of the list since this would
    Packit 1c1d7e
      break the const semantics.
    Packit 1c1d7e
    Packit 1c1d7e
      For more information on QValueList iterators see QValueListIterator.
    Packit 1c1d7e
    Packit 1c1d7e
      \sa QValueListIterator, QValueList
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator::QValueListConstIterator()
    Packit 1c1d7e
      Creates un uninitialized iterator.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator::QValueListConstIterator( NodePtr p )
    Packit 1c1d7e
      Internal function.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator::QValueListConstIterator( const QValueListConstIterator<T>& it )
    Packit 1c1d7e
      Constructs a copy of the iterator \e it.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator::QValueListConstIterator( const QValueListIterator<T>& it )
    Packit 1c1d7e
      Constructs a copy of the iterator \e it.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator::~QValueListConstIterator()
    Packit 1c1d7e
      Destroys the iterator.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /* Unfortunately not with MSVC
    Packit 1c1d7e
      \fn const T *QValueListConstIterator::operator->()
    Packit 1c1d7e
      Pointer operator. Returns a pointer to the current iterator item.
    Packit 1c1d7e
      The great advantage of this operator is that you can treat the
    Packit 1c1d7e
      iterator like a pointer.
    Packit 1c1d7e
    Packit 1c1d7e
      Example:
    Packit 1c1d7e
      \code
    Packit 1c1d7e
    	QValueList<int>::Iterator it = list.begin();
    Packit 1c1d7e
    	for( ; it != end(); ++it )
    Packit 1c1d7e
    		it->show();
    Packit 1c1d7e
      \endcode
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn const T& QValueListConstIterator::operator*() const
    Packit 1c1d7e
      Asterix operator. Returns a reference to the current iterator item.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator<T>& QValueListConstIterator::operator++()
    Packit 1c1d7e
      Prefix ++ makes the succeeding item current and returns
    Packit 1c1d7e
      an iterator pointing to the new current item.
    Packit 1c1d7e
      The iterator can not check whether it reached the end of the list. Incrementing
    Packit 1c1d7e
      the iterator as returned by end() causes undefined results.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator<T> QValueListConstIterator::operator++(int)
    Packit 1c1d7e
      Postfix ++ makes the succeeding item current and returns
    Packit 1c1d7e
      an iterator pointing to the new current item.
    Packit 1c1d7e
      The iterator can not check whether it reached the end of the list. Incrementing
    Packit 1c1d7e
      the iterator as returned by end() causes undefined results.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator<T>& QValueListConstIterator::operator--()
    Packit 1c1d7e
      Prefix -- makes the previous item current and returns
    Packit 1c1d7e
      an iterator pointing to the new current item.
    Packit 1c1d7e
      The iterator can not check whether it reached the beginning of the list. Decrementing
    Packit 1c1d7e
      the iterator as returned by begin() causes undefined results.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn QValueListConstIterator<T> QValueListConstIterator::operator--(int)
    Packit 1c1d7e
      Postfix -- makes the previous item current and returns
    Packit 1c1d7e
      an iterator pointing to the new current item.
    Packit 1c1d7e
      The iterator can not check whether it reached the beginning of the list. Decrementing
    Packit 1c1d7e
      the iterator as returned by begin() causes undefined results.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn bool QValueListConstIterator::operator==( const QValueListConstIterator<T>& it ) const
    Packit 1c1d7e
      Compares both iterators and returns TRUE if they point to the same item.
    Packit 1c1d7e
    */
    Packit 1c1d7e
    Packit 1c1d7e
    /*!
    Packit 1c1d7e
      \fn bool QValueListConstIterator::operator!=( const QValueListConstIterator<T>& it ) const
    Packit 1c1d7e
      Compares both iterators and returns TRUE if they point to different items.
    Packit 1c1d7e
    */