Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/util/doxygen/qtools/qgdict.h

Source at commit 1406 created 12 years 10 months ago.
By meklort, Revert drivers.c so that kexts are only loaded when OSBundleRequired is set and that value is not safe mode. Added some comments about it too.
1/****************************************************************************
2**
3**
4** Definition of QGDict and QGDictIterator classes
5**
6** Created : 920529
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 QGDICT_H
39#define QGDICT_H
40
41#ifndef QT_H
42#include "qcollection.h"
43#include "qstring.h"
44#endif // QT_H
45
46class QGDictIterator;
47class QGDItList;
48
49
50class QBaseBucket// internal dict node
51{
52public:
53 QCollection::Item getData(){ return data; }
54 QCollection::Item setData( QCollection::Item d ) { return data = d; }
55 QBaseBucket*getNext(){ return next; }
56 void setNext( QBaseBucket *n){ next = n; }
57protected:
58 QBaseBucket( QCollection::Item d, QBaseBucket *n ) : data(d), next(n) {}
59 QCollection::Item data;
60 QBaseBucket*next;
61};
62
63class QStringBucket : public QBaseBucket
64{
65public:
66 QStringBucket( const QString &k, QCollection::Item d, QBaseBucket *n )
67: QBaseBucket(d,n), key(k){}
68 const QString &getKey() const{ return key; }
69private:
70 QString key;
71};
72
73class QAsciiBucket : public QBaseBucket
74{
75public:
76 QAsciiBucket( const char *k, QCollection::Item d, QBaseBucket *n )
77: QBaseBucket(d,n), key(k) {}
78 const char *getKey() const { return key; }
79private:
80 const char *key;
81};
82
83class QIntBucket : public QBaseBucket
84{
85public:
86 QIntBucket( long k, QCollection::Item d, QBaseBucket *n )
87: QBaseBucket(d,n), key(k) {}
88 long getKey() const { return key; }
89private:
90 long key;
91};
92
93class QPtrBucket : public QBaseBucket
94{
95public:
96 QPtrBucket( void *k, QCollection::Item d, QBaseBucket *n )
97: QBaseBucket(d,n), key(k) {}
98 void *getKey() const { return key; }
99private:
100 void *key;
101};
102
103
104class Q_EXPORT QGDict : public QCollection// generic dictionary class
105{
106public:
107 uintcount() const{ return numItems; }
108 uintsize()const{ return vlen; }
109 QCollection::Item look_string( const QString& key, QCollection::Item,
110 int );
111 QCollection::Item look_ascii( const char *key, QCollection::Item, int );
112 QCollection::Item look_int( long key, QCollection::Item, int );
113 QCollection::Item look_ptr( void *key, QCollection::Item, int );
114#ifndef QT_NO_DATASTREAM
115 QDataStream &read( QDataStream & );
116 QDataStream &write( QDataStream & ) const;
117#endif
118protected:
119 enum KeyType { StringKey, AsciiKey, IntKey, PtrKey };
120
121 QGDict( uint len, KeyType kt, bool cs, bool ck );
122 QGDict( const QGDict & );
123 ~QGDict();
124
125 QGDict &operator=( const QGDict & );
126
127 boolremove_string( const QString &key, QCollection::Item item=0 );
128 boolremove_ascii( const char *key, QCollection::Item item=0 );
129 boolremove_int( long key, QCollection::Item item=0 );
130 boolremove_ptr( void *key, QCollection::Item item=0 );
131 QCollection::Item take_string( const QString &key );
132 QCollection::Item take_ascii( const char *key );
133 QCollection::Item take_int( long key );
134 QCollection::Item take_ptr( void *key );
135
136 voidclear();
137 voidresize( uint );
138
139 inthashKeyString( const QString & );
140 inthashKeyAscii( const char * );
141
142 voidstatistics() const;
143
144#ifndef QT_NO_DATASTREAM
145 virtual QDataStream &read( QDataStream &, QCollection::Item & );
146 virtual QDataStream &write( QDataStream &, QCollection::Item ) const;
147#endif
148private:
149 QBaseBucket **vec;
150 uintvlen;
151 uintnumItems;
152 uintkeytype: 2;
153 uintcases: 1;
154 uintcopyk: 1;
155 QGDItList *iterators;
156 void unlink_common( int, QBaseBucket *, QBaseBucket * );
157 QStringBucket *unlink_string( const QString &,
158 QCollection::Item item = 0 );
159 QAsciiBucket *unlink_ascii( const char *, QCollection::Item item = 0 );
160 QIntBucket *unlink_int( long, QCollection::Item item = 0 );
161 QPtrBucket *unlink_ptr( void *, QCollection::Item item = 0 );
162 voidinit( uint, KeyType, bool, bool );
163 friend class QGDictIterator;
164};
165
166
167class Q_EXPORT QGDictIterator// generic dictionary iterator
168{
169friend class QGDict;
170public:
171 QGDictIterator( const QGDict & );
172 QGDictIterator( const QGDictIterator & );
173 QGDictIterator &operator=( const QGDictIterator & );
174 ~QGDictIterator();
175
176 QCollection::Item toFirst();
177
178 QCollection::Item get() const;
179 QString getKeyString() const;
180 const char *getKeyAscii() const;
181 long getKeyInt() const;
182 void *getKeyPtr() const;
183
184 QCollection::Item operator()();
185 QCollection::Item operator++();
186 QCollection::Item operator+=(uint);
187
188protected:
189 QGDict *dict;
190
191private:
192 QBaseBucket *curNode;
193 uint curIndex;
194};
195
196inline QCollection::Item QGDictIterator::get() const
197{
198 return curNode ? curNode->getData() : 0;
199}
200
201inline QString QGDictIterator::getKeyString() const
202{
203 return curNode ? ((QStringBucket*)curNode)->getKey() : QString::null;
204}
205
206inline const char *QGDictIterator::getKeyAscii() const
207{
208 return curNode ? ((QAsciiBucket*)curNode)->getKey() : 0;
209}
210
211inline long QGDictIterator::getKeyInt() const
212{
213 return curNode ? ((QIntBucket*)curNode)->getKey() : 0;
214}
215
216inline void *QGDictIterator::getKeyPtr() const
217{
218 return curNode ? ((QPtrBucket*)curNode)->getKey() : 0;
219}
220
221
222#endif // QGDICT_H
223

Archive Download this file

Revision: 1406