Blame qtools/qvaluelist.doc

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