|
|
|
/****************************************************************************
|
|
|
|
**
|
|
|
|
** TQValueList and TQValueListIterator class documentation
|
|
|
|
**
|
|
|
|
** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
|
|
|
|
**
|
|
|
|
** This file is part of the TQt GUI Toolkit.
|
|
|
|
**
|
|
|
|
** This file may be used under the terms of the GNU General
|
|
|
|
** Public License versions 2.0 or 3.0 as published by the Free
|
|
|
|
** Software Foundation and appearing in the files LICENSE.GPL2
|
|
|
|
** and LICENSE.GPL3 included in the packaging of this file.
|
|
|
|
** Alternatively you may (at your option) use any later version
|
|
|
|
** of the GNU General Public License if such license has been
|
|
|
|
** publicly approved by Trolltech ASA (or its successors, if any)
|
|
|
|
** and the KDE Free TQt Foundation.
|
|
|
|
**
|
|
|
|
** Please review the following information to ensure GNU General
|
|
|
|
** Public Licensing requirements will be met:
|
|
|
|
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
** review the following information:
|
|
|
|
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
|
|
|
|
** or contact the sales department at sales@trolltech.com.
|
|
|
|
**
|
|
|
|
** This file may be used under the terms of the Q Public License as
|
|
|
|
** defined by Trolltech ASA and appearing in the file LICENSE.QPL
|
|
|
|
** included in the packaging of this file. Licensees holding valid Qt
|
|
|
|
** Commercial licenses may use this file in accordance with the Qt
|
|
|
|
** Commercial License Agreement provided with the Software.
|
|
|
|
**
|
|
|
|
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
|
|
|
|
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
|
|
|
|
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
|
|
|
|
** herein.
|
|
|
|
**
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
TQValueList documentation
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class TQValueList tqvaluelist.h
|
|
|
|
\brief The TQValueList class is a value-based template class that
|
|
|
|
provides lists.
|
|
|
|
|
|
|
|
\ingroup qtl
|
|
|
|
\ingroup tools
|
|
|
|
\ingroup shared
|
|
|
|
\mainclass
|
|
|
|
\reentrant
|
|
|
|
|
|
|
|
TQValueList is a TQt implementation of an STL-like list container.
|
|
|
|
It can be used in your application if the standard \c list is not
|
|
|
|
available for your target platform(s). TQValueList is part of the
|
|
|
|
\link ntqtl.html TQt Template Library\endlink.
|
|
|
|
|
|
|
|
TQValueList\<T\> defines a template instance to create a list of
|
|
|
|
values that all have the class T. Note that TQValueList does not
|
|
|
|
store pointers to the members of the list; it holds a copy of
|
|
|
|
every member. This is why these kinds of classes are called "value
|
|
|
|
based"; TQPtrList and TQDict are "pointer based".
|
|
|
|
|
|
|
|
TQValueList contains and manages a collection of objects of type T
|
|
|
|
and provides iterators that allow the contained objects to be
|
|
|
|
addressed. TQValueList owns the contained items. For more relaxed
|
|
|
|
ownership semantics, see TQPtrCollection and friends which are
|
|
|
|
pointer-based containers.
|
|
|
|
|
|
|
|
Some classes cannot be used within a TQValueList, for example, all
|
|
|
|
classes derived from TQObject and thus all classes that implement
|
|
|
|
widgets. Only values can be used in a TQValueList. To qualify as a
|
|
|
|
value the class must provide:
|
|
|
|
\list
|
|
|
|
\i a copy constructor;
|
|
|
|
\i an assignment operator;
|
|
|
|
\i a default constructor, i.e. a constructor that does not take any arguments.
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
Note that C++ defaults to field-by-field assignment operators and
|
|
|
|
copy constructors if no explicit version is supplied. In many
|
|
|
|
cases this is sufficient.
|
|
|
|
|
|
|
|
In addition, some compilers (e.g. Sun CC) might require that the
|
|
|
|
class provides an equality operator (operator==()).
|
|
|
|
|
|
|
|
TQValueList's function naming is consistent with the other Qt
|
|
|
|
classes (e.g. count(), isEmpty()). TQValueList also provides extra
|
|
|
|
functions for compatibility with STL algorithms, such as size()
|
|
|
|
and empty(). Programmers already familiar with the STL \c list may
|
|
|
|
prefer to use the STL-compatible functions.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
\code
|
|
|
|
class Employee
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Employee(): sn(0) {}
|
|
|
|
Employee( const TQString& forename, const TQString& surname, int salary )
|
|
|
|
: fn(forename), sn(surname), sal(salary)
|
|
|
|
{}
|
|
|
|
|
|
|
|
TQString forename() const { return fn; }
|
|
|
|
TQString surname() const { return sn; }
|
|
|
|
int salary() const { return sal; }
|
|
|
|
void setSalary( int salary ) { sal = salary; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
TQString fn;
|
|
|
|
TQString sn;
|
|
|
|
int sal;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef TQValueList<Employee> EmployeeList;
|
|
|
|
EmployeeList list;
|
|
|
|
|
|
|
|
list.append( Employee("John", "Doe", 50000) );
|
|
|
|
list.append( Employee("Jane", "Williams", 80000) );
|
|
|
|
list.append( Employee("Tom", "Jones", 60000) );
|
|
|
|
|
|
|
|
Employee mary( "Mary", "Hawthorne", 90000 );
|
|
|
|
list.append( mary );
|
|
|
|
mary.setSalary( 100000 );
|
|
|
|
|
|
|
|
EmployeeList::iterator it;
|
|
|
|
for ( it = list.begin(); it != list.end(); ++it )
|
|
|
|
cout << (*it).surname().latin1() << ", " <<
|
|
|
|
(*it).forename().latin1() << " earns " <<
|
|
|
|
(*it).salary() << endl;
|
|
|
|
|
|
|
|
// Output:
|
|
|
|
// Doe, John earns 50000
|
|
|
|
// Williams, Jane earns 80000
|
|
|
|
// Hawthorne, Mary earns 90000
|
|
|
|
// Jones, Tom earns 60000
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
|
|
|
|
Notice that the latest changes to Mary's salary did not affect the
|
|
|
|
value in the list because the list created a copy of Mary's entry.
|
|
|
|
|
|
|
|
There are several ways to find items in the list. The begin() and
|
|
|
|
end() functions return iterators to the beginning and end of the
|
|
|
|
list. The advantage of getting an iterator is that you can move
|
|
|
|
forward or backward from this position by
|
|
|
|
incrementing/decrementing the iterator. The iterator returned by
|
|
|
|
end() points to the item which is one \e past the last item in the
|
|
|
|
container. The past-the-end iterator is still associated with the
|
|
|
|
list it belongs to, however it is \e not dereferenceable;
|
|
|
|
operator*() will not return a well-defined value. If the list is
|
|
|
|
empty(), the iterator returned by begin() will equal the iterator
|
|
|
|
returned by end().
|
|
|
|
|
|
|
|
Another way to find an item in the list is by using the \link
|
|
|
|
ntqtl.html#qFind tqFind()\endlink algorithm. For example:
|
|
|
|
|
|
|
|
\code
|
|
|
|
TQValueList<int> list;
|
|
|
|
...
|
|
|
|
TQValueList<int>::iterator it = tqFind( list.begin(), list.end(), 3 );
|
|
|
|
if ( it != list.end() )
|
|
|
|
// it points to the found item
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
It is safe to have multiple iterators a the list at the same
|
|
|
|
time. If some member of the list is removed, only iterators
|
|
|
|
pointing to the removed member become invalid. Inserting into the
|
|
|
|
list does not invalidate any iterator. For convenience, the
|
|
|
|
function last() returns a reference to the last item in the list,
|
|
|
|
and first() returns a reference to the the first item. If the
|
|
|
|
list is empty(), both last() and first() have undefined behavior
|
|
|
|
(your application will crash or do unpredictable things). Use
|
|
|
|
last() and first() with caution, for example:
|
|
|
|
|
|
|
|
\code
|
|
|
|
TQValueList<int> list;
|
|
|
|
list.append( 1 );
|
|
|
|
list.append( 2 );
|
|
|
|
list.append( 3 );
|
|
|
|
...
|
|
|
|
if ( !list.empty() ) {
|
|
|
|
// OK, modify the first item
|
|
|
|
int& i = list.first();
|
|
|
|
i = 18;
|
|
|
|
}
|
|
|
|
...
|
|
|
|
TQValueList<double> dlist;
|
|
|
|
double d = dlist.last(); // undefined
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
Because TQValueList is value-based there is no need to be careful
|
|
|
|
about deleting items in the list. The list holds its own copies
|
|
|
|
and will free them if the corresponding member or the list itself
|
|
|
|
is deleted. You can force the list to free all of its items with
|
|
|
|
clear().
|
|
|
|
|
|
|
|
TQValueList is shared implicitly, which means it can be copied in
|
|
|
|
constant time, i.e. O(1). If multiple TQValueList instances share
|
|
|
|
the same data and one needs to modify its contents, this modifying
|
|
|
|
instance makes a copy and modifies its private copy; therefore it
|
|
|
|
does not affect the other instances; this takes O(n) time. This is
|
|
|
|
often called "copy on write". If a TQValueList is being used in a
|
|
|
|
multi-threaded program, you must protect all access to the list.
|
|
|
|
See \l TQMutex.
|
|
|
|
|
|
|
|
There are several ways to insert items into the list. The
|
|
|
|
prepend() and append() functions insert items at the beginning and
|
|
|
|
the end of the list respectively. The insert() function comes in
|
|
|
|
several flavors and can be used to add one or more items at
|
|
|
|
specific positions within the list.
|
|
|
|
|
|
|
|
Items can also be removed from the list in several ways. There
|
|
|
|
are several variants of the remove() function, which removes a
|
|
|
|
specific item from the list. The remove() function will find and
|
|
|
|
remove items according to a specific item value.
|
|
|
|
|
|
|
|
Lists can also be sorted using the \link ntqtl.html TQt Template
|
|
|
|
Library\endlink. For example with qHeapSort():
|
|
|
|
|
|
|
|
Example:
|
|
|
|
\code
|
|
|
|
TQValueList<int> list;
|
|
|
|
list.append( 5 );
|
|
|
|
list.append( 8 );
|
|
|
|
list.append( 3 );
|
|
|
|
list.append( 4 );
|
|
|
|
qHeapSort( list );
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
\sa TQValueListIterator
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*! \enum TQValueList::iterator
|
|
|
|
The list's iterator type, TQValueListIterator. */
|
|
|
|
/*! \enum TQValueList::const_iterator
|
|
|
|
The list's const iterator type, TQValueListConstIterator. */
|
|
|
|
/*! \enum TQValueList::value_type
|
|
|
|
The type of the object stored in the list, T. */
|
|
|
|
/*! \enum TQValueList::pointer
|
|
|
|
The pointer to T type. */
|
|
|
|
/*! \enum TQValueList::const_pointer
|
|
|
|
The const pointer to T type. */
|
|
|
|
/*! \enum TQValueList::reference
|
|
|
|
The reference to T type. */
|
|
|
|
/*! \enum TQValueList::const_reference
|
|
|
|
The const reference to T type. */
|
|
|
|
/*! \enum TQValueList::size_type
|
|
|
|
An unsigned integral type, used to represent various sizes. */
|
|
|
|
/*! \enum TQValueList::difference_type
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
/*! \enum TQValueList::ValueType
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
/*!
|
|
|
|
\fn TQValueList::TQValueList()
|
|
|
|
|
|
|
|
Constructs an empty list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList::TQValueList( const TQValueList<T>& l )
|
|
|
|
|
|
|
|
Constructs a copy of \a l.
|
|
|
|
|
|
|
|
This operation takes O(1) time because TQValueList is implicitly
|
|
|
|
shared.
|
|
|
|
|
|
|
|
The first modification to a list will take O(n) time.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList::TQValueList( const std::list<T>& l )
|
|
|
|
|
|
|
|
Contructs a copy of \a l.
|
|
|
|
|
|
|
|
This constructor is provided for compatibility with STL
|
|
|
|
containers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList::~TQValueList()
|
|
|
|
|
|
|
|
Destroys the list. References to the values in the list and all
|
|
|
|
iterators of this list become invalidated. Note that it is
|
|
|
|
impossible for an iterator to check whether or not it is valid:
|
|
|
|
TQValueList is highly tuned for performance, not for error
|
|
|
|
checking.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*! \enum TQValueListIterator::NodePtr
|
|
|
|
\internal */
|
|
|
|
/*! \enum TQValueListIterator::iterator_category
|
|
|
|
\internal */
|
|
|
|
/*! \enum TQValueListIterator::size_type
|
|
|
|
\internal */
|
|
|
|
/*! \enum TQValueListIterator::difference_type
|
|
|
|
\internal */
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator::TQValueListIterator( NodePtr p )
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueList::operator== ( const TQValueList<T>& l ) const
|
|
|
|
|
|
|
|
Compares both lists.
|
|
|
|
|
|
|
|
Returns TRUE if this list and \a l are equal; otherwise returns
|
|
|
|
FALSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueList::operator== ( const std::list<T>& l ) const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Returns TRUE if this list and \a l are equal; otherwise returns
|
|
|
|
FALSE.
|
|
|
|
|
|
|
|
This operator is provided for compatibility with STL containers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList<T>& TQValueList::operator= ( const TQValueList<T>& l )
|
|
|
|
|
|
|
|
Assigns \a l to this list and returns a reference to this list.
|
|
|
|
|
|
|
|
All iterators of the current list become invalidated by this
|
|
|
|
operation. The cost of such an assignment is O(1) since TQValueList
|
|
|
|
is implicitly shared.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList<T>& TQValueList::operator= ( const std::list<T>& l )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Assigns the contents of \a l to the list.
|
|
|
|
|
|
|
|
All iterators of the current list become invalidated by this
|
|
|
|
operation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueList::operator!= ( const TQValueList<T>& l ) const
|
|
|
|
|
|
|
|
Compares both lists.
|
|
|
|
|
|
|
|
Returns TRUE if this list and \a l are unequal; otherwise returns
|
|
|
|
FALSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::insert( iterator it, const T& x )
|
|
|
|
|
|
|
|
Inserts the value \a x in front of the item pointed to by the
|
|
|
|
iterator, \a it.
|
|
|
|
|
|
|
|
Returns an iterator pointing at the inserted item.
|
|
|
|
|
|
|
|
\sa append(), prepend()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn uint TQValueList::remove( const T& x )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Removes all items that have value \a x and returns the number of
|
|
|
|
removed items.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void TQValueList::clear()
|
|
|
|
|
|
|
|
Removes all items from the list.
|
|
|
|
|
|
|
|
\sa remove()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::begin()
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Returns an iterator pointing to the first item in the list. This
|
|
|
|
iterator equals end() if the list is empty.
|
|
|
|
|
|
|
|
\sa first(), end()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_iterator TQValueList::begin() const
|
|
|
|
|
|
|
|
Returns an iterator pointing to the first item in the list. This
|
|
|
|
iterator equals end() if the list is empty.
|
|
|
|
|
|
|
|
\sa first(), end(), constBegin()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_iterator TQValueList::constBegin() const
|
|
|
|
|
|
|
|
Returns an iterator pointing to the first item in the list. This
|
|
|
|
iterator equals constEnd() if the list is empty.
|
|
|
|
|
|
|
|
\sa begin()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::end()
|
|
|
|
|
|
|
|
Returns an iterator pointing \e past the last item in the list.
|
|
|
|
This iterator equals begin() if the list is empty.
|
|
|
|
|
|
|
|
\sa last(), begin(), constEnd()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_iterator TQValueList::end() const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Returns an iterator pointing \e past the last item in the list.
|
|
|
|
This iterator equals begin() if the list is empty.
|
|
|
|
|
|
|
|
\sa last(), begin()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_iterator TQValueList::constEnd() const
|
|
|
|
|
|
|
|
Returns an iterator pointing \e past the last item in the list.
|
|
|
|
This iterator equals constBegin() if the list is empty.
|
|
|
|
|
|
|
|
\sa end()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQDataStream& operator>>( TQDataStream& s, TQValueList<T>& l )
|
|
|
|
|
|
|
|
\relates TQValueList
|
|
|
|
|
|
|
|
Reads a list, \a l, from the stream \a s. The type T stored in the
|
|
|
|
list must implement the streaming operator.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQDataStream& operator<<( TQDataStream& s, const TQValueList<T>& l )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
\relates TQValueList
|
|
|
|
|
|
|
|
Writes a list, \a l, to the stream \a s. The type T stored in the
|
|
|
|
list must implement the streaming operator.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn size_type TQValueList::size() const
|
|
|
|
|
|
|
|
Returns the number of items in the list.
|
|
|
|
|
|
|
|
This function is provided for STL compatibility. It is equivalent
|
|
|
|
to count().
|
|
|
|
|
|
|
|
\sa empty()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueList::empty() const
|
|
|
|
|
|
|
|
Returns TRUE if the list contains no items; otherwise returns
|
|
|
|
FALSE.
|
|
|
|
|
|
|
|
\sa size()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void TQValueList::push_front( const T& x )
|
|
|
|
|
|
|
|
Inserts \a x at the beginning of the list.
|
|
|
|
|
|
|
|
This function is provided for STL compatibility. It is equivalent
|
|
|
|
to prepend().
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void TQValueList::push_back( const T& x )
|
|
|
|
|
|
|
|
Inserts \a x at the end of the list.
|
|
|
|
|
|
|
|
This function is provided for STL compatibility. It is equivalent
|
|
|
|
to append().
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::erase( iterator it )
|
|
|
|
|
|
|
|
Removes the item pointed to by \a it from the list. No iterators
|
|
|
|
other than \a it or other iterators pointing at the same item as
|
|
|
|
\a it are invalidated. Returns an iterator to the next item after
|
|
|
|
\a it, or end() if there is no such item.
|
|
|
|
|
|
|
|
This function is provided for STL compatibility. It is equivalent
|
|
|
|
to remove().
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::erase( iterator first, iterator last )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Deletes all items from \a first to \a last (not including \a
|
|
|
|
last). No iterators are invalidated, except those pointing to the
|
|
|
|
removed items themselves. Returns \a last.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn reference TQValueList::front()
|
|
|
|
|
|
|
|
Returns a reference to the first item. If the list contains no
|
|
|
|
first item (i.e. empty() returns TRUE), the return value is
|
|
|
|
undefined.
|
|
|
|
|
|
|
|
This function is provided for STL compatibility. It is equivalent
|
|
|
|
to first().
|
|
|
|
|
|
|
|
\sa back()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_reference TQValueList::front() const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn reference TQValueList::back()
|
|
|
|
|
|
|
|
Returns a reference to the last item. If the list contains no last
|
|
|
|
item (i.e. empty() returns TRUE), the return value is undefined.
|
|
|
|
|
|
|
|
This function is provided for STL compatibility. It is equivalent
|
|
|
|
to last().
|
|
|
|
|
|
|
|
\sa front()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_reference TQValueList::back() const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void TQValueList::pop_front()
|
|
|
|
|
|
|
|
Removes the first item. If there is no first item, this operation
|
|
|
|
is undefined.
|
|
|
|
|
|
|
|
This function is provided for STL compatibility.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void TQValueList::pop_back()
|
|
|
|
|
|
|
|
Removes the last item. If there is no last item, this operation is
|
|
|
|
undefined.
|
|
|
|
|
|
|
|
This function is provided for STL compatibility.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void TQValueList::insert( iterator pos, size_type n, const T& x )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Inserts \a n copies of \a x before position \a pos.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void TQValueList::detach()
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList<T>& TQValueList::operator<< ( const T& x )
|
|
|
|
|
|
|
|
Adds the value \a x to the end of the list.
|
|
|
|
|
|
|
|
Returns a reference to the list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const T& TQValueList::operator[] ( size_type i ) const
|
|
|
|
|
|
|
|
Returns a const reference to the item with index \a i in the list.
|
|
|
|
It is up to you to check whether this item really exists. You can
|
|
|
|
do that easily with the count() function. However this operator
|
|
|
|
does not check whether \a i is in range and will deliver undefined
|
|
|
|
results if it does not exist.
|
|
|
|
|
|
|
|
\warning This function uses a linear search and can be extremely
|
|
|
|
slow for large lists. TQValueList is not optimized for random item
|
|
|
|
access. If you need random access use a different container, such
|
|
|
|
as TQValueVector.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn T& TQValueList::operator[] ( size_type i )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Returns a non-const reference to the item with index \a i.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_iterator TQValueList::at( size_type i ) const
|
|
|
|
|
|
|
|
Returns an iterator pointing to the item at position \a i in the
|
|
|
|
list, or an undefined value if the index is out of range.
|
|
|
|
|
|
|
|
\warning This function uses a linear search and can be extremely
|
|
|
|
slow for large lists. TQValueList is not optimized for random item
|
|
|
|
access. If you need random access use a different container, such
|
|
|
|
as TQValueVector.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::at( size_type i )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Returns an iterator pointing to the item at position \a i in the
|
|
|
|
list, or an undefined value if the index is out of range.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::fromLast()
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Returns an iterator to the last item in the list, or end() if
|
|
|
|
there is no last item.
|
|
|
|
|
|
|
|
Use the end() function instead. For example:
|
|
|
|
|
|
|
|
\code
|
|
|
|
TQValueList<int> l;
|
|
|
|
...
|
|
|
|
TQValueList<int>::iterator it = l.end();
|
|
|
|
--it;
|
|
|
|
if ( it != end() )
|
|
|
|
// ...
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_iterator TQValueList::fromLast() const
|
|
|
|
|
|
|
|
Returns an iterator to the last item in the list, or end() if
|
|
|
|
there is no last item.
|
|
|
|
|
|
|
|
Use the end() function instead. For example:
|
|
|
|
|
|
|
|
\code
|
|
|
|
TQValueList<int> l;
|
|
|
|
...
|
|
|
|
TQValueList<int>::iterator it = l.end();
|
|
|
|
--it;
|
|
|
|
if ( it != end() )
|
|
|
|
// ...
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList<T> TQValueList::operator+( const TQValueList<T>& l ) const
|
|
|
|
|
|
|
|
Creates a new list and fills it with the items of this list. Then
|
|
|
|
the items of \a l are appended. Returns the new list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList<T>& TQValueList::operator+= ( const TQValueList<T>& l )
|
|
|
|
|
|
|
|
Appends the items of \a l to this list. Returns a reference to
|
|
|
|
this list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueList<T>& TQValueList::operator+= ( const T& x )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Appends the value \a x to the list. Returns a reference to the
|
|
|
|
list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn uint TQValueList::count() const
|
|
|
|
|
|
|
|
Returns the number of items in the list.
|
|
|
|
|
|
|
|
\sa isEmpty()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueList::isEmpty() const
|
|
|
|
|
|
|
|
Returns TRUE if the list contains no items; otherwise returns
|
|
|
|
FALSE.
|
|
|
|
|
|
|
|
\sa count()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::append( const T& x )
|
|
|
|
|
|
|
|
Inserts \a x at the end of the list.
|
|
|
|
|
|
|
|
\sa insert(), prepend()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::prepend( const T& x )
|
|
|
|
|
|
|
|
Inserts \a x at the beginning of the list.
|
|
|
|
|
|
|
|
\sa insert(), append()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::remove( iterator it )
|
|
|
|
|
|
|
|
Removes the item pointed to by \a it from the list. No iterators
|
|
|
|
other than \a it or other iterators pointing at the same item as
|
|
|
|
\a it are invalidated. Returns an iterator to the next item after
|
|
|
|
\a it, or end() if there is no such item.
|
|
|
|
|
|
|
|
\sa clear()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::find( const T& x )
|
|
|
|
|
|
|
|
Returns an iterator pointing to the first occurrence of \a x in
|
|
|
|
the list.
|
|
|
|
|
|
|
|
Returns end() is no item matched.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_iterator TQValueList::find( const T& x ) const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Returns an iterator pointing to the first occurrence of \a x in
|
|
|
|
the list.
|
|
|
|
|
|
|
|
Returns end() if no item matched.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn iterator TQValueList::find( iterator it, const T& x )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Finds the first occurrence of \a x in the list starting at the
|
|
|
|
position given by \a it.
|
|
|
|
|
|
|
|
Returns end() if no item matched.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const_iterator TQValueList::find( const_iterator it, const T& x ) const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Finds the first occurrence of \a x in the list starting at the
|
|
|
|
position given by \a it.
|
|
|
|
|
|
|
|
Returns end() if no item matched.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn uint TQValueList::contains( const T& x ) const
|
|
|
|
|
|
|
|
Returns the number of occurrences of the value \a x in the list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int TQValueList::findIndex( const T& x ) const
|
|
|
|
|
|
|
|
Returns the index of the first occurrence of the value \a x.
|
|
|
|
Returns -1 if no item matched.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn T& TQValueList::first()
|
|
|
|
|
|
|
|
Returns a reference to the first item. If the list contains no
|
|
|
|
first item (i.e. isEmpty() returns TRUE), the return value is
|
|
|
|
undefined.
|
|
|
|
|
|
|
|
\sa last()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const T& TQValueList::first() const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn T& TQValueList::last()
|
|
|
|
|
|
|
|
Returns a reference to the last item. If the list contains no last
|
|
|
|
item (i.e. empty() returns TRUE), the return value is undefined.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const T& TQValueList::last() const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
TQValueListIterator documentation
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class TQValueListIterator tqvaluelist.h
|
|
|
|
\brief The TQValueListIterator class provides an iterator for TQValueList.
|
|
|
|
|
|
|
|
\ingroup qtl
|
|
|
|
\ingroup tools
|
|
|
|
\reentrant
|
|
|
|
|
|
|
|
An iterator is a class for accessing the items of a container
|
|
|
|
class: a generalization of the index in an array. A pointer
|
|
|
|
into a "const char *" and an index into an "int[]" are both
|
|
|
|
iterators, and the general idea is to provide that functionality
|
|
|
|
for any data structure.
|
|
|
|
|
|
|
|
The TQValueListIterator class is an iterator for TQValueList
|
|
|
|
instantiations. You can create the appropriate iterator type by
|
|
|
|
using the \c iterator typedef provided by TQValueList.
|
|
|
|
|
|
|
|
The only way to access the items in a TQValueList is to use an
|
|
|
|
iterator.
|
|
|
|
|
|
|
|
Example (see TQValueList for the complete code):
|
|
|
|
\code
|
|
|
|
EmployeeList::iterator it;
|
|
|
|
for ( it = list.begin(); it != list.end(); ++it )
|
|
|
|
cout << (*it).surname().latin1() << ", " <<
|
|
|
|
(*it).forename().latin1() << " earns " <<
|
|
|
|
(*it).salary() << endl;
|
|
|
|
|
|
|
|
// Output:
|
|
|
|
// Doe, John earns 50000
|
|
|
|
// Williams, Jane earns 80000
|
|
|
|
// Hawthorne, Mary earns 90000
|
|
|
|
// Jones, Tom earns 60000
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
TQValueList is highly optimized for performance and memory usage.
|
|
|
|
This means that you must be careful: TQValueList does not know
|
|
|
|
about all its iterators and the iterators don't know to which list
|
|
|
|
they belong. This makes things very fast, but if you're not
|
|
|
|
careful, you can get spectacular bugs. Always make sure iterators
|
|
|
|
are valid before dereferencing them or using them as parameters to
|
|
|
|
generic algorithms in the STL or the \link ntqtl.html QTL\endlink.
|
|
|
|
|
|
|
|
Using an invalid iterator is undefined (your application will
|
|
|
|
probably crash). Many TQt functions return const value lists; to
|
|
|
|
iterate over these you should make a copy and iterate over the
|
|
|
|
copy.
|
|
|
|
|
|
|
|
For every Iterator there is a ConstIterator. When accessing a
|
|
|
|
TQValueList in a const environment or if the reference or pointer
|
|
|
|
to the list is itself const, then you must use the ConstIterator.
|
|
|
|
Its semantics are the same as the Iterator, but it only returns
|
|
|
|
const references.
|
|
|
|
|
|
|
|
\sa TQValueList, TQValueListConstIterator
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*! \enum TQValueListIterator::value_type
|
|
|
|
The type of value, T. */
|
|
|
|
/*! \enum TQValueListIterator::pointer
|
|
|
|
Pointer to value_type. */
|
|
|
|
/*! \enum TQValueListIterator::reference
|
|
|
|
Reference to value_type. */
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator::TQValueListIterator()
|
|
|
|
|
|
|
|
Creates un uninitialized iterator.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
\fn TQValueListIterator::TQValueListIterator( NodePtr p )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator::TQValueListIterator( const TQValueListIterator<T>& it )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Constructs a copy of the iterator \a it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Unfortunately not with MSVC
|
|
|
|
\fn T *TQValueListIterator::operator->()
|
|
|
|
Pointer operator. Returns a pointer to the current iterator item.
|
|
|
|
The great advantage of this operator is that you can treat the
|
|
|
|
iterator like a pointer.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
\code
|
|
|
|
TQValueList<int>::Iterator it = list.begin();
|
|
|
|
for( ; it != end(); ++it )
|
|
|
|
it->show();
|
|
|
|
\endcode
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn T& TQValueListIterator::operator*()
|
|
|
|
|
|
|
|
Asterisk operator. Returns a reference to the current iterator item.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const T& TQValueListIterator::operator*() const
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Asterisk operator. Returns a reference to the current iterator item.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator<T>& TQValueListIterator::operator++()
|
|
|
|
|
|
|
|
Prefix ++ makes the succeeding item current and returns an
|
|
|
|
iterator pointing to the new current item. The iterator cannot
|
|
|
|
check whether it reached the end of the list. Incrementing the
|
|
|
|
iterator returned by end() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator<T> TQValueListIterator::operator++(int)
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Postfix ++ makes the succeeding item current and returns an
|
|
|
|
iterator pointing to the new current item. The iterator cannot
|
|
|
|
check whether it reached the end of the list. Incrementing the
|
|
|
|
iterator returned by end() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator<T>& TQValueListIterator::operator--()
|
|
|
|
|
|
|
|
Prefix -- makes the previous item current and returns an iterator
|
|
|
|
pointing to the new current item. The iterator cannot check
|
|
|
|
whether it reached the beginning of the list. Decrementing the
|
|
|
|
iterator returned by begin() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator<T> TQValueListIterator::operator--(int)
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Postfix -- makes the previous item current and returns an iterator
|
|
|
|
pointing to the new current item. The iterator cannot check
|
|
|
|
whether it reached the beginning of the list. Decrementing the
|
|
|
|
iterator returned by begin() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator<T>& TQValueListIterator::operator+=(int j)
|
|
|
|
|
|
|
|
Postfix -- jumps \a j steps forward in the list. The iterator
|
|
|
|
cannot check whether it reached the end of the list. Jumping past
|
|
|
|
the end() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListIterator<T>& TQValueListIterator::operator-=(int j)
|
|
|
|
|
|
|
|
Postfix -- jumps \a j steps backward in the list. The iterator
|
|
|
|
cannot check whether it reached the beginning of the list. Jumping
|
|
|
|
past begin() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueListIterator::operator==( const TQValueListIterator<T>& it ) const
|
|
|
|
|
|
|
|
Compares this iterator and \a it and returns TRUE if they point to
|
|
|
|
the same item; otherwise returns FALSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueListIterator::operator!=( const TQValueListIterator<T>& it ) const
|
|
|
|
|
|
|
|
Compares this iterator and \a it and returns TRUE if they point to
|
|
|
|
different items; otherwise returns FALSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
TQValueListConstIterator documentation
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class TQValueListConstIterator tqvaluelist.h
|
|
|
|
\brief The TQValueListConstIterator class provides a const iterator
|
|
|
|
for TQValueList.
|
|
|
|
|
|
|
|
\ingroup qtl
|
|
|
|
\ingroup tools
|
|
|
|
\reentrant
|
|
|
|
|
|
|
|
In contrast to TQValueListIterator, this class is used to iterate
|
|
|
|
over a const list. It does not allow modification of the values of
|
|
|
|
the list since that would break const semantics.
|
|
|
|
|
|
|
|
You can create the appropriate const iterator type by using the \c
|
|
|
|
const_iterator typedef provided by TQValueList.
|
|
|
|
|
|
|
|
For more information on TQValueList iterators, see
|
|
|
|
TQValueListIterator.
|
|
|
|
|
|
|
|
\sa TQValueListIterator, TQValueList
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*! \enum TQValueListConstIterator::value_type
|
|
|
|
The type of value. */
|
|
|
|
/*! \enum TQValueListConstIterator::pointer
|
|
|
|
Pointer to value_type. */
|
|
|
|
/*! \enum TQValueListConstIterator::reference
|
|
|
|
Reference to value_type. */
|
|
|
|
/*! \enum TQValueListConstIterator::NodePtr
|
|
|
|
\internal */
|
|
|
|
/*! \enum TQValueListConstIterator::iterator_category
|
|
|
|
\internal */
|
|
|
|
/*! \enum TQValueListConstIterator::size_type
|
|
|
|
\internal */
|
|
|
|
/*! \enum TQValueListConstIterator::difference_type
|
|
|
|
\internal */
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListConstIterator::TQValueListConstIterator()
|
|
|
|
|
|
|
|
Creates un uninitialized iterator.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListConstIterator::TQValueListConstIterator( NodePtr p )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListConstIterator::TQValueListConstIterator( const TQValueListConstIterator<T>& it )
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Constructs a copy of the iterator \a it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListConstIterator::TQValueListConstIterator( const TQValueListIterator<T>& it )
|
|
|
|
|
|
|
|
Constructs a copy of the iterator \a it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Unfortunately not with MSVC
|
|
|
|
\fn const T *TQValueListConstIterator::operator->()
|
|
|
|
Pointer operator. Returns a pointer to the current iterator item.
|
|
|
|
The great advantage of this operator is that you can treat the
|
|
|
|
iterator like a pointer.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
\code
|
|
|
|
TQValueList<int>::Iterator it = list.begin();
|
|
|
|
for( ; it != end(); ++it )
|
|
|
|
it->show();
|
|
|
|
\endcode
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const T& TQValueListConstIterator::operator*() const
|
|
|
|
|
|
|
|
Asterisk operator. Returns a reference to the current iterator item.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListConstIterator<T>& TQValueListConstIterator::operator++()
|
|
|
|
|
|
|
|
Prefix ++ makes the succeeding item current and returns an
|
|
|
|
iterator pointing to the new current item. The iterator cannot
|
|
|
|
check whether it reached the end of the list. Incrementing the
|
|
|
|
iterator returned by end() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListConstIterator<T> TQValueListConstIterator::operator++(int)
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Postfix ++ makes the succeeding item current and returns an
|
|
|
|
iterator pointing to the new current item. The iterator cannot
|
|
|
|
check whether it reached the end of the list. Incrementing the
|
|
|
|
iterator returned by end() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListConstIterator<T>& TQValueListConstIterator::operator--()
|
|
|
|
|
|
|
|
Prefix -- makes the previous item current and returns an iterator
|
|
|
|
pointing to the new current item. The iterator cannot check
|
|
|
|
whether it reached the beginning of the list. Decrementing the
|
|
|
|
iterator returned by begin() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn TQValueListConstIterator<T> TQValueListConstIterator::operator--(int)
|
|
|
|
|
|
|
|
\overload
|
|
|
|
|
|
|
|
Postfix -- makes the previous item current and returns an iterator
|
|
|
|
pointing to the new current item. The iterator cannot check
|
|
|
|
whether it reached the beginning of the list. Decrementing the
|
|
|
|
iterator returned by begin() causes undefined results.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueListConstIterator::operator==( const TQValueListConstIterator<T>& it ) const
|
|
|
|
|
|
|
|
Compares this iterator with \a it and returns TRUE if they point
|
|
|
|
to the same item; otherwise returns FALSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool TQValueListConstIterator::operator!=( const TQValueListConstIterator<T>& it ) const
|
|
|
|
|
|
|
|
Compares this iterator with \a it and returns TRUE if they point
|
|
|
|
to different items; otherwise returns FALSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\enum TQValueList::Iterator
|
|
|
|
|
|
|
|
This iterator is an instantiation of TQValueListIterator for the
|
|
|
|
same type as this TQValueList. In other words, if you instantiate
|
|
|
|
TQValueList<int>, Iterator is a TQValueListIterator<int>. Several
|
|
|
|
member function use it, such as TQValueList::begin(), which returns
|
|
|
|
an iterator pointing to the first item in the list.
|
|
|
|
|
|
|
|
Functionally, this is almost the same as ConstIterator. The only
|
|
|
|
difference is that you cannot use ConstIterator for non-const
|
|
|
|
operations, and that the compiler can often generate better code
|
|
|
|
if you use ConstIterator.
|
|
|
|
|
|
|
|
\sa TQValueListIterator ConstIterator
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\enum TQValueList::ConstIterator
|
|
|
|
|
|
|
|
This iterator is an instantiation of TQValueListConstIterator for
|
|
|
|
the same type as this TQValueList. In other words, if you
|
|
|
|
instantiate TQValueList<int>, ConstIterator is a
|
|
|
|
TQValueListConstIterator<int>. Several member function use it, such
|
|
|
|
as TQValueList::begin(), which returns an iterator pointing to the
|
|
|
|
first item in the list.
|
|
|
|
|
|
|
|
Functionally, this is almost the same as Iterator. The only
|
|
|
|
difference is you cannot use ConstIterator for non-const
|
|
|
|
operations, and that the compiler can often generate better code
|
|
|
|
if you use ConstIterator.
|
|
|
|
|
|
|
|
\sa TQValueListIterator Iterator
|
|
|
|
*/
|