Blame qtools/qlist.doc

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