Root/
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 QCache template class␊ |
5 | **␊ |
6 | ** Created : 950209␊ |
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 QCACHE_H␊ |
39 | #define QCACHE_H␊ |
40 | ␊ |
41 | #ifndef QT_H␊ |
42 | #include "qgcache.h"␊ |
43 | #endif // QT_H␊ |
44 | ␊ |
45 | #define USE_ASCII_STRING␊ |
46 | ␊ |
47 | #ifndef USE_ASCII_STRING␊ |
48 | ␊ |
49 | template<class type> class Q_EXPORT QCache : public QGCache␊ |
50 | {␊ |
51 | public:␊ |
52 | QCache( const QCache<type> &c ) : QGCache(c) {}␊ |
53 | QCache( int maxCost=100, int size=17, bool caseSensitive=TRUE )␊ |
54 | ␉: QGCache( maxCost, size, StringKey, caseSensitive, FALSE ) {}␊ |
55 | ~QCache()␉␉␉␉{ clear(); }␊ |
56 | QCache<type> &operator=( const QCache<type> &c )␊ |
57 | ␉␉␉{ return (QCache<type>&)QGCache::operator=(c); }␊ |
58 | int␉ maxCost() const␉␉{ return QGCache::maxCost(); }␊ |
59 | int␉ totalCost() const␉␉{ return QGCache::totalCost(); }␊ |
60 | void setMaxCost( int m )␉␉{ QGCache::setMaxCost(m); }␊ |
61 | uint count() const␉␉{ return QGCache::count(); }␊ |
62 | uint size() const␉␉{ return QGCache::size(); }␊ |
63 | bool isEmpty() const␉␉{ return QGCache::count() == 0; }␊ |
64 | void clear()␉␉␉{ QGCache::clear(); }␊ |
65 | bool insert( const QString &k, const type *d, int c=1, int p=0 )␊ |
66 | ␉␉␉{ return QGCache::insert_string(k,(Item)d,c,p);}␊ |
67 | bool remove( const QString &k )␊ |
68 | ␉␉␉{ return QGCache::remove_string(k); }␊ |
69 | type *take( const QString &k )␊ |
70 | ␉␉␉{ return (type *)QGCache::take_string(k); }␊ |
71 | type *find( const QString &k, bool ref=TRUE ) const␊ |
72 | ␉␉␉{ return (type *)QGCache::find_string(k,ref);}␊ |
73 | type *operator[]( const QString &k ) const␊ |
74 | ␉␉␉{ return (type *)QGCache::find_string(k);}␊ |
75 | void statistics() const␉ { QGCache::statistics(); }␊ |
76 | private:␊ |
77 | void deleteItem( Item d )␉ { if ( del_item ) delete (type *)d; }␊ |
78 | };␊ |
79 | ␊ |
80 | #else␊ |
81 | ␊ |
82 | ␊ |
83 | template<class type> class Q_EXPORT QCache : public QGCache␊ |
84 | {␊ |
85 | public:␊ |
86 | QCache( const QCache<type> &c ) : QGCache(c) {}␊ |
87 | QCache( int maxCost=100, int size=17, bool caseSensitive=TRUE )␊ |
88 | ␉: QGCache( maxCost, size, AsciiKey, caseSensitive, TRUE ) {}␊ |
89 | ~QCache()␉␉␉␉{ clear(); }␊ |
90 | QCache<type> &operator=( const QCache<type> &c )␊ |
91 | ␉␉␉{ return (QCache<type>&)QGCache::operator=(c); }␊ |
92 | int␉ maxCost() const␉␉{ return QGCache::maxCost(); }␊ |
93 | int␉ totalCost() const␉␉{ return QGCache::totalCost(); }␊ |
94 | void setMaxCost( int m )␉␉{ QGCache::setMaxCost(m); }␊ |
95 | uint count() const␉␉{ return QGCache::count(); }␊ |
96 | uint size() const␉␉{ return QGCache::size(); }␊ |
97 | bool isEmpty() const␉␉{ return QGCache::count() == 0; }␊ |
98 | void clear()␉␉␉{ QGCache::clear(); }␊ |
99 | bool insert( const char *k, const type *d, int c=1, int p=0 )␊ |
100 | ␉␉␉{ return QGCache::insert_other(k,(Item)d,c,p);}␊ |
101 | bool remove( const char *k )␊ |
102 | ␉␉␉{ return QGCache::remove_other(k); }␊ |
103 | type *take( const char *k )␊ |
104 | ␉␉␉{ return (type *)QGCache::take_other(k); }␊ |
105 | type *find( const char *k, bool ref=TRUE ) const␊ |
106 | ␉␉␉{ return (type *)QGCache::find_other(k,ref);}␊ |
107 | type *operator[]( const char *k ) const␊ |
108 | ␉␉␉{ return (type *)QGCache::find_other(k);}␊ |
109 | void statistics() const␉ { QGCache::statistics(); }␊ |
110 | private:␊ |
111 | void deleteItem( Item d )␉ { if ( del_item ) delete (type *)d; }␊ |
112 | };␊ |
113 | ␊ |
114 | ␊ |
115 | #endif␊ |
116 | ␊ |
117 | ␊ |
118 | ␊ |
119 | template<class type> class Q_EXPORT QCacheIterator : public QGCacheIterator␊ |
120 | {␊ |
121 | public:␊ |
122 | QCacheIterator( const QCache<type> &c ):QGCacheIterator((QGCache &)c) {}␊ |
123 | QCacheIterator( const QCacheIterator<type> &ci)␊ |
124 | ␉␉␉␉: QGCacheIterator( (QGCacheIterator &)ci ) {}␊ |
125 | QCacheIterator<type> &operator=(const QCacheIterator<type>&ci)␊ |
126 | ␉{ return ( QCacheIterator<type>&)QGCacheIterator::operator=( ci ); }␊ |
127 | uint count() const { return QGCacheIterator::count(); }␊ |
128 | bool isEmpty() const { return QGCacheIterator::count() == 0; }␊ |
129 | bool atFirst() const { return QGCacheIterator::atFirst(); }␊ |
130 | bool atLast() const { return QGCacheIterator::atLast(); }␊ |
131 | type *toFirst()␉ { return (type *)QGCacheIterator::toFirst(); }␊ |
132 | type *toLast()␉ { return (type *)QGCacheIterator::toLast(); }␊ |
133 | operator type *() const { return (type *)QGCacheIterator::get(); }␊ |
134 | type *current() const { return (type *)QGCacheIterator::get(); }␊ |
135 | #ifndef USE_ASCII_STRING␊ |
136 | QString currentKey() const{ return QGCacheIterator::getKeyString(); }␊ |
137 | #else␊ |
138 | const char *currentKey() const{ return QGCacheIterator::getKeyAscii(); }␊ |
139 | #endif␊ |
140 | type *operator()()␉ { return (type *)QGCacheIterator::operator()();}␊ |
141 | type *operator++()␉ { return (type *)QGCacheIterator::operator++(); }␊ |
142 | type *operator+=(uint j) { return (type *)QGCacheIterator::operator+=(j);}␊ |
143 | type *operator--()␉ { return (type *)QGCacheIterator::operator--(); }␊ |
144 | type *operator-=(uint j) { return (type *)QGCacheIterator::operator-=(j);}␊ |
145 | };␊ |
146 | ␊ |
147 | ␊ |
148 | #endif // QCACHE_H␊ |
149 |