qinternallist.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 **
4 ** Definition of QList template/macro class
5 **
6 ** Created : 920701
7 **
8 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9 **
10 ** This file is part of the tools module of the Qt GUI Toolkit.
11 **
12 ** This file may be distributed under the terms of the Q Public License
13 ** as defined by Trolltech AS of Norway and appearing in the file
14 ** LICENSE.QPL included in the packaging of this file.
15 **
16 ** This file may be distributed and/or modified under the terms of the
17 ** GNU General Public License version 2 as published by the Free Software
18 ** Foundation and appearing in the file LICENSE.GPL included in the
19 ** packaging of this file.
20 **
21 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22 ** licenses may use this file in accordance with the Qt Commercial License
23 ** Agreement provided with the Software.
24 **
25 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27 **
28 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29 ** information about Qt Commercial License Agreements.
30 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
31 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
32 **
33 ** Contact info@trolltech.com if any conditions of this licensing are
34 ** not clear to you.
35 **
36 **********************************************************************/
37 
38 #ifndef QINTERNALLIST_H
39 #define QINTERNALLIST_H
40 
41 #ifndef QT_H
42 #include "qglist.h"
43 #endif // QT_H
44 
45 
46 template<class type> class Q_EXPORT QInternalList : public QGList
47 {
48 public:
53  { return (QInternalList<type>&)QGList::operator=(l); }
54  bool operator==( const QInternalList<type> &list ) const
55  { return QGList::operator==( list ); }
56  uint count() const { return QGList::count(); }
57  bool isEmpty() const { return QGList::count() == 0; }
58  bool insert( uint i, const type *d){ return QGList::insertAt(i,(QCollection::Item)d); }
59  void inSort( const type *d ) { QGList::inSort((QCollection::Item)d); }
60  void prepend( const type *d ) { QGList::insertAt(0,(QCollection::Item)d); }
61  void append( const type *d ) { QGList::append((QCollection::Item)d); }
62  bool remove( uint i ) { return QGList::removeAt(i); }
63  bool remove() { return QGList::remove((QCollection::Item)0); }
64  bool remove( const type *d ) { return QGList::remove((QCollection::Item)d); }
65  bool removeRef( const type *d ) { return QGList::removeRef((QCollection::Item)d); }
67  bool removeFirst() { return QGList::removeFirst(); }
68  bool removeLast() { return QGList::removeLast(); }
69  type *take( uint i ) { return (type *)QGList::takeAt(i); }
70  type *take() { return (type *)QGList::take(); }
71  type *takeNode( QLNode *n ) { return (type *)QGList::takeNode(n); }
72  void clear() { QGList::clear(); }
73  void sort() { QGList::sort(); }
74  int find( const type *d ) { return QGList::find((QCollection::Item)d); }
75  int findNext( const type *d ) { return QGList::find((QCollection::Item)d,FALSE); }
76  int findRef( const type *d ) { return QGList::findRef((QCollection::Item)d); }
78  uint contains( const type *d ) const { return QGList::contains((QCollection::Item)d); }
79  uint containsRef( const type *d ) const
81  type *at( uint i ) { return (type *)QGList::at(i); }
82  int at() const { return QGList::at(); }
83  type *current() const { return (type *)QGList::get(); }
84  QLNode *currentNode() const { return QGList::currentNode(); }
85  type *getFirst() const { return (type *)QGList::cfirst(); }
86  type *getLast() const { return (type *)QGList::clast(); }
87  type *first() { return (type *)QGList::first(); }
88  type *last() { return (type *)QGList::last(); }
89  type *next() { return (type *)QGList::next(); }
90  type *prev() { return (type *)QGList::prev(); }
91  void toVector( QGVector *vec )const{ QGList::toVector(vec); }
92 private:
94 };
95 
96 #if defined(Q_DELETING_VOID_UNDEFINED)
98 {
99 }
100 #endif
101 
102 template<class type> inline void QInternalList<type>::deleteItem( QCollection::Item d )
103 {
104  if ( del_item ) delete (type *)d;
105 }
106 
107 
108 template<class type> class Q_EXPORT QInternalListIterator : public QGListIterator
109 {
110 public:
113  uint count() const { return list->count(); }
114  bool isEmpty() const { return list->count() == 0; }
115  bool atFirst() const { return QGListIterator::atFirst(); }
116  bool atLast() const { return QGListIterator::atLast(); }
119  operator type *() const { return (type *)QGListIterator::get(); }
121 
122  // No good, since QList<char> (ie. QStrList fails...
123  //
124  // MSVC++ gives warning
125  // Sunpro C++ 4.1 gives error
126  // type *operator->() { return (type *)QGListIterator::get(); }
127 
128  type *current() const { return (type *)QGListIterator::get(); }
135  { QGListIterator::operator=(it); return *this; }
136 };
137 
138 
139 #endif // QINTERNALLIST_H
QInternalList(const QInternalList< type > &l)
Definition: qinternallist.h:50
uint contains(QCollection::Item) const
Definition: qglist.cpp:751
QCollection::Item operator++()
Definition: qglist.cpp:1180
void append(QCollection::Item)
Definition: qglist.cpp:364
type * getFirst() const
Definition: qinternallist.h:85
QCollection::Item get() const
Definition: qglist.h:183
bool removeAt(uint index)
Definition: qglist.cpp:554
bool removeNode(QLNode *)
Definition: qglist.cpp:481
int findNextRef(const type *d)
Definition: qinternallist.h:77
type * first()
Definition: qinternallist.h:87
QCollection::Item take()
Definition: qglist.cpp:595
QCollection::Item operator-=(uint)
Definition: qglist.cpp:1218
void toVector(QGVector *vec) const
Definition: qinternallist.h:91
QCollection::Item get() const
Definition: qglist.h:251
const bool FALSE
Definition: qglobal.h:370
int findRef(const type *d)
Definition: qinternallist.h:76
QCollection::Item prev()
Definition: qglist.cpp:854
QInternalListIterator(const QInternalList< type > &l)
int find(const type *d)
Definition: qinternallist.h:74
static QStrList * l
Definition: config.cpp:1044
void prepend(const type *d)
Definition: qinternallist.h:60
uint containsRef(QCollection::Item) const
Definition: qglist.cpp:734
QInternalList< type > & operator=(const QInternalList< type > &l)
Definition: qinternallist.h:52
bool removeRef(const type *d)
Definition: qinternallist.h:65
void deleteItem(QCollection::Item d)
bool removeRef(QCollection::Item=0)
Definition: qglist.cpp:523
QLNode * currentNode() const
Definition: qinternallist.h:84
QCollection::Item first()
Definition: qglist.cpp:807
type * current() const
Definition: qinternallist.h:83
uint contains(const type *d) const
Definition: qinternallist.h:78
uint count() const
Definition: qglist.h:150
type * operator-=(uint j)
type * current() const
QCollection::Item takeNode(QLNode *)
Definition: qglist.cpp:572
bool removeLast()
Definition: qglist.h:161
QCollection::Item operator()()
Definition: qglist.cpp:1166
type * take(uint i)
Definition: qinternallist.h:69
int at() const
Definition: qglist.h:167
QGListIterator & operator=(const QGListIterator &)
Definition: qglist.cpp:1085
type * take()
Definition: qinternallist.h:70
std::void_t< T > n
type * prev()
Definition: qinternallist.h:90
The QGList class is an internal class for implementing Qt collection classes.
Definition: qglist.h:68
bool insert(uint i, const type *d)
Definition: qinternallist.h:58
The QGVector class is an internal class for implementing Qt collection classes.
Definition: qgvector.h:46
void inSort(const type *d)
Definition: qinternallist.h:59
void append(const type *d)
Definition: qinternallist.h:61
QCollection::Item clast() const
Definition: qglist.h:193
bool isEmpty() const
bool removeFirst()
Definition: qinternallist.h:67
bool atFirst() const
Definition: qglist.h:241
QCollection::Item toLast()
Definition: qglist.cpp:1142
type * next()
Definition: qinternallist.h:89
void toVector(QGVector *) const
Definition: qglist.cpp:874
void sort()
Definition: qglist.cpp:934
int findRef(QCollection::Item, bool=TRUE)
Definition: qglist.cpp:683
bool atLast() const
bool operator==(const QInternalList< type > &list) const
Definition: qinternallist.h:54
type * operator+=(uint j)
uint containsRef(const type *d) const
Definition: qinternallist.h:79
bool remove(QCollection::Item=0)
Definition: qglist.cpp:504
bool isEmpty() const
Definition: qinternallist.h:57
QCollection::Item next()
Definition: qglist.cpp:835
bool atLast() const
Definition: qglist.h:246
QCollection::Item operator--()
Definition: qglist.cpp:1205
int at() const
Definition: qinternallist.h:82
type * getLast() const
Definition: qinternallist.h:86
QCollection::Item operator+=(uint)
Definition: qglist.cpp:1193
bool removeFirst()
Definition: qglist.h:155
QCollection::Item cfirst() const
Definition: qglist.h:188
int findNext(const type *d)
Definition: qinternallist.h:75
type * at(uint i)
Definition: qinternallist.h:81
virtual void deleteItem(Item)
QLNode * currentNode() const
Definition: qglist.h:178
uint count() const
Definition: qinternallist.h:56
void clear()
Definition: qglist.cpp:652
type * last()
Definition: qinternallist.h:88
bool operator==(const QGList &) const
Definition: qglist.cpp:242
QCollection::Item last()
Definition: qglist.cpp:821
void inSort(QCollection::Item)
Definition: qglist.cpp:327
unsigned uint
Definition: qglobal.h:351
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
The QGListIterator class is an internal class for implementing QListIterator.
Definition: qglist.h:212
type * takeNode(QLNode *n)
Definition: qinternallist.h:71
bool removeLast()
Definition: qinternallist.h:68
QGList & operator=(const QGList &)
Definition: qglist.cpp:222
QInternalListIterator< type > & operator=(const QInternalListIterator< type > &it)
#define Q_EXPORT
Definition: qglobal.h:468
QCollection::Item toFirst()
Definition: qglist.cpp:1126
QCollection::Item takeAt(uint index)
Definition: qglist.cpp:608
bool atFirst() const
bool insertAt(uint index, QCollection::Item)
Definition: qglist.cpp:384
void * Item
Definition: qcollection.h:60
void removeNode(QLNode *n)
Definition: qinternallist.h:66
int find(QCollection::Item, bool=TRUE)
Definition: qglist.cpp:708