1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qptrlist.h:1 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>qptrlist.h Include File</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qptrlist.h</h1>
|
---|
33 |
|
---|
34 | <p>This is the verbatim text of the qptrlist.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
35 | <hr>
|
---|
36 | <pre>
|
---|
37 | /****************************************************************************
|
---|
38 | ** $Id: qptrlist-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
39 | **
|
---|
40 | ** Definition of QPtrList template/macro class
|
---|
41 | **
|
---|
42 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
43 | **
|
---|
44 | ** This file is part of the tools module of the Qt GUI Toolkit.
|
---|
45 | **
|
---|
46 | ** This file may be distributed under the terms of the Q Public License
|
---|
47 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
48 | ** LICENSE.QPL included in the packaging of this file.
|
---|
49 | **
|
---|
50 | ** This file may be distributed and/or modified under the terms of the
|
---|
51 | ** GNU General Public License version 2 as published by the Free Software
|
---|
52 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
53 | ** packaging of this file.
|
---|
54 | **
|
---|
55 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
56 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
57 | ** Agreement provided with the Software.
|
---|
58 | **
|
---|
59 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
60 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
61 | **
|
---|
62 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
63 | ** information about Qt Commercial License Agreements.
|
---|
64 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
65 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
66 | **
|
---|
67 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
68 | ** not clear to you.
|
---|
69 | **
|
---|
70 | **********************************************************************/
|
---|
71 |
|
---|
72 | #ifndef QPTRLIST_H
|
---|
73 | #define QPTRLIST_H
|
---|
74 |
|
---|
75 | #ifndef QT_H
|
---|
76 | #include "qglist.h"
|
---|
77 | #endif // QT_H
|
---|
78 |
|
---|
79 | template<class type>
|
---|
80 | class QPtrListStdIterator : public QGListStdIterator
|
---|
81 | {
|
---|
82 | public:
|
---|
83 | inline QPtrListStdIterator( QLNode* n ): QGListStdIterator(n) {}
|
---|
84 | type *operator*() { return node ? (type *)node->getData() : 0; }
|
---|
85 | inline QPtrListStdIterator<type> operator++()
|
---|
86 | { node = next(); return *this; }
|
---|
87 | inline QPtrListStdIterator<type> operator++(int)
|
---|
88 | { QLNode* n = node; node = next(); return QPtrListStdIterator<type>( n ); }
|
---|
89 | inline bool operator==( const QPtrListStdIterator<type>& it ) const { return node == it.node; }
|
---|
90 | inline bool operator!=( const QPtrListStdIterator<type>& it ) const { return node != it.node; }
|
---|
91 | };
|
---|
92 |
|
---|
93 |
|
---|
94 | template<class type>
|
---|
95 | class QPtrList
|
---|
96 | #ifdef Q_QDOC
|
---|
97 | : public QPtrCollection
|
---|
98 | #else
|
---|
99 | : public QGList
|
---|
100 | #endif
|
---|
101 | {
|
---|
102 | public:
|
---|
103 |
|
---|
104 | QPtrList() {}
|
---|
105 | QPtrList( const QPtrList<type> &l ) : QGList(l) {}
|
---|
106 | ~QPtrList() { clear(); }
|
---|
107 | QPtrList<type> &operator=(const QPtrList<type> &l)
|
---|
108 | { return (QPtrList<type>&)QGList::operator=(l); }
|
---|
109 | bool operator==( const QPtrList<type> &list ) const
|
---|
110 | { return QGList::operator==( list ); }
|
---|
111 | bool operator!=( const QPtrList<type> &list ) const
|
---|
112 | { return !QGList::operator==( list ); }
|
---|
113 | uint count() const { return QGList::count(); }
|
---|
114 | bool isEmpty() const { return QGList::count() == 0; }
|
---|
115 | bool insert( uint i, const type *d){ return QGList::insertAt(i,(QPtrCollection::Item)d); }
|
---|
116 | void inSort( const type *d ) { QGList::inSort((QPtrCollection::Item)d); }
|
---|
117 | void prepend( const type *d ) { QGList::insertAt(0,(QPtrCollection::Item)d); }
|
---|
118 | void append( const type *d ) { QGList::append((QPtrCollection::Item)d); }
|
---|
119 | bool remove( uint i ) { return QGList::removeAt(i); }
|
---|
120 | bool remove() { return QGList::remove((QPtrCollection::Item)0); }
|
---|
121 | bool remove( const type *d ) { return QGList::remove((QPtrCollection::Item)d); }
|
---|
122 | bool removeRef( const type *d ) { return QGList::removeRef((QPtrCollection::Item)d); }
|
---|
123 | void removeNode( QLNode *n ) { QGList::removeNode(n); }
|
---|
124 | bool removeFirst() { return QGList::removeFirst(); }
|
---|
125 | bool removeLast() { return QGList::removeLast(); }
|
---|
126 | type *take( uint i ) { return (type *)QGList::takeAt(i); }
|
---|
127 | type *take() { return (type *)QGList::take(); }
|
---|
128 | type *takeNode( QLNode *n ) { return (type *)QGList::takeNode(n); }
|
---|
129 | void clear() { QGList::clear(); }
|
---|
130 | void sort() { QGList::sort(); }
|
---|
131 | int find( const type *d ) { return QGList::find((QPtrCollection::Item)d); }
|
---|
132 | int findNext( const type *d ) { return QGList::find((QPtrCollection::Item)d,FALSE); }
|
---|
133 | int findRef( const type *d ) { return QGList::findRef((QPtrCollection::Item)d); }
|
---|
134 | int findNextRef( const type *d ){ return QGList::findRef((QPtrCollection::Item)d,FALSE);}
|
---|
135 | uint contains( const type *d ) const { return QGList::contains((QPtrCollection::Item)d); }
|
---|
136 | uint containsRef( const type *d ) const
|
---|
137 | { return QGList::containsRef((QPtrCollection::Item)d); }
|
---|
138 | bool replace( uint i, const type *d ) { return QGList::replaceAt( i, (QPtrCollection::Item)d ); }
|
---|
139 | type *at( uint i ) { return (type *)QGList::at(i); }
|
---|
140 | int at() const { return QGList::at(); }
|
---|
141 | type *current() const { return (type *)QGList::get(); }
|
---|
142 | QLNode *currentNode() const { return QGList::currentNode(); }
|
---|
143 | type *getFirst() const { return (type *)QGList::cfirst(); }
|
---|
144 | type *getLast() const { return (type *)QGList::clast(); }
|
---|
145 | type *first() { return (type *)QGList::first(); }
|
---|
146 | type *last() { return (type *)QGList::last(); }
|
---|
147 | type *next() { return (type *)QGList::next(); }
|
---|
148 | type *prev() { return (type *)QGList::prev(); }
|
---|
149 | void toVector( QGVector *vec )const{ QGList::toVector(vec); }
|
---|
150 |
|
---|
151 |
|
---|
152 | // standard iterators
|
---|
153 | typedef QPtrListStdIterator<type> Iterator;
|
---|
154 | typedef QPtrListStdIterator<type> ConstIterator;
|
---|
155 | inline Iterator begin() { return QGList::begin(); }
|
---|
156 | inline ConstIterator begin() const { return QGList::begin(); }
|
---|
157 | inline ConstIterator constBegin() const { return QGList::begin(); }
|
---|
158 | inline Iterator end() { return QGList::end(); }
|
---|
159 | inline ConstIterator end() const { return QGList::end(); }
|
---|
160 | inline ConstIterator constEnd() const { return QGList::end(); }
|
---|
161 | inline Iterator erase( Iterator it ) { return QGList::erase( it ); }
|
---|
162 | // stl syntax compatibility
|
---|
163 | typedef Iterator iterator;
|
---|
164 | typedef ConstIterator const_iterator;
|
---|
165 |
|
---|
166 |
|
---|
167 | #ifdef Q_QDOC
|
---|
168 | protected:
|
---|
169 | virtual int compareItems( QPtrCollection::Item, QPtrCollection::Item );
|
---|
170 | virtual QDataStream& read( QDataStream&, QPtrCollection::Item& );
|
---|
171 | virtual QDataStream& write( QDataStream&, QPtrCollection::Item ) const;
|
---|
172 | #endif
|
---|
173 |
|
---|
174 | private:
|
---|
175 | void deleteItem( Item d );
|
---|
176 | };
|
---|
177 |
|
---|
178 | #if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION)
|
---|
179 | template<> inline void QPtrList<void>::deleteItem( QPtrCollection::Item )
|
---|
180 | {
|
---|
181 | }
|
---|
182 | #endif
|
---|
183 |
|
---|
184 | template<class type> inline void QPtrList<type>::deleteItem( QPtrCollection::Item d )
|
---|
185 | {
|
---|
186 | if ( del_item ) delete (type *)d;
|
---|
187 | }
|
---|
188 |
|
---|
189 | template<class type>
|
---|
190 | class QPtrListIterator : public QGListIterator
|
---|
191 | {
|
---|
192 | public:
|
---|
193 | QPtrListIterator(const QPtrList<type> &l) :QGListIterator((QGList &)l) {}
|
---|
194 | ~QPtrListIterator() {}
|
---|
195 | uint count() const { return list->count(); }
|
---|
196 | bool isEmpty() const { return list->count() == 0; }
|
---|
197 | bool atFirst() const { return QGListIterator::atFirst(); }
|
---|
198 | bool atLast() const { return QGListIterator::atLast(); }
|
---|
199 | type *toFirst() { return (type *)QGListIterator::toFirst(); }
|
---|
200 | type *toLast() { return (type *)QGListIterator::toLast(); }
|
---|
201 | operator type *() const { return (type *)QGListIterator::get(); }
|
---|
202 | type *operator*() { return (type *)QGListIterator::get(); }
|
---|
203 |
|
---|
204 | // No good, since QPtrList<char> (ie. QStrList fails...
|
---|
205 | //
|
---|
206 | // MSVC++ gives warning
|
---|
207 | // Sunpro C++ 4.1 gives error
|
---|
208 | // type *operator->() { return (type *)QGListIterator::get(); }
|
---|
209 |
|
---|
210 | type *current() const { return (type *)QGListIterator::get(); }
|
---|
211 | type *operator()() { return (type *)QGListIterator::operator()();}
|
---|
212 | type *operator++() { return (type *)QGListIterator::operator++(); }
|
---|
213 | type *operator+=(uint j) { return (type *)QGListIterator::operator+=(j);}
|
---|
214 | type *operator--() { return (type *)QGListIterator::operator--(); }
|
---|
215 | type *operator-=(uint j) { return (type *)QGListIterator::operator-=(j);}
|
---|
216 | QPtrListIterator<type>& operator=(const QPtrListIterator<type>&it)
|
---|
217 | { QGListIterator::operator=(it); return *this; }
|
---|
218 | };
|
---|
219 |
|
---|
220 | #ifndef QT_NO_COMPAT
|
---|
221 | #define QList QPtrList
|
---|
222 | #define QListIterator QPtrListIterator
|
---|
223 | #endif
|
---|
224 |
|
---|
225 | #define Q_DEFINED_QPTRLIST
|
---|
226 | #include "qwinexport.h"
|
---|
227 |
|
---|
228 | #endif // QPTRLIST_H
|
---|
229 | </pre>
|
---|
230 | <!-- eof -->
|
---|
231 | <p><address><hr><div align=center>
|
---|
232 | <table width=100% cellspacing=0 border=0><tr>
|
---|
233 | <td>Copyright © 2007
|
---|
234 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
235 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
236 | </table></div></address></body>
|
---|
237 | </html>
|
---|