-rw-r--r-- | qmake/include/qasciidict.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/qmake/include/qasciidict.h b/qmake/include/qasciidict.h index 8f344cd..ecd9c9f 100644 --- a/qmake/include/qasciidict.h +++ b/qmake/include/qasciidict.h | |||
@@ -1,118 +1,122 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of QAsciiDict template class | 4 | ** Definition of QAsciiDict template class |
5 | ** | 5 | ** |
6 | ** Created : 920821 | 6 | ** Created : 920821 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 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 | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QASCIIDICT_H | 38 | #ifndef QASCIIDICT_H |
39 | #define QASCIIDICT_H | 39 | #define QASCIIDICT_H |
40 | 40 | ||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include "qgdict.h" | 42 | #include "qgdict.h" |
43 | #endif // QT_H | 43 | #endif // QT_H |
44 | 44 | ||
45 | template<class type> | 45 | template<class type> |
46 | class QAsciiDict | 46 | class QAsciiDict |
47 | #ifdef Q_QDOC | 47 | #ifdef Q_QDOC |
48 | : public QPtrCollection | 48 | : public QPtrCollection |
49 | #else | 49 | #else |
50 | : public QGDict | 50 | : public QGDict |
51 | #endif | 51 | #endif |
52 | { | 52 | { |
53 | public: | 53 | public: |
54 | QAsciiDict(int size=17, bool caseSensitive=TRUE, bool copyKeys=TRUE ) | 54 | QAsciiDict(int size=17, bool caseSensitive=TRUE, bool copyKeys=TRUE ) |
55 | : QGDict(size,AsciiKey,caseSensitive,copyKeys) {} | 55 | : QGDict(size,AsciiKey,caseSensitive,copyKeys) {} |
56 | QAsciiDict( const QAsciiDict<type> &d ) : QGDict(d) {} | 56 | QAsciiDict( const QAsciiDict<type> &d ) : QGDict(d) {} |
57 | ~QAsciiDict() { clear(); } | 57 | ~QAsciiDict() { clear(); } |
58 | QAsciiDict<type> &operator=(const QAsciiDict<type> &d) | 58 | QAsciiDict<type> &operator=(const QAsciiDict<type> &d) |
59 | { return (QAsciiDict<type>&)QGDict::operator=(d); } | 59 | { return (QAsciiDict<type>&)QGDict::operator=(d); } |
60 | uint count() const { return QGDict::count(); } | 60 | uint count() const { return QGDict::count(); } |
61 | uint size() const { return QGDict::size(); } | 61 | uint size() const { return QGDict::size(); } |
62 | bool isEmpty() const { return QGDict::count() == 0; } | 62 | bool isEmpty() const { return QGDict::count() == 0; } |
63 | 63 | ||
64 | void insert( const char *k, const type *d ) | 64 | void insert( const char *k, const type *d ) |
65 | { QGDict::look_ascii(k,(Item)d,1); } | 65 | { QGDict::look_ascii(k,(Item)d,1); } |
66 | void replace( const char *k, const type *d ) | 66 | void replace( const char *k, const type *d ) |
67 | { QGDict::look_ascii(k,(Item)d,2); } | 67 | { QGDict::look_ascii(k,(Item)d,2); } |
68 | bool remove( const char *k ){ return QGDict::remove_ascii(k); } | 68 | bool remove( const char *k ){ return QGDict::remove_ascii(k); } |
69 | type *take( const char *k ) { return (type *)QGDict::take_ascii(k); } | 69 | type *take( const char *k ) { return (type *)QGDict::take_ascii(k); } |
70 | type *find( const char *k ) const | 70 | type *find( const char *k ) const |
71 | { return (type *)((QGDict*)this)->QGDict::look_ascii(k,0,0); } | 71 | { return (type *)((QGDict*)this)->QGDict::look_ascii(k,0,0); } |
72 | type *operator[]( const char *k ) const | 72 | type *operator[]( const char *k ) const |
73 | { return (type *)((QGDict*)this)->QGDict::look_ascii(k,0,0); } | 73 | { return (type *)((QGDict*)this)->QGDict::look_ascii(k,0,0); } |
74 | 74 | ||
75 | void clear() { QGDict::clear(); } | 75 | void clear() { QGDict::clear(); } |
76 | void resize( uint n ) { QGDict::resize(n); } | 76 | void resize( uint n ) { QGDict::resize(n); } |
77 | void statistics() const { QGDict::statistics(); } | 77 | void statistics() const { QGDict::statistics(); } |
78 | 78 | ||
79 | #ifdef Q_QDOC | 79 | #ifdef Q_QDOC |
80 | protected: | 80 | protected: |
81 | virtual QDataStream& read( QDataStream &, QPtrCollection::Item & ); | 81 | virtual QDataStream& read( QDataStream &, QPtrCollection::Item & ); |
82 | virtual QDataStream& write( QDataStream &, QPtrCollection::Item ) const; | 82 | virtual QDataStream& write( QDataStream &, QPtrCollection::Item ) const; |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | private: | 85 | private: |
86 | void deleteItem( Item d ); | 86 | void deleteItem( Item d ); |
87 | }; | 87 | }; |
88 | 88 | ||
89 | #if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) | 89 | #if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) |
90 | template<> inline void QAsciiDict<void>::deleteItem( QPtrCollection::Item ) | 90 | template<> inline void QAsciiDict<void>::deleteItem( QPtrCollection::Item ) |
91 | { | 91 | { |
92 | } | 92 | } |
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | template<class type> inline void QAsciiDict<type>::deleteItem( QPtrCollection::Item d ) | 95 | template<class type> inline void QAsciiDict<type>::deleteItem( QPtrCollection::Item d ) |
96 | { | 96 | { |
97 | if ( del_item ) delete (type *)d; | 97 | if ( del_item ) delete (type *)d; |
98 | } | 98 | } |
99 | 99 | ||
100 | template<class type> | 100 | template<class type> |
101 | class QAsciiDictIterator : public QGDictIterator | 101 | class QAsciiDictIterator : public QGDictIterator |
102 | { | 102 | { |
103 | public: | 103 | public: |
104 | QAsciiDictIterator(const QAsciiDict<type> &d) | 104 | QAsciiDictIterator(const QAsciiDict<type> &d) |
105 | : QGDictIterator((QGDict &)d) {} | 105 | : QGDictIterator((QGDict &)d) {} |
106 | ~QAsciiDictIterator() {} | 106 | ~QAsciiDictIterator() {} |
107 | uint count() const { return dict->count(); } | 107 | uint count() const { return dict->count(); } |
108 | bool isEmpty() const { return dict->count() == 0; } | 108 | bool isEmpty() const { return dict->count() == 0; } |
109 | type *toFirst() { return (type *)QGDictIterator::toFirst(); } | 109 | type *toFirst() { return (type *)QGDictIterator::toFirst(); } |
110 | operator type *() const { return (type *)QGDictIterator::get(); } | 110 | operator type *() const { return (type *)QGDictIterator::get(); } |
111 | type *current() const { return (type *)QGDictIterator::get(); } | 111 | type *current() const { return (type *)QGDictIterator::get(); } |
112 | const char *currentKey() const { return QGDictIterator::getKeyAscii(); } | 112 | const char *currentKey() const { return QGDictIterator::getKeyAscii(); } |
113 | type *operator()() { return (type *)QGDictIterator::operator()(); } | 113 | type *operator()() { return (type *)QGDictIterator::operator()(); } |
114 | type *operator++() { return (type *)QGDictIterator::operator++(); } | 114 | type *operator++() { return (type *)QGDictIterator::operator++(); } |
115 | type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);} | 115 | type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);} |
116 | }; | 116 | }; |
117 | 117 | ||
118 | #ifdef QT_QWINEXPORT | ||
119 | #define Q_DEFINED_QASCIIDICT | ||
120 | #include "qwinexport.h" | ||
121 | #endif /* QT_QWINEXPORT */ | ||
118 | #endif // QASCIIDICT_H | 122 | #endif // QASCIIDICT_H |