Blame qtools/qlist.doc

Packit Service 50c9f2
/****************************************************************************
Packit Service 50c9f2
** 
Packit Service 50c9f2
**
Packit Service 50c9f2
** QList and QListIterator 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
  QList documentation
Packit Service 50c9f2
 *****************************************************************************/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \class QList qlist.h
Packit Service 50c9f2
  \brief The QList class is a template class that provides doubly linked lists.
Packit Service 50c9f2
Packit Service 50c9f2
  \ingroup collection
Packit Service 50c9f2
  \ingroup tools
Packit Service 50c9f2
Packit Service 50c9f2
  In Qt 2.0 QList is only implemented as a template class. Define a
Packit Service 50c9f2
  template instance QList\<X\> to create a list that operates on pointers
Packit Service 50c9f2
  to X, or X*.
Packit Service 50c9f2
Packit Service 50c9f2
  Example:
Packit Service 50c9f2
  \code
Packit Service 50c9f2
    #include <qlist.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( const QString& name, int salary ) { n=name; s=salary; }
Packit Service 50c9f2
        QString     name()   const		 { return n; }
Packit Service 50c9f2
        int	    salary() const		 { return s; }
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
	QList<Employee> list;		// list of pointers to Employee
Packit Service 50c9f2
	list.setAutoDelete( TRUE );	// delete items when they are removed
Packit Service 50c9f2
Packit Service 50c9f2
	list.append( new Employee("Bill", 50000) );
Packit Service 50c9f2
	list.append( new Employee("Steve",80000) );
Packit Service 50c9f2
	list.append( new Employee("Ron",  60000) );
Packit Service 50c9f2
Packit Service 50c9f2
	Employee *emp;
Packit Service 50c9f2
	for ( emp=list.first(); emp != 0; emp=list.next() )
Packit Service 50c9f2
	    printf( "%s earns %d\n", emp->name().latin1(), emp->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
  \endcode
Packit Service 50c9f2
Packit Service 50c9f2
  The list class is indexable and has a \link at() current index\endlink
Packit Service 50c9f2
  and a \link current() current item\endlink.  The first item corresponds
Packit Service 50c9f2
  to index 0.  The current index is -1 if the current item is null.
Packit Service 50c9f2
Packit Service 50c9f2
  QList has several member functions for traversing the list, but using
Packit Service 50c9f2
  a QListIterator can be more practical. Multiple list iterators may
Packit Service 50c9f2
  traverse the same list, independent of each other and independent of
Packit Service 50c9f2
  the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  In the example above, we make the call setAutoDelete(TRUE).
Packit Service 50c9f2
  Enabling auto-deletion tells the list to delete items that are removed
Packit Service 50c9f2
  from the list.  The default is to not delete items when they are
Packit Service 50c9f2
  removed, but that would cause a memory leak in our example since we have
Packit Service 50c9f2
  no other references to the list items.
Packit Service 50c9f2
Packit Service 50c9f2
  List items are stored as \c void* in an internal QLNode, which also
Packit Service 50c9f2
  holds pointers to the next and previous list items.  The functions
Packit Service 50c9f2
  currentNode(), removeNode() and takeNode() operate directly on the
Packit Service 50c9f2
  QLNode, but they should be used with care.
Packit Service 50c9f2
Packit Service 50c9f2
  When inserting an item into a list, only the pointer is copied, not the
Packit Service 50c9f2
  item itself. This is called a shallow copy. It is possible to make the
Packit Service 50c9f2
  list copy all of the item's data (known as a deep copy) when an item is
Packit Service 50c9f2
  inserted.  insert(), inSort() and append() call the virtual function
Packit Service 50c9f2
  QCollection::newItem() for the item to be inserted.
Packit Service 50c9f2
  Inherit a list and reimplement it if you want deep copies.
Packit Service 50c9f2
Packit Service 50c9f2
  When removing an item from a list, the virtual function
Packit Service 50c9f2
  QCollection::deleteItem() is called.  QList's default implementation
Packit Service 50c9f2
  is to delete the item if auto-deletion is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  The virtual function QGList::compareItems() can be reimplemented to
Packit Service 50c9f2
  compare two list items. This function is called from all list functions
Packit Service 50c9f2
  that need to compare list items, for instance remove(const type*).
Packit Service 50c9f2
  If you only want to deal with pointers, there are functions that
Packit Service 50c9f2
  compare pointers instead, for instance removeRef(const type*).
Packit Service 50c9f2
  These functions are somewhat faster than those that call compareItems().
Packit Service 50c9f2
Packit Service 50c9f2
  The QStrList class in qstrlist.h is a list of \c char*.  QStrList is
Packit Service 50c9f2
  a good example of a list that reimplements newItem(), deleteItem() and
Packit Service 50c9f2
  compareItems()
Packit Service 50c9f2
Packit Service 50c9f2
  \sa QListIterator, \link collection.html Collection Classes\endlink
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QList::QList()
Packit Service 50c9f2
  Constructs an empty list.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QList::QList( const QList<type> &list )
Packit Service 50c9f2
  Constructs a copy of \e list.
Packit Service 50c9f2
Packit Service 50c9f2
  Each item in \e list is \link append() appended\endlink to this list.
Packit Service 50c9f2
  Only the pointers are copied (shallow copy).
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QList::~QList()
Packit Service 50c9f2
  Removes all items from the list and destroys the list.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that access this list will be reset.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa setAutoDelete()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QList<type> &QList::operator=(const QList<type> &list)
Packit Service 50c9f2
  Assigns \e list to this list and returns a reference to this list.
Packit Service 50c9f2
Packit Service 50c9f2
  This list is first cleared, then each item in \e list is
Packit Service 50c9f2
  \link append() appended\endlink to this list.  Only the pointers are copied
Packit Service 50c9f2
  (shallow copy), unless newItem() has been reimplemented().
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QList::operator==(const QList<type> &list ) const
Packit Service 50c9f2
Packit Service 50c9f2
  Compares this list with \a list. Retruns TRUE if the lists
Packit Service 50c9f2
  contain the same data, else FALSE.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn uint QList::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 void QList::sort()
Packit Service 50c9f2
Packit Service 50c9f2
  Sorts the list by the result of the virtual compareItems() function.
Packit Service 50c9f2
Packit Service 50c9f2
  The Heap-Sort algorithm is used for sorting.  It sorts n items with
Packit Service 50c9f2
  O(n*log n) compares.  This is the asymptotic optimal solution of the
Packit Service 50c9f2
  sorting problem.
Packit Service 50c9f2
Packit Service 50c9f2
  If the items in your list support operator< and operator== then you
Packit Service 50c9f2
  might be better off with QSortedList since it implements the
Packit Service 50c9f2
  compareItems() function for you using these two operators.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa inSort()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QList::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 bool QList::insert( uint index, const type *item )
Packit Service 50c9f2
  Inserts the \e item at the position \e index in the list.
Packit Service 50c9f2
Packit Service 50c9f2
  Returns TRUE if successful, or FALSE if \e index is out of range.
Packit Service 50c9f2
  The valid range is 0 .. count() inclusive.
Packit Service 50c9f2
  The item is appended if \e index == count().
Packit Service 50c9f2
Packit Service 50c9f2
  The inserted item becomes the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  The \e item must not be a null pointer.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa append(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn void QList::inSort( const type *item )
Packit Service 50c9f2
  Inserts the \e item at its sorted position in the list.
Packit Service 50c9f2
Packit Service 50c9f2
  The sort order depends on the virtual QGList::compareItems() function.
Packit Service 50c9f2
  All items must be inserted with inSort() to maintain the sorting order.
Packit Service 50c9f2
Packit Service 50c9f2
  The inserted item becomes the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  The \e item must not be a null pointer.
Packit Service 50c9f2
Packit Service 50c9f2
  Please note that inSort is slow. If you want to insert lots of items
Packit Service 50c9f2
  in a list and sort after inserting then you should use sort().
Packit Service 50c9f2
  inSort() takes up to O(n) compares. That means inserting n items in
Packit Service 50c9f2
  your list will need O(n^2) compares while sort() only needs O(n*logn)
Packit Service 50c9f2
  for the same task. So you inSort() only if you already have a pre-sorted
Packit Service 50c9f2
  list and want to insert only few additional items.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa insert(), QGList::compareItems(), current(), sort()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn void QList::append( const type *item )
Packit Service 50c9f2
  Inserts the \e item at the end of the list.
Packit Service 50c9f2
Packit Service 50c9f2
  The inserted item becomes the current list item.
Packit Service 50c9f2
  This is equivalent to \c insert(count(),item).
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
  The \e item must not be a null pointer.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa insert(), current(), prepend()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn void QList::prepend( const type *item )
Packit Service 50c9f2
Packit Service 50c9f2
  Inserts the \e item at the start of the list.
Packit Service 50c9f2
Packit Service 50c9f2
  The inserted item becomes the current list item.
Packit Service 50c9f2
  This is equivalent to \c insert(0,item).
Packit Service 50c9f2
Packit Service 50c9f2
  The \e item must not be a null pointer.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa append(), insert(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QList::remove( uint index )
Packit Service 50c9f2
  Removes the item at position \e index in the list.
Packit Service 50c9f2
Packit Service 50c9f2
  Returns TRUE if successful, or FALSE if \e index is out of range.
Packit Service 50c9f2
  The valid range is 0 .. (count() - 1) inclusive.
Packit Service 50c9f2
Packit Service 50c9f2
  The removed item is deleted if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  The item after the removed item becomes the new current list item if
Packit Service 50c9f2
  the removed item is not the last item in the list.  If the last item
Packit Service 50c9f2
  is removed, the new last item becomes the current item in Qt 2.x.
Packit Service 50c9f2
  In 3.0, the current item will be set to null.  The current item is
Packit Service 50c9f2
  set to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the removed item will be set to point
Packit Service 50c9f2
  to the new current item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa take(), clear(), setAutoDelete(), current() removeRef()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QList::remove()
Packit Service 50c9f2
  Removes the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  Returns TRUE if successful, or FALSE if the current item is null.
Packit Service 50c9f2
Packit Service 50c9f2
  The removed item is deleted if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  The item after the removed item becomes the new current list item if
Packit Service 50c9f2
  the removed item is not the last item in the list.  If the last item
Packit Service 50c9f2
  is removed, the new last item becomes the current item in Qt 2.x.
Packit Service 50c9f2
  In 3.0, the current item will be set to null.  The current item is
Packit Service 50c9f2
  set to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the removed item will be set to point
Packit Service 50c9f2
  to the new current item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa take(), clear(), setAutoDelete(), current() removeRef()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QList::remove( const type *item )
Packit Service 50c9f2
  Removes the first occurrence of \e item from the list.
Packit Service 50c9f2
Packit Service 50c9f2
  Returns TRUE if successful, or FALSE if the item could not be found in the
Packit Service 50c9f2
  list.
Packit Service 50c9f2
Packit Service 50c9f2
  The removed item is deleted if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  The compareItems() function is called when searching for the item
Packit Service 50c9f2
  in the list. If compareItems() is not reimplemented, it is more
Packit Service 50c9f2
  efficient to call removeRef().
Packit Service 50c9f2
Packit Service 50c9f2
  The item after the removed item becomes the new current list item if
Packit Service 50c9f2
  the removed item is not the last item in the list.  If the last item
Packit Service 50c9f2
  is removed, the new last item becomes the current item in Qt 2.x.
Packit Service 50c9f2
  In 3.0, the current item will be set to null.  The current item is
Packit Service 50c9f2
  set to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the removed item will be set to point
Packit Service 50c9f2
  to the new current item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa removeRef(), take(), clear(), setAutoDelete(), compareItems(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QList::removeRef( const type *item )
Packit Service 50c9f2
  Removes the first occurrence of \e item from the list.
Packit Service 50c9f2
Packit Service 50c9f2
  Returns TRUE if successful, or FALSE if the item cannot be found in the
Packit Service 50c9f2
  list.
Packit Service 50c9f2
Packit Service 50c9f2
  The removed item is deleted if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  The list is scanned until the pointer \e item is found.  It is removed
Packit Service 50c9f2
  if it is found.
Packit Service 50c9f2
Packit Service 50c9f2
  Equivalent to:
Packit Service 50c9f2
  \code
Packit Service 50c9f2
    if ( list.findRef(item) != -1 )
Packit Service 50c9f2
	list.remove();
Packit Service 50c9f2
  \endcode
Packit Service 50c9f2
Packit Service 50c9f2
  The item after the removed item becomes the new current list item if
Packit Service 50c9f2
  the removed item is not the last item in the list.  If the last item
Packit Service 50c9f2
  is removed, the new last item becomes the current item in Qt 2.x.
Packit Service 50c9f2
  In 3.0, the current item will be set to null.  The current item is
Packit Service 50c9f2
  set to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the removed item will be set to point
Packit Service 50c9f2
  to the new current item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa remove(), clear(), setAutoDelete(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn void QList::removeNode( QLNode *node )
Packit Service 50c9f2
  Removes the \e node from the list.
Packit Service 50c9f2
Packit Service 50c9f2
  This node must exist in the list, otherwise the program may crash.
Packit Service 50c9f2
Packit Service 50c9f2
  The removed item is deleted if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  The first item in the list will become the new current list item.
Packit Service 50c9f2
  The current item is set to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the removed item will be set to point to
Packit Service 50c9f2
  the item succeeding this item, or the preceding item if the removed item
Packit Service 50c9f2
  was the last item.
Packit Service 50c9f2
Packit Service 50c9f2
  \warning Do not call this function unless you are an expert.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa takeNode(), currentNode() remove() removeRef()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QList::removeFirst()
Packit Service 50c9f2
  Removes the first item from the list.
Packit Service 50c9f2
  Returns TRUE if successful, or FALSE if the list is empty.
Packit Service 50c9f2
Packit Service 50c9f2
  The removed item is deleted if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  The first item in the list becomes the new current list item.
Packit Service 50c9f2
  The current item is set to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the removed item will be set to point
Packit Service 50c9f2
  to the new current item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa removeLast(), setAutoDelete(), current() remove()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QList::removeLast()
Packit Service 50c9f2
  Removes the last item from the list.
Packit Service 50c9f2
  Returns TRUE if successful, or FALSE if the list is empty.
Packit Service 50c9f2
Packit Service 50c9f2
  The removed item is deleted if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  The last item in the list becomes the new current list item.
Packit Service 50c9f2
  The current item is set to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the removed item will be set to point
Packit Service 50c9f2
  to the new current item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa removeFirst(), setAutoDelete(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::take( uint index )
Packit Service 50c9f2
  Takes the item at position \e index out of the list without
Packit Service 50c9f2
  deleting it (even if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled).
Packit Service 50c9f2
Packit Service 50c9f2
  Returns a pointer to the item taken out of the list, or null if
Packit Service 50c9f2
  the index is out of range.
Packit Service 50c9f2
  The valid range is 0 .. (count() - 1) inclusive.
Packit Service 50c9f2
Packit Service 50c9f2
  The item after the taken item becomes the new current list item if
Packit Service 50c9f2
  the taken item is not the last item in the list.  If the last item
Packit Service 50c9f2
  is taken, the new last item becomes the current item in Qt 2.x.  In
Packit Service 50c9f2
  3.0, the current item will be set to null.  The current item is set
Packit Service 50c9f2
  to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the taken item will be set to point to
Packit Service 50c9f2
  the new current item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa remove(), clear(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::take()
Packit Service 50c9f2
  Takes the current item out of the list without deleting it (even if
Packit Service 50c9f2
  \link QCollection::setAutoDelete() auto-deletion\endlink is enabled).
Packit Service 50c9f2
  Returns a pointer to the item taken out of the list, or null if
Packit Service 50c9f2
  the current item is null.
Packit Service 50c9f2
Packit Service 50c9f2
  The item after the taken item becomes the new current list item if
Packit Service 50c9f2
  the taken item is not the last item in the list.  If the last item
Packit Service 50c9f2
  is taken, the new last item becomes the current item in Qt 2.x.  In
Packit Service 50c9f2
  3.0, the current item will be set to null.  The current item is set
Packit Service 50c9f2
  to null if the list becomes empty.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the taken item will be set to point to
Packit Service 50c9f2
  the new current item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa remove(), clear(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::takeNode( QLNode *node )
Packit Service 50c9f2
  Takes the \e node out of the list without deleting its item (even if
Packit Service 50c9f2
  \link QCollection::setAutoDelete() auto-deletion\endlink is enabled).
Packit Service 50c9f2
  Returns a pointer to the item taken out of the list.
Packit Service 50c9f2
Packit Service 50c9f2
  This node must exist in the list, otherwise the program may crash.
Packit Service 50c9f2
Packit Service 50c9f2
  The first item in the list becomes the new current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that refer to the taken item will be set to point to
Packit Service 50c9f2
  the item succeeding this item, or the preceding item if the taken item
Packit Service 50c9f2
  was the last item.
Packit Service 50c9f2
Packit Service 50c9f2
  \warning Do not call this function unless you are an expert.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa removeNode(), currentNode()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn void QList::clear()
Packit Service 50c9f2
  Removes all items from the list.
Packit Service 50c9f2
Packit Service 50c9f2
  The removed items are deleted if \link QCollection::setAutoDelete()
Packit Service 50c9f2
  auto-deletion\endlink is enabled.
Packit Service 50c9f2
Packit Service 50c9f2
  All list iterators that access this list will be reset.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa remove(), take(), setAutoDelete()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn int QList::find( const type *item )
Packit Service 50c9f2
  Finds the first occurrence of \e item in the list.
Packit Service 50c9f2
Packit Service 50c9f2
  If the item is found, the list sets the current item to point to
Packit Service 50c9f2
  the found item and returns the index of this item.
Packit Service 50c9f2
  If the item is not found, the list sets the current item to null,
Packit Service 50c9f2
  the current index to -1 and returns -1.
Packit Service 50c9f2
Packit Service 50c9f2
  The compareItems() function is called when searching for the item
Packit Service 50c9f2
  in the list. If compareItems() is not reimplemented, it is more
Packit Service 50c9f2
  efficient to call findRef().
Packit Service 50c9f2
Packit Service 50c9f2
  \sa findNext(), findRef(), compareItems(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn int QList::findNext( const type *item )
Packit Service 50c9f2
  Finds the next occurrence of \e item in the list, starting from
Packit Service 50c9f2
  the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  If the item is found, the list sets the current item to point to
Packit Service 50c9f2
  the found item and returns the index of this item.
Packit Service 50c9f2
  If the item is not found, the list sets the current item to null,
Packit Service 50c9f2
  the current index to -1 and returns -1.
Packit Service 50c9f2
Packit Service 50c9f2
  The compareItems() function is called when searching for the item
Packit Service 50c9f2
  in the list. If compareItems() is not reimplemented, it is more
Packit Service 50c9f2
  efficient to call findNextRef().
Packit Service 50c9f2
Packit Service 50c9f2
  \sa find(), findNextRef(), compareItems(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn int QList::findRef( const type *item )
Packit Service 50c9f2
  Finds the first occurrence of \e item in the list.
Packit Service 50c9f2
Packit Service 50c9f2
  If the item is found, the list sets the current item to point to
Packit Service 50c9f2
  the found item and returns the index of this item.
Packit Service 50c9f2
  If the item is not found, the list sets the current item to null,
Packit Service 50c9f2
  the current index to -1 and returns -1.
Packit Service 50c9f2
Packit Service 50c9f2
  Calling this function is must faster than find(), because find()
Packit Service 50c9f2
  compares \e item with each list item using compareItems().
Packit Service 50c9f2
  This function only compares the pointers.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa findNextRef(), find(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn int QList::findNextRef( const type *item )
Packit Service 50c9f2
  Finds the next occurrence of \e item in the list, starting from the
Packit Service 50c9f2
  current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  If the item is found, the list sets the current item to point to
Packit Service 50c9f2
  the found item and returns the index of this item.
Packit Service 50c9f2
  If the item is not found, the list sets the current item to null,
Packit Service 50c9f2
  the current index to -1 and returns -1.
Packit Service 50c9f2
Packit Service 50c9f2
  Calling this function is must faster than findNext(), because findNext()
Packit Service 50c9f2
  compares \e item with each list item using compareItems().
Packit Service 50c9f2
  This function only compares the pointers.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa findRef(), findNext(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn uint QList::contains( const type *item ) const
Packit Service 50c9f2
  Counts and returns the number of occurrences of \e item in the list.
Packit Service 50c9f2
Packit Service 50c9f2
  The compareItems() function is called when looking for the \e item
Packit Service 50c9f2
  in the list. If compareItems() is not reimplemented, it is more
Packit Service 50c9f2
  efficient to call containsRef().
Packit Service 50c9f2
Packit Service 50c9f2
  Does not affect the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa containsRef(), compareItems()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn uint QList::containsRef( const type *item ) const
Packit Service 50c9f2
  Counts and returns the number of occurrences of \e item in the list.
Packit Service 50c9f2
Packit Service 50c9f2
  Calling this function is must faster than contains(), because contains()
Packit Service 50c9f2
  compares \e item with each list item using compareItems().
Packit Service 50c9f2
  This function only compares the pointers.
Packit Service 50c9f2
Packit Service 50c9f2
  Does not affect the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa contains()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::at( uint index )
Packit Service 50c9f2
  Returns a pointer to the item at position \e index in the list, or
Packit Service 50c9f2
  null if the index is out of range.
Packit Service 50c9f2
Packit Service 50c9f2
  Sets the current list item to this item if \e index is valid.
Packit Service 50c9f2
  The valid range is 0 .. (count() - 1) inclusive.
Packit Service 50c9f2
Packit Service 50c9f2
  This function is very efficient.  It starts scanning from the first
Packit Service 50c9f2
  item, last item or current item, whichever is closest to \e index.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn int QList::at() const
Packit Service 50c9f2
  Returns the index of the current list item.  The returned value is -1
Packit Service 50c9f2
  if the current item is null.
Packit Service 50c9f2
  \sa current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::current() const
Packit Service 50c9f2
  Returns a pointer to the current list item.  The current item may be
Packit Service 50c9f2
  null (implies that the current index is -1).
Packit Service 50c9f2
  \sa at()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QLNode *QList::currentNode() const
Packit Service 50c9f2
  Returns a pointer to the current list node.
Packit Service 50c9f2
Packit Service 50c9f2
  The node can be kept and removed later using removeNode().
Packit Service 50c9f2
  The advantage is that the item can be removed directly without
Packit Service 50c9f2
  searching the list.
Packit Service 50c9f2
Packit Service 50c9f2
  \warning Do not call this function unless you are an expert.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa removeNode(), takeNode(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::getFirst() const
Packit Service 50c9f2
  Returns a pointer to the first item in the list, or null if the
Packit Service 50c9f2
  list is empty.
Packit Service 50c9f2
Packit Service 50c9f2
  Does not affect the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa first(), getLast()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::getLast() const
Packit Service 50c9f2
  Returns a pointer to the last item in the list, or null if the
Packit Service 50c9f2
  list is empty.
Packit Service 50c9f2
Packit Service 50c9f2
  Does not affect the current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa last(), getFirst()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::first()
Packit Service 50c9f2
  Returns a pointer to the first item in the list and makes this the
Packit Service 50c9f2
  current list item, or null if the list is empty.
Packit Service 50c9f2
  \sa getFirst(), last(), next(), prev(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::last()
Packit Service 50c9f2
  Returns a pointer to the last item in the list and makes this the
Packit Service 50c9f2
  current list item, or null if the list is empty.
Packit Service 50c9f2
  \sa getLast(), first(), next(), prev(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::next()
Packit Service 50c9f2
  Returns a pointer to the item succeeding the current item.
Packit Service 50c9f2
  Returns null if the current item is null or equal to the last item.
Packit Service 50c9f2
Packit Service 50c9f2
  Makes the succeeding item current. If the current item before this
Packit Service 50c9f2
  function call was the last item, the current item will be set to null.
Packit Service 50c9f2
  If the current item was null, this function does nothing.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa first(), last(), prev(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QList::prev()
Packit Service 50c9f2
  Returns a pointer to the item preceding the current item.
Packit Service 50c9f2
  Returns null if the current item is null or equal to the first item.
Packit Service 50c9f2
Packit Service 50c9f2
  Makes the preceding item current. If the current item before this
Packit Service 50c9f2
  function call was the first item, the current item will be set to null.
Packit Service 50c9f2
  If the current item was null, this function does nothing.
Packit Service 50c9f2
Packit Service 50c9f2
  \sa first(), last(), next(), current()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn void QList::toVector( QGVector *vec ) const
Packit Service 50c9f2
  Stores all list items in the vector \e vec.
Packit Service 50c9f2
Packit Service 50c9f2
  The vector must be have the same item type, otherwise the result
Packit Service 50c9f2
  will be undefined.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*****************************************************************************
Packit Service 50c9f2
  QListIterator documentation
Packit Service 50c9f2
 *****************************************************************************/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \class QListIterator qlist.h
Packit Service 50c9f2
  \brief The QListIterator class provides an iterator for QList collections.
Packit Service 50c9f2
Packit Service 50c9f2
  \ingroup collection
Packit Service 50c9f2
  \ingroup tools
Packit Service 50c9f2
Packit Service 50c9f2
  Define a template instance QListIterator\<X\> to create a list iterator
Packit Service 50c9f2
  that operates on QList\<X\> (list of X*).
Packit Service 50c9f2
Packit Service 50c9f2
  Example:
Packit Service 50c9f2
  \code
Packit Service 50c9f2
    #include <qlist.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( const char *name, int salary ) { n=name; s=salary; }
Packit Service 50c9f2
        const char *name()   const		 { return n; }
Packit Service 50c9f2
        int	    salary() const		 { return s; }
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
	QList<Employee> list;		  // list of pointers to Employee
Packit Service 50c9f2
	list.setAutoDelete( TRUE );	  // delete items when they are removed
Packit Service 50c9f2
Packit Service 50c9f2
	list.append( new Employee("Bill", 50000) );
Packit Service 50c9f2
	list.append( new Employee("Steve",80000) );
Packit Service 50c9f2
	list.append( new Employee("Ron",  60000) );
Packit Service 50c9f2
Packit Service 50c9f2
	QListIterator<Employee> it(list); // iterator for employee list
Packit Service 50c9f2
	for ( ; it.current(); ++it ) {
Packit Service 50c9f2
	    Employee *emp = it.current();
Packit Service 50c9f2
	    printf( "%s earns %d\n", emp->name().latin1(), emp->salary() );
Packit Service 50c9f2
        }
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
  \endcode
Packit Service 50c9f2
Packit Service 50c9f2
  Although QList has member functions to traverse the doubly linked list
Packit Service 50c9f2
  structure, using a list iterator is a much more robust way of traversing
Packit Service 50c9f2
  the list, because multiple list iterators can operate on the same list,
Packit Service 50c9f2
  independent of each other and independent of the QList's current item.
Packit Service 50c9f2
  An iterator has its own current list item and can get the next and
Packit Service 50c9f2
  previous list items.  It can only traverse the list, never modify it.
Packit Service 50c9f2
Packit Service 50c9f2
  A QList knows about all list iterators that are operating on the list.
Packit Service 50c9f2
  When an item is removed from the list, the list update all iterators
Packit Service 50c9f2
  that are pointing the removed item to point to the new current list item.
Packit Service 50c9f2
Packit Service 50c9f2
  Example:
Packit Service 50c9f2
  \code
Packit Service 50c9f2
    #include <qlist.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
	...	// same as above
Packit Service 50c9f2
    };
Packit Service 50c9f2
Packit Service 50c9f2
    void main()
Packit Service 50c9f2
    {
Packit Service 50c9f2
	QList<Employee> list;		  // list of pointers to Employee
Packit Service 50c9f2
	list.setAutoDelete( TRUE );	  // delete items when they are removed
Packit Service 50c9f2
Packit Service 50c9f2
	list.append( new Employee("Bill", 50000) );
Packit Service 50c9f2
	list.append( new Employee("Steve",80000) );
Packit Service 50c9f2
	list.append( new Employee("Ron",  60000) );
Packit Service 50c9f2
Packit Service 50c9f2
	QListIterator<Employee> it(list);
Packit Service 50c9f2
Packit Service 50c9f2
	list.at( 1 );			  // current list item: "Steve"
Packit Service 50c9f2
        it.toLast();			  // it: "Ron"
Packit Service 50c9f2
	--it;				  // it: "Steve"
Packit Service 50c9f2
Packit Service 50c9f2
	  // Now, both the list and the iterator are referring the same item
Packit Service 50c9f2
Packit Service 50c9f2
	list.remove();
Packit Service 50c9f2
	printf( "%s\n", it.current()->name().latin1() );
Packit Service 50c9f2
    }
Packit Service 50c9f2
  \endcode
Packit Service 50c9f2
Packit Service 50c9f2
  Program output:
Packit Service 50c9f2
  \code
Packit Service 50c9f2
	Ron
Packit Service 50c9f2
  \endcode
Packit Service 50c9f2
Packit Service 50c9f2
  \sa QList, \link collection.html collection classes\endlink
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QListIterator::QListIterator( const QList<type> &list )
Packit Service 50c9f2
  Constructs an iterator for \e list.  The current iterator item is
Packit Service 50c9f2
  set to point on the first item in the \e list.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QListIterator::~QListIterator()
Packit Service 50c9f2
  Destroys the iterator.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn uint QListIterator::count() const
Packit Service 50c9f2
  Returns the number of items in the list this iterator operates on.
Packit Service 50c9f2
  \sa isEmpty()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QListIterator::isEmpty() const
Packit Service 50c9f2
  Returns TRUE if the list is empty, i.e. count() == 0, otherwise FALSE.
Packit Service 50c9f2
  \sa count()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QListIterator::atFirst() const
Packit Service 50c9f2
  Returns TRUE if the current iterator item is the first list item, otherwise
Packit Service 50c9f2
  FALSE.
Packit Service 50c9f2
  \sa toFirst(), atLast()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn bool QListIterator::atLast() const
Packit Service 50c9f2
  Returns TRUE if the current iterator item is the last list item, otherwise
Packit Service 50c9f2
  FALSE.
Packit Service 50c9f2
  \sa toLast(), atFirst()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::toFirst()
Packit Service 50c9f2
  Sets the current iterator item to point to the first list item and returns
Packit Service 50c9f2
  a pointer to the item.  Sets the current item to null and returns null
Packit Service 50c9f2
  if the list is empty.
Packit Service 50c9f2
  \sa toLast(), atFirst()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::toLast()
Packit Service 50c9f2
  Sets the current iterator item to point to the last list item and returns
Packit Service 50c9f2
  a pointer to the item.  Sets the current item to null and returns null
Packit Service 50c9f2
  if the list is empty.
Packit Service 50c9f2
  \sa toFirst(), atLast()
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QListIterator::operator type *() const
Packit Service 50c9f2
  Cast operator. Returns a pointer to the current iterator item.
Packit Service 50c9f2
  Same as current().
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::operator*()
Packit Service 50c9f2
  Asterix operator. Returns a pointer to the current iterator item.
Packit Service 50c9f2
  Same as current().
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::current() const
Packit Service 50c9f2
  Returns a pointer to the current iterator item.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::operator()()
Packit Service 50c9f2
  Makes the succeeding item current and returns the original current item.
Packit Service 50c9f2
Packit Service 50c9f2
  If the current iterator item was the last item in the list or if it was
Packit Service 50c9f2
  null, null is returned.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn char *QStrListIterator::operator()()
Packit Service 50c9f2
  Makes the succeeding item current and returns the original current item.
Packit Service 50c9f2
Packit Service 50c9f2
  If the current iterator item was the last item in the list or if it was
Packit Service 50c9f2
  null, null is returned.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::operator++()
Packit Service 50c9f2
  Prefix ++ makes the succeeding item current and returns the new current
Packit Service 50c9f2
  item.
Packit Service 50c9f2
Packit Service 50c9f2
  If the current iterator item was the last item in the list or if it was
Packit Service 50c9f2
  null, null is returned.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::operator+=( uint jump )
Packit Service 50c9f2
  Sets the current item to the item \e jump positions after the current item,
Packit Service 50c9f2
  and returns a pointer to that item.
Packit Service 50c9f2
Packit Service 50c9f2
  If that item is beyond the last item or if the dictionary is  empty,
Packit Service 50c9f2
  it sets the current item to null and  returns null
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::operator--()
Packit Service 50c9f2
  Prefix -- makes the preceding item current and returns the new current
Packit Service 50c9f2
  item.
Packit Service 50c9f2
Packit Service 50c9f2
  If the current iterator item was the first item in the list or if it was
Packit Service 50c9f2
  null, null is returned.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn type *QListIterator::operator-=( uint jump )
Packit Service 50c9f2
  Returns the item \e jump positions before the current item, or null if
Packit Service 50c9f2
  it is beyond the first item.  Makes this the current item.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QListIterator<type>& QListIterator::operator=( const QListIterator<type> &it )
Packit Service 50c9f2
  Assignment.  Makes a copy of the iterator \a it and returns a reference
Packit Service 50c9f2
  to this iterator.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*****************************************************************************
Packit Service 50c9f2
  QStrList documentation
Packit Service 50c9f2
 *****************************************************************************/
Packit Service 50c9f2
Packit Service 50c9f2
//typedef QList<char> QStrList
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \class QStrList qstrlist.h
Packit Service 50c9f2
  \brief The QStrList class provides a doubly linked list of \c char*.
Packit Service 50c9f2
Packit Service 50c9f2
  \ingroup collection
Packit Service 50c9f2
  \ingroup tools
Packit Service 50c9f2
Packit Service 50c9f2
  This class is a QList\<char\> instance (a list of char*).
Packit Service 50c9f2
Packit Service 50c9f2
  QStrList can make deep or shallow copies of the strings that are inserted.
Packit Service 50c9f2
Packit Service 50c9f2
  A deep copy means to allocate space for the string and then copy the string
Packit Service 50c9f2
  data into it.  A shallow copy is just a copy of the pointer value and not
Packit Service 50c9f2
  the string data.
Packit Service 50c9f2
Packit Service 50c9f2
  The disadvantage with shallow copies is that since a pointer can only
Packit Service 50c9f2
  be deleted once, the program must put all strings in a central place and
Packit Service 50c9f2
  know when it is safe to delete them (i.e. when the strings are no longer
Packit Service 50c9f2
  referenced by other parts of the program).  This can make the program
Packit Service 50c9f2
  more complex.  The advantage of shallow copies is that shallow copies
Packit Service 50c9f2
  consume far less memory than deep copies.  It is also much faster
Packit Service 50c9f2
  to copy a pointer (typically 4 or 8 bytes) than to copy string data.
Packit Service 50c9f2
Packit Service 50c9f2
  A QStrList that operates on deep copies will by default turn on
Packit Service 50c9f2
  auto-deletion (see setAutoDelete()). Thus, by default, QStrList will
Packit Service 50c9f2
  deallocate any string copies it allocates.
Packit Service 50c9f2
Packit Service 50c9f2
  The virtual compareItems() function is reimplemented and does a case
Packit Service 50c9f2
  sensitive string comparison. The inSort() function will insert
Packit Service 50c9f2
  strings in a sorted order.
Packit Service 50c9f2
Packit Service 50c9f2
  The QStrListIterator class is an iterator for QStrList.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QStrList::QStrList( bool deepCopies )
Packit Service 50c9f2
  Constructs an empty list of strings.  Will make deep copies of all inserted
Packit Service 50c9f2
  strings if \e deepCopies is TRUE, or uses shallow copies if \e deepCopies
Packit Service 50c9f2
  is FALSE.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QStrList::QStrList( const QStrList &list )
Packit Service 50c9f2
  Constructs a copy of \e list.
Packit Service 50c9f2
Packit Service 50c9f2
  If \e list has deep copies, this list will also get deep copies.
Packit Service 50c9f2
  Only the pointers are copied (shallow copy) if the other list does not
Packit Service 50c9f2
  use deep copies.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QStrList::~QStrList()
Packit Service 50c9f2
  Destroys the list.  All strings are removed.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QStrList& QStrList::operator=( const QStrList& list )
Packit Service 50c9f2
  Assigns \e list to this list and returns a reference to this list.
Packit Service 50c9f2
Packit Service 50c9f2
  If \e list has deep copies, this list will also get deep copies.
Packit Service 50c9f2
  Only the pointers are copied (shallow copy) if the other list does not
Packit Service 50c9f2
  use deep copies.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*****************************************************************************
Packit Service 50c9f2
  QStrIList documentation
Packit Service 50c9f2
 *****************************************************************************/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \class QStrIList qstrlist.h
Packit Service 50c9f2
  \brief The QStrIList class provides a doubly linked list of \c char* with
Packit Service 50c9f2
case insensitive compare.
Packit Service 50c9f2
Packit Service 50c9f2
  \ingroup collection
Packit Service 50c9f2
  \ingroup tools
Packit Service 50c9f2
Packit Service 50c9f2
  This class is a QList\<char\> instance (a list of char*).
Packit Service 50c9f2
Packit Service 50c9f2
  QStrIList is similar to QStrList except that it is case insensitive.
Packit Service 50c9f2
  The virtual compareItems() function is reimplemented and does a
Packit Service 50c9f2
  case insensitive string comparison.
Packit Service 50c9f2
  The inSort() function will insert strings in a sorted order.
Packit Service 50c9f2
Packit Service 50c9f2
  The QStrListIterator class is an iterator for QStrList.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QStrIList::QStrIList( bool deepCopies )
Packit Service 50c9f2
  Constructs a list of strings.  Will make deep copies of all inserted
Packit Service 50c9f2
  strings if \e deepCopies is TRUE, or uses shallow copies if \e deepCopies
Packit Service 50c9f2
  is FALSE.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \fn QStrIList::~QStrIList()
Packit Service 50c9f2
  Destroys the list.  All strings are removed.
Packit Service 50c9f2
*/
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*****************************************************************************
Packit Service 50c9f2
  QStrListIterator documentation
Packit Service 50c9f2
 *****************************************************************************/
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
  \class QStrListIterator qstrlist.h
Packit Service 50c9f2
  \brief The QStrListIterator class is an iterator for the QStrList and QStrIList classes.
Packit Service 50c9f2
Packit Service 50c9f2
  \ingroup tools
Packit Service 50c9f2
Packit Service 50c9f2
  This class is a QListIterator\<char\> instance.
Packit Service 50c9f2
  It can traverse the strings in the QStrList and QStrIList classes.
Packit Service 50c9f2
*/