author | kergoth <kergoth> | 2002-11-01 00:10:42 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-11-01 00:10:42 (UTC) |
commit | 5042e3cf0d3514552769e441f5aad590c8eaf967 (patch) (unidiff) | |
tree | 4a5ea45f3519d981a172ab5275bf38c6fa778dec /qmake/include/private/qcom_p.h | |
parent | 108c1c753e74e989cc13923086996791428c9af4 (diff) | |
download | opie-5042e3cf0d3514552769e441f5aad590c8eaf967.zip opie-5042e3cf0d3514552769e441f5aad590c8eaf967.tar.gz opie-5042e3cf0d3514552769e441f5aad590c8eaf967.tar.bz2 |
Adding qmake in preperation for new build system
Diffstat (limited to 'qmake/include/private/qcom_p.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/include/private/qcom_p.h | 337 |
1 files changed, 337 insertions, 0 deletions
diff --git a/qmake/include/private/qcom_p.h b/qmake/include/private/qcom_p.h new file mode 100644 index 0000000..6e7e1c8 --- a/dev/null +++ b/qmake/include/private/qcom_p.h | |||
@@ -0,0 +1,337 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** ... | ||
5 | ** | ||
6 | ** Copyright (C) 2001-2002 Trolltech AS. All rights reserved. | ||
7 | ** | ||
8 | ** This file is part of the tools module of the Qt GUI Toolkit. | ||
9 | ** | ||
10 | ** This file may be distributed under the terms of the Q Public License | ||
11 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
12 | ** LICENSE.QPL included in the packaging of this file. | ||
13 | ** | ||
14 | ** This file may be distributed and/or modified under the terms of the | ||
15 | ** GNU General Public License version 2 as published by the Free Software | ||
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
17 | ** packaging of this file. | ||
18 | ** | ||
19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
20 | ** licenses may use this file in accordance with the Qt Commercial License | ||
21 | ** Agreement provided with the Software. | ||
22 | ** | ||
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
25 | ** | ||
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
27 | ** information about Qt Commercial License Agreements. | ||
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #ifndef QCOM_H | ||
37 | #define QCOM_H | ||
38 | |||
39 | // | ||
40 | // W A R N I N G | ||
41 | // ------------- | ||
42 | // | ||
43 | // This file is not part of the Qt API. It exists for the convenience | ||
44 | // of a number of Qt sources files. This header file may change from | ||
45 | // version to version without notice, or even be removed. | ||
46 | // | ||
47 | // We mean it. | ||
48 | // | ||
49 | // | ||
50 | |||
51 | #ifndef QT_H | ||
52 | #include "qstringlist.h" | ||
53 | #include "quuid.h" | ||
54 | #endif // QT_H | ||
55 | |||
56 | #ifndef QT_NO_COMPONENT | ||
57 | |||
58 | class QObject; | ||
59 | struct QUInterfaceDescription; | ||
60 | struct QUObject; | ||
61 | |||
62 | #define QRESULT unsigned long | ||
63 | #define QS_OK (QRESULT)0x00000000 | ||
64 | #define QS_FALSE(QRESULT)0x00000001 | ||
65 | |||
66 | #define QE_NOTIMPL (QRESULT)0x80000001 | ||
67 | #define QE_OUTOFMEMORY (QRESULT)0x80000002 | ||
68 | #define QE_INVALIDARG(QRESULT)0x80000003 | ||
69 | #define QE_NOINTERFACE(QRESULT)0x80000004 | ||
70 | #define QE_NOCOMPONENT(QRESULT)0x80000005 | ||
71 | |||
72 | |||
73 | // {1D8518CD-E8F5-4366-99E8-879FD7E482DE} | ||
74 | #ifndef IID_QUnknown | ||
75 | #define IID_QUnknown QUuid(0x1d8518cd, 0xe8f5, 0x4366, 0x99, 0xe8, 0x87, 0x9f, 0xd7, 0xe4, 0x82, 0xde) | ||
76 | #endif | ||
77 | |||
78 | struct Q_EXPORT QUnknownInterface | ||
79 | { | ||
80 | virtual QRESULT queryInterface( const QUuid&, QUnknownInterface** ) = 0; | ||
81 | virtual ulong addRef() = 0; | ||
82 | virtual ulong release() = 0; | ||
83 | }; | ||
84 | |||
85 | // {FBAC965E-A441-413F-935E-CDF582573FAB} | ||
86 | #ifndef IID_QDispatch | ||
87 | #define IID_QDispatch QUuid( 0xfbac965e, 0xa441, 0x413f, 0x93, 0x5e, 0xcd, 0xf5, 0x82, 0x57, 0x3f, 0xab) | ||
88 | #endif | ||
89 | |||
90 | // the dispatch interface that inherits the unknown interface.. It is | ||
91 | // used to explore interfaces during runtime and to do dynamic calls. | ||
92 | struct Q_EXPORT QDispatchInterface : public QUnknownInterface | ||
93 | { | ||
94 | // returns the interface description of this dispatch interface. | ||
95 | virtual const QUInterfaceDescription* interfaceDescription() const = 0; | ||
96 | |||
97 | // returns the event description of this dispatch interface. | ||
98 | virtual const QUInterfaceDescription* eventsDescription() const = 0; | ||
99 | |||
100 | // invokes method id with parameters V*. Returns some sort of | ||
101 | // exception code. | ||
102 | virtual QRESULT invoke( int id, QUObject* o ) = 0; | ||
103 | |||
104 | // installs listener as event listener | ||
105 | virtual void installListener( QDispatchInterface* listener ) = 0; | ||
106 | |||
107 | // remove listener as event listener | ||
108 | virtual void removeListener( QDispatchInterface* listener ) = 0; | ||
109 | }; | ||
110 | |||
111 | template <class T> | ||
112 | class QInterfacePtr | ||
113 | { | ||
114 | public: | ||
115 | QInterfacePtr():iface(0){} | ||
116 | |||
117 | QInterfacePtr( T* i) { | ||
118 | if ( (iface = i) ) | ||
119 | iface->addRef(); | ||
120 | } | ||
121 | |||
122 | QInterfacePtr(const QInterfacePtr<T> &p) { | ||
123 | if ( (iface = p.iface) ) | ||
124 | iface->addRef(); | ||
125 | } | ||
126 | |||
127 | ~QInterfacePtr() { | ||
128 | if ( iface ) | ||
129 | iface->release(); | ||
130 | } | ||
131 | |||
132 | QInterfacePtr<T> &operator=(const QInterfacePtr<T> &p) { | ||
133 | if ( iface != p.iface ) { | ||
134 | if ( iface ) | ||
135 | iface->release(); | ||
136 | if ( (iface = p.iface) ) | ||
137 | iface->addRef(); | ||
138 | } | ||
139 | return *this; | ||
140 | } | ||
141 | |||
142 | QInterfacePtr<T> &operator=(T* i) { | ||
143 | if (iface != i ) { | ||
144 | if ( iface ) | ||
145 | iface->release(); | ||
146 | if ( (iface = i) ) | ||
147 | iface->addRef(); | ||
148 | } | ||
149 | return *this; | ||
150 | } | ||
151 | |||
152 | bool operator==( const QInterfacePtr<T> &p ) const { return iface == p.iface; } | ||
153 | |||
154 | bool operator!= ( const QInterfacePtr<T>& p ) const { return !( *this == p ); } | ||
155 | |||
156 | bool isNull() const { return !iface; } | ||
157 | |||
158 | T* operator->() const { return iface; } | ||
159 | |||
160 | T& operator*() const { return *iface; } | ||
161 | |||
162 | operator T*() const { return iface; } | ||
163 | |||
164 | QUnknownInterface** operator &() const { | ||
165 | if( iface ) | ||
166 | iface->release(); | ||
167 | return (QUnknownInterface**)&iface; | ||
168 | } | ||
169 | |||
170 | T** operator &() { | ||
171 | if ( iface ) | ||
172 | iface->release(); | ||
173 | return &iface; | ||
174 | } | ||
175 | |||
176 | private: | ||
177 | T* iface; | ||
178 | }; | ||
179 | |||
180 | // {10A1501B-4C5F-4914-95DD-C400486CF900} | ||
181 | #ifndef IID_QObject | ||
182 | #define IID_QObject QUuid( 0x10a1501b, 0x4c5f, 0x4914, 0x95, 0xdd, 0xc4, 0x00, 0x48, 0x6c, 0xf9, 0x00) | ||
183 | #endif | ||
184 | |||
185 | struct Q_EXPORT QObjectInterface | ||
186 | { | ||
187 | virtual QObject* qObject() = 0; | ||
188 | }; | ||
189 | |||
190 | // {5F3968A5-F451-45b1-96FB-061AD98F926E} | ||
191 | #ifndef IID_QComponentInformation | ||
192 | #define IID_QComponentInformation QUuid(0x5f3968a5, 0xf451, 0x45b1, 0x96, 0xfb, 0x6, 0x1a, 0xd9, 0x8f, 0x92, 0x6e) | ||
193 | #endif | ||
194 | |||
195 | struct Q_EXPORT QComponentInformationInterface : public QUnknownInterface | ||
196 | { | ||
197 | virtual QString name() const = 0; | ||
198 | virtual QString description() const = 0; | ||
199 | virtual QString author() const = 0; | ||
200 | virtual QString version() const = 0; | ||
201 | }; | ||
202 | |||
203 | // {6CAA771B-17BB-4988-9E78-BA5CDDAAC31E} | ||
204 | #ifndef IID_QComponentFactory | ||
205 | #define IID_QComponentFactory QUuid( 0x6caa771b, 0x17bb, 0x4988, 0x9e, 0x78, 0xba, 0x5c, 0xdd, 0xaa, 0xc3, 0x1e) | ||
206 | #endif | ||
207 | |||
208 | struct Q_EXPORT QComponentFactoryInterface : public QUnknownInterface | ||
209 | { | ||
210 | virtual QRESULT createInstance( const QUuid &cid, const QUuid &iid, QUnknownInterface** instance, QUnknownInterface *outer ) = 0; | ||
211 | }; | ||
212 | |||
213 | // {D16111D4-E1E7-4C47-8599-24483DAE2E07} | ||
214 | #ifndef IID_QLibrary | ||
215 | #define IID_QLibrary QUuid( 0xd16111d4, 0xe1e7, 0x4c47, 0x85, 0x99, 0x24, 0x48, 0x3d, 0xae, 0x2e, 0x07) | ||
216 | #endif | ||
217 | |||
218 | struct Q_EXPORT QLibraryInterface : public QUnknownInterface | ||
219 | { | ||
220 | virtual bool init() = 0; | ||
221 | virtual void cleanup() = 0; | ||
222 | virtual bool canUnload() const = 0; | ||
223 | }; | ||
224 | |||
225 | // {3F8FDC44-3015-4f3e-B6D6-E4AAAABDEAAD} | ||
226 | #ifndef IID_QFeatureList | ||
227 | #define IID_QFeatureList QUuid(0x3f8fdc44, 0x3015, 0x4f3e, 0xb6, 0xd6, 0xe4, 0xaa, 0xaa, 0xbd, 0xea, 0xad) | ||
228 | #endif | ||
229 | |||
230 | struct Q_EXPORT QFeatureListInterface : public QUnknownInterface | ||
231 | { | ||
232 | virtual QStringListfeatureList() const = 0; | ||
233 | }; | ||
234 | |||
235 | // {B5FEB5DE-E0CD-4E37-B0EB-8A812499A0C1} | ||
236 | #ifndef IID_QComponentRegistration | ||
237 | #define IID_QComponentRegistration QUuid( 0xb5feb5de, 0xe0cd, 0x4e37, 0xb0, 0xeb, 0x8a, 0x81, 0x24, 0x99, 0xa0, 0xc1) | ||
238 | #endif | ||
239 | |||
240 | struct Q_EXPORT QComponentRegistrationInterface : public QUnknownInterface | ||
241 | { | ||
242 | virtual bool registerComponents( const QString &filepath ) const = 0; | ||
243 | virtual bool unregisterComponents() const = 0; | ||
244 | }; | ||
245 | |||
246 | // internal class that wraps an initialized ulong | ||
247 | struct Q_EXPORT QtULong | ||
248 | { | ||
249 | QtULong() : ref( 0 ) { } | ||
250 | operator unsigned long () const { return ref; } | ||
251 | unsigned long& operator++() { return ++ref; } | ||
252 | unsigned long operator++( int ) { return ref++; } | ||
253 | unsigned long& operator--() { return --ref; } | ||
254 | unsigned long operator--( int ) { return ref--; } | ||
255 | |||
256 | unsigned long ref; | ||
257 | }; | ||
258 | // default implementation of ref counting. A variable "ulong ref" has to be a member | ||
259 | |||
260 | |||
261 | #define Q_REFCOUNT \ | ||
262 | private: \ | ||
263 | QtULong qtrefcount; \ | ||
264 | public: \ | ||
265 | ulong addRef() {return qtrefcount++;} \ | ||
266 | ulong release() {if(!--qtrefcount){delete this;return 0;}return qtrefcount;} | ||
267 | |||
268 | #ifndef Q_EXPORT_COMPONENT | ||
269 | #if defined(QT_THREAD_SUPPORT) | ||
270 | #define QT_THREADED_BUILD 1 | ||
271 | #define Q_UCM_FLAGS_STRING "11" | ||
272 | #else | ||
273 | #define QT_THREADED_BUILD 0 | ||
274 | #define Q_UCM_FLAGS_STRING "01" | ||
275 | #endif | ||
276 | |||
277 | #ifndef Q_EXTERN_C | ||
278 | #ifdef __cplusplus | ||
279 | #define Q_EXTERN_C extern "C" | ||
280 | #else | ||
281 | #define Q_EXTERN_C extern | ||
282 | #endif | ||
283 | #endif | ||
284 | |||
285 | // this is duplicated at Q_PLUGIN_VERIFICATION_DATA in qgplugin.h | ||
286 | // NOTE: if you change pattern, you MUST change the pattern in | ||
287 | // qcomlibrary.cpp as well. changing the pattern will break all | ||
288 | // backwards compatibility as well (no old plugins will be loaded). | ||
289 | #ifndef Q_UCM_VERIFICATION_DATA | ||
290 | # define Q_UCM_VERIFICATION_DATA \ | ||
291 | static const char *qt_ucm_verification_data = \ | ||
292 | "pattern=""QT_UCM_VERIFICATION_DATA""\n" \ | ||
293 | "version="QT_VERSION_STR"\n" \ | ||
294 | "flags="Q_UCM_FLAGS_STRING"\n" \ | ||
295 | "buildkey="QT_BUILD_KEY"\0"; | ||
296 | #endif // Q_UCM_VERIFICATION_DATA | ||
297 | |||
298 | // This macro expands to the default implementation of ucm_instantiate. | ||
299 | #ifndef Q_CREATE_INSTANCE | ||
300 | # define Q_CREATE_INSTANCE( IMPLEMENTATION ) \ | ||
301 | IMPLEMENTATION *i = new IMPLEMENTATION; \ | ||
302 | QUnknownInterface* iface = 0; \ | ||
303 | i->queryInterface( IID_QUnknown, &iface );\ | ||
304 | return iface; | ||
305 | #endif // Q_CREATE_INSTANCE | ||
306 | |||
307 | # ifdef Q_WS_WIN | ||
308 | #ifdef Q_CC_BOR | ||
309 | # define Q_EXPORT_COMPONENT() \ | ||
310 | Q_UCM_VERIFICATION_DATA \ | ||
311 | Q_EXTERN_C __declspec(dllexport) \ | ||
312 | const char * __stdcall qt_ucm_query_verification_data() \ | ||
313 | { return qt_ucm_verification_data; } \ | ||
314 | Q_EXTERN_C __declspec(dllexport) QUnknownInterface* \ | ||
315 | __stdcall ucm_instantiate() | ||
316 | #else | ||
317 | # define Q_EXPORT_COMPONENT() \ | ||
318 | Q_UCM_VERIFICATION_DATA \ | ||
319 | Q_EXTERN_C __declspec(dllexport) \ | ||
320 | const char *qt_ucm_query_verification_data() \ | ||
321 | { return qt_ucm_verification_data; } \ | ||
322 | Q_EXTERN_C __declspec(dllexport) QUnknownInterface* ucm_instantiate() | ||
323 | #endif | ||
324 | # else | ||
325 | #define Q_EXPORT_COMPONENT() \ | ||
326 | Q_UCM_VERIFICATION_DATA \ | ||
327 | Q_EXTERN_C \ | ||
328 | const char *qt_ucm_query_verification_data() \ | ||
329 | { return qt_ucm_verification_data; } \ | ||
330 | Q_EXTERN_C QUnknownInterface* ucm_instantiate() | ||
331 | # endif | ||
332 | # define Q_EXPORT_INTERFACE() Q_EXPORT_COMPONENT() | ||
333 | #endif | ||
334 | |||
335 | #endif //QT_NO_COMPONENT | ||
336 | |||
337 | #endif //QCOM_H | ||