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