source: trunk/doc/html/qptrlist-h.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 10.2 KB
Line 
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"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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
79template&lt;class type&gt;
80class QPtrListStdIterator : public QGListStdIterator
81{
82public:
83 inline QPtrListStdIterator( QLNode* n ): QGListStdIterator(n) {}
84 type *operator*() { return node ? (type *)node-&gt;getData() : 0; }
85 inline QPtrListStdIterator&lt;type&gt; operator++()
86 { node = next(); return *this; }
87 inline QPtrListStdIterator&lt;type&gt; operator++(int)
88 { QLNode* n = node; node = next(); return QPtrListStdIterator&lt;type&gt;( n ); }
89 inline bool operator==( const QPtrListStdIterator&lt;type&gt;&amp; it ) const { return node == it.node; }
90 inline bool operator!=( const QPtrListStdIterator&lt;type&gt;&amp; it ) const { return node != it.node; }
91};
92
93
94template&lt;class type&gt;
95class QPtrList
96#ifdef Q_QDOC
97 : public QPtrCollection
98#else
99 : public QGList
100#endif
101{
102public:
103
104 QPtrList() {}
105 QPtrList( const QPtrList&lt;type&gt; &amp;l ) : QGList(l) {}
106 ~QPtrList() { clear(); }
107 QPtrList&lt;type&gt; &amp;operator=(const QPtrList&lt;type&gt; &amp;l)
108 { return (QPtrList&lt;type&gt;&amp;)QGList::operator=(l); }
109 bool operator==( const QPtrList&lt;type&gt; &amp;list ) const
110 { return QGList::operator==( list ); }
111 bool operator!=( const QPtrList&lt;type&gt; &amp;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&lt;type&gt; Iterator;
154 typedef QPtrListStdIterator&lt;type&gt; 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
168protected:
169 virtual int compareItems( QPtrCollection::Item, QPtrCollection::Item );
170 virtual QDataStream&amp; read( QDataStream&amp;, QPtrCollection::Item&amp; );
171 virtual QDataStream&amp; write( QDataStream&amp;, QPtrCollection::Item ) const;
172#endif
173
174private:
175 void deleteItem( Item d );
176};
177
178#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION)
179template&lt;&gt; inline void QPtrList&lt;void&gt;::deleteItem( QPtrCollection::Item )
180{
181}
182#endif
183
184template&lt;class type&gt; inline void QPtrList&lt;type&gt;::deleteItem( QPtrCollection::Item d )
185{
186 if ( del_item ) delete (type *)d;
187}
188
189template&lt;class type&gt;
190class QPtrListIterator : public QGListIterator
191{
192public:
193 QPtrListIterator(const QPtrList&lt;type&gt; &amp;l) :QGListIterator((QGList &amp;)l) {}
194 ~QPtrListIterator() {}
195 uint count() const { return list-&gt;count(); }
196 bool isEmpty() const { return list-&gt;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&lt;char&gt; (ie. QStrList fails...
205 //
206 // MSVC++ gives warning
207 // Sunpro C++ 4.1 gives error
208 // type *operator-&gt;() { 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&lt;type&gt;&amp; operator=(const QPtrListIterator&lt;type&gt;&amp;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 &copy; 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>
Note: See TracBrowser for help on using the repository browser.