author | kergoth <kergoth> | 2002-11-01 00:10:42 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-11-01 00:10:42 (UTC) |
commit | 5042e3cf0d3514552769e441f5aad590c8eaf967 (patch) (unidiff) | |
tree | 4a5ea45f3519d981a172ab5275bf38c6fa778dec /qmake/include/qptrlist.h | |
parent | 108c1c753e74e989cc13923086996791428c9af4 (diff) | |
download | opie-5042e3cf0d3514552769e441f5aad590c8eaf967.zip opie-5042e3cf0d3514552769e441f5aad590c8eaf967.tar.gz opie-5042e3cf0d3514552769e441f5aad590c8eaf967.tar.bz2 |
Adding qmake in preperation for new build system
-rw-r--r-- | qmake/include/qptrlist.h | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/qmake/include/qptrlist.h b/qmake/include/qptrlist.h new file mode 100644 index 0000000..53fb605 --- a/dev/null +++ b/qmake/include/qptrlist.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Definition of QPtrList template/macro class | ||
5 | ** | ||
6 | ** Created : | ||
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 QPTRLIST_H | ||
39 | #define QPTRLIST_H | ||
40 | |||
41 | #ifndef QT_H | ||
42 | #include "qglist.h" | ||
43 | #endif // QT_H | ||
44 | |||
45 | |||
46 | template<class type> | ||
47 | class QPtrList | ||
48 | #ifdef Q_QDOC | ||
49 | : public QPtrCollection | ||
50 | #else | ||
51 | : public QGList | ||
52 | #endif | ||
53 | { | ||
54 | public: | ||
55 | QPtrList() {} | ||
56 | QPtrList( const QPtrList<type> &l ) : QGList(l) {} | ||
57 | ~QPtrList() { clear(); } | ||
58 | QPtrList<type> &operator=(const QPtrList<type> &l) | ||
59 | { return (QPtrList<type>&)QGList::operator=(l); } | ||
60 | bool operator==( const QPtrList<type> &list ) const | ||
61 | { return QGList::operator==( list ); } | ||
62 | bool operator!=( const QPtrList<type> &list ) const | ||
63 | { return !QGList::operator==( list ); } | ||
64 | uint count() const { return QGList::count(); } | ||
65 | bool isEmpty() const { return QGList::count() == 0; } | ||
66 | bool insert( uint i, const type *d){ return QGList::insertAt(i,(QPtrCollection::Item)d); } | ||
67 | void inSort( const type *d ){ QGList::inSort((QPtrCollection::Item)d); } | ||
68 | void prepend( const type *d ){ QGList::insertAt(0,(QPtrCollection::Item)d); } | ||
69 | void append( const type *d ){ QGList::append((QPtrCollection::Item)d); } | ||
70 | bool remove( uint i ) { return QGList::removeAt(i); } | ||
71 | bool remove() { return QGList::remove((QPtrCollection::Item)0); } | ||
72 | bool remove( const type *d ){ return QGList::remove((QPtrCollection::Item)d); } | ||
73 | bool removeRef( const type *d ){ return QGList::removeRef((QPtrCollection::Item)d); } | ||
74 | void removeNode( QLNode *n ){ QGList::removeNode(n); } | ||
75 | bool removeFirst() { return QGList::removeFirst(); } | ||
76 | bool removeLast() { return QGList::removeLast(); } | ||
77 | type *take( uint i ) { return (type *)QGList::takeAt(i); } | ||
78 | type *take() { return (type *)QGList::take(); } | ||
79 | type *takeNode( QLNode *n ) { return (type *)QGList::takeNode(n); } | ||
80 | void clear() { QGList::clear(); } | ||
81 | void sort() { QGList::sort(); } | ||
82 | int find( const type *d ) { return QGList::find((QPtrCollection::Item)d); } | ||
83 | int findNext( const type *d ){ return QGList::find((QPtrCollection::Item)d,FALSE); } | ||
84 | int findRef( const type *d ){ return QGList::findRef((QPtrCollection::Item)d); } | ||
85 | int findNextRef( const type *d ){ return QGList::findRef((QPtrCollection::Item)d,FALSE);} | ||
86 | uint contains( const type *d ) const { return QGList::contains((QPtrCollection::Item)d); } | ||
87 | uint containsRef( const type *d ) const | ||
88 | { return QGList::containsRef((QPtrCollection::Item)d); } | ||
89 | bool replace( uint i, const type *d ) { return QGList::replaceAt( i, (QPtrCollection::Item)d ); } | ||
90 | type *at( uint i ) { return (type *)QGList::at(i); } | ||
91 | int at() const { return QGList::at(); } | ||
92 | type *current() const { return (type *)QGList::get(); } | ||
93 | QLNode *currentNode() const{ return QGList::currentNode(); } | ||
94 | type *getFirst() const { return (type *)QGList::cfirst(); } | ||
95 | type *getLast() const { return (type *)QGList::clast(); } | ||
96 | type *first() { return (type *)QGList::first(); } | ||
97 | type *last() { return (type *)QGList::last(); } | ||
98 | type *next() { return (type *)QGList::next(); } | ||
99 | type *prev() { return (type *)QGList::prev(); } | ||
100 | void toVector( QGVector *vec )const{ QGList::toVector(vec); } | ||
101 | |||
102 | #ifdef Q_QDOC | ||
103 | protected: | ||
104 | virtual int compareItems( QPtrCollection::Item, QPtrCollection::Item ); | ||
105 | virtual QDataStream& read( QDataStream&, QPtrCollection::Item& ); | ||
106 | virtual QDataStream& write( QDataStream&, QPtrCollection::Item ) const; | ||
107 | #endif | ||
108 | |||
109 | private: | ||
110 | void deleteItem( Item d ); | ||
111 | }; | ||
112 | |||
113 | #if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) | ||
114 | template<> inline void QPtrList<void>::deleteItem( QPtrCollection::Item ) | ||
115 | { | ||
116 | } | ||
117 | #endif | ||
118 | |||
119 | template<class type> inline void QPtrList<type>::deleteItem( QPtrCollection::Item d ) | ||
120 | { | ||
121 | if ( del_item ) delete (type *)d; | ||
122 | } | ||
123 | |||
124 | template<class type> | ||
125 | class QPtrListIterator : public QGListIterator | ||
126 | { | ||
127 | public: | ||
128 | QPtrListIterator(const QPtrList<type> &l) :QGListIterator((QGList &)l) {} | ||
129 | ~QPtrListIterator() {} | ||
130 | uint count() const { return list->count(); } | ||
131 | bool isEmpty() const { return list->count() == 0; } | ||
132 | bool atFirst() const { return QGListIterator::atFirst(); } | ||
133 | bool atLast() const { return QGListIterator::atLast(); } | ||
134 | type *toFirst() { return (type *)QGListIterator::toFirst(); } | ||
135 | type *toLast() { return (type *)QGListIterator::toLast(); } | ||
136 | operator type *() const { return (type *)QGListIterator::get(); } | ||
137 | type *operator*() { return (type *)QGListIterator::get(); } | ||
138 | |||
139 | // No good, since QPtrList<char> (ie. QStrList fails... | ||
140 | // | ||
141 | // MSVC++ gives warning | ||
142 | // Sunpro C++ 4.1 gives error | ||
143 | // type *operator->() { return (type *)QGListIterator::get(); } | ||
144 | |||
145 | type *current() const { return (type *)QGListIterator::get(); } | ||
146 | type *operator()() { return (type *)QGListIterator::operator()();} | ||
147 | type *operator++() { return (type *)QGListIterator::operator++(); } | ||
148 | type *operator+=(uint j) { return (type *)QGListIterator::operator+=(j);} | ||
149 | type *operator--() { return (type *)QGListIterator::operator--(); } | ||
150 | type *operator-=(uint j) { return (type *)QGListIterator::operator-=(j);} | ||
151 | QPtrListIterator<type>& operator=(const QPtrListIterator<type>&it) | ||
152 | { QGListIterator::operator=(it); return *this; } | ||
153 | }; | ||
154 | |||
155 | #ifndef QT_NO_COMPAT | ||
156 | #define QList QPtrList | ||
157 | #define QListIterator QPtrListIterator | ||
158 | #endif | ||
159 | |||
160 | #endif // QPTRLIST_H | ||