|
Packit Service |
50c9f2 |
/****************************************************************************
|
|
Packit Service |
50c9f2 |
**
|
|
Packit Service |
50c9f2 |
**
|
|
Packit Service |
50c9f2 |
** Definition of QList template/macro class
|
|
Packit Service |
50c9f2 |
**
|
|
Packit Service |
50c9f2 |
** Created : 920701
|
|
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 tools module 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 |
#ifndef QINTERNALLIST_H
|
|
Packit Service |
50c9f2 |
#define QINTERNALLIST_H
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
#ifndef QT_H
|
|
Packit Service |
50c9f2 |
#include "qglist.h"
|
|
Packit Service |
50c9f2 |
#endif // QT_H
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
template<class type> class Q_EXPORT QInternalList : public QGList
|
|
Packit Service |
50c9f2 |
{
|
|
Packit Service |
50c9f2 |
public:
|
|
Packit Service |
50c9f2 |
QInternalList() {}
|
|
Packit Service |
50c9f2 |
QInternalList( const QInternalList<type> &l ) : QGList(l) {}
|
|
Packit Service |
50c9f2 |
~QInternalList() { clear(); }
|
|
Packit Service |
50c9f2 |
QInternalList<type> &operator=(const QInternalList<type> &l)
|
|
Packit Service |
50c9f2 |
{ return (QInternalList<type>&)QGList::operator=(l); }
|
|
Packit Service |
50c9f2 |
bool operator==( const QInternalList<type> &list ) const
|
|
Packit Service |
50c9f2 |
{ return QGList::operator==( list ); }
|
|
Packit Service |
50c9f2 |
uint count() const { return QGList::count(); }
|
|
Packit Service |
50c9f2 |
bool isEmpty() const { return QGList::count() == 0; }
|
|
Packit Service |
50c9f2 |
bool insert( uint i, const type *d){ return QGList::insertAt(i,(QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
void inSort( const type *d ) { QGList::inSort((QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
void prepend( const type *d ) { QGList::insertAt(0,(QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
void append( const type *d ) { QGList::append((QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
bool remove( uint i ) { return QGList::removeAt(i); }
|
|
Packit Service |
50c9f2 |
bool remove() { return QGList::remove((QCollection::Item)0); }
|
|
Packit Service |
50c9f2 |
bool remove( const type *d ) { return QGList::remove((QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
bool removeRef( const type *d ) { return QGList::removeRef((QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
void removeNode( QLNode *n ) { QGList::removeNode(n); }
|
|
Packit Service |
50c9f2 |
bool removeFirst() { return QGList::removeFirst(); }
|
|
Packit Service |
50c9f2 |
bool removeLast() { return QGList::removeLast(); }
|
|
Packit Service |
50c9f2 |
type *take( uint i ) { return (type *)QGList::takeAt(i); }
|
|
Packit Service |
50c9f2 |
type *take() { return (type *)QGList::take(); }
|
|
Packit Service |
50c9f2 |
type *takeNode( QLNode *n ) { return (type *)QGList::takeNode(n); }
|
|
Packit Service |
50c9f2 |
void clear() { QGList::clear(); }
|
|
Packit Service |
50c9f2 |
void sort() { QGList::sort(); }
|
|
Packit Service |
50c9f2 |
int find( const type *d ) { return QGList::find((QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
int findNext( const type *d ) { return QGList::find((QCollection::Item)d,FALSE); }
|
|
Packit Service |
50c9f2 |
int findRef( const type *d ) { return QGList::findRef((QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
int findNextRef( const type *d ){ return QGList::findRef((QCollection::Item)d,FALSE);}
|
|
Packit Service |
50c9f2 |
uint contains( const type *d ) const { return QGList::contains((QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
uint containsRef( const type *d ) const
|
|
Packit Service |
50c9f2 |
{ return QGList::containsRef((QCollection::Item)d); }
|
|
Packit Service |
50c9f2 |
type *at( uint i ) { return (type *)QGList::at(i); }
|
|
Packit Service |
50c9f2 |
int at() const { return QGList::at(); }
|
|
Packit Service |
50c9f2 |
type *current() const { return (type *)QGList::get(); }
|
|
Packit Service |
50c9f2 |
QLNode *currentNode() const { return QGList::currentNode(); }
|
|
Packit Service |
50c9f2 |
type *getFirst() const { return (type *)QGList::cfirst(); }
|
|
Packit Service |
50c9f2 |
type *getLast() const { return (type *)QGList::clast(); }
|
|
Packit Service |
50c9f2 |
type *first() { return (type *)QGList::first(); }
|
|
Packit Service |
50c9f2 |
type *last() { return (type *)QGList::last(); }
|
|
Packit Service |
50c9f2 |
type *next() { return (type *)QGList::next(); }
|
|
Packit Service |
50c9f2 |
type *prev() { return (type *)QGList::prev(); }
|
|
Packit Service |
50c9f2 |
void toVector( QGVector *vec )const{ QGList::toVector(vec); }
|
|
Packit Service |
50c9f2 |
private:
|
|
Packit Service |
50c9f2 |
void deleteItem( QCollection::Item d );
|
|
Packit Service |
50c9f2 |
};
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
#if defined(Q_DELETING_VOID_UNDEFINED)
|
|
Packit Service |
50c9f2 |
template<> inline void QInternalList<void>::deleteItem( QCollection::Item )
|
|
Packit Service |
50c9f2 |
{
|
|
Packit Service |
50c9f2 |
}
|
|
Packit Service |
50c9f2 |
#endif
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
template<class type> inline void QInternalList<type>::deleteItem( QCollection::Item d )
|
|
Packit Service |
50c9f2 |
{
|
|
Packit Service |
50c9f2 |
if ( del_item ) delete (type *)d;
|
|
Packit Service |
50c9f2 |
}
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
template<class type> class Q_EXPORT QInternalListIterator : public QGListIterator
|
|
Packit Service |
50c9f2 |
{
|
|
Packit Service |
50c9f2 |
public:
|
|
Packit Service |
50c9f2 |
QInternalListIterator(const QInternalList<type> &l) :QGListIterator((QGList &)l) {}
|
|
Packit Service |
50c9f2 |
~QInternalListIterator() {}
|
|
Packit Service |
50c9f2 |
uint count() const { return list->count(); }
|
|
Packit Service |
50c9f2 |
bool isEmpty() const { return list->count() == 0; }
|
|
Packit Service |
50c9f2 |
bool atFirst() const { return QGListIterator::atFirst(); }
|
|
Packit Service |
50c9f2 |
bool atLast() const { return QGListIterator::atLast(); }
|
|
Packit Service |
50c9f2 |
type *toFirst() { return (type *)QGListIterator::toFirst(); }
|
|
Packit Service |
50c9f2 |
type *toLast() { return (type *)QGListIterator::toLast(); }
|
|
Packit Service |
50c9f2 |
operator type *() const { return (type *)QGListIterator::get(); }
|
|
Packit Service |
50c9f2 |
type *operator*() { return (type *)QGListIterator::get(); }
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
// No good, since QList<char> (ie. QStrList fails...
|
|
Packit Service |
50c9f2 |
//
|
|
Packit Service |
50c9f2 |
// MSVC++ gives warning
|
|
Packit Service |
50c9f2 |
// Sunpro C++ 4.1 gives error
|
|
Packit Service |
50c9f2 |
// type *operator->() { return (type *)QGListIterator::get(); }
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
type *current() const { return (type *)QGListIterator::get(); }
|
|
Packit Service |
50c9f2 |
type *operator()() { return (type *)QGListIterator::operator()();}
|
|
Packit Service |
50c9f2 |
type *operator++() { return (type *)QGListIterator::operator++(); }
|
|
Packit Service |
50c9f2 |
type *operator+=(uint j) { return (type *)QGListIterator::operator+=(j);}
|
|
Packit Service |
50c9f2 |
type *operator--() { return (type *)QGListIterator::operator--(); }
|
|
Packit Service |
50c9f2 |
type *operator-=(uint j) { return (type *)QGListIterator::operator-=(j);}
|
|
Packit Service |
50c9f2 |
QInternalListIterator<type>& operator=(const QInternalListIterator<type>&it)
|
|
Packit Service |
50c9f2 |
{ QGListIterator::operator=(it); return *this; }
|
|
Packit Service |
50c9f2 |
};
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
|
|
Packit Service |
50c9f2 |
#endif // QINTERNALLIST_H
|