-rw-r--r-- | library/qcom.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/library/qcom.h b/library/qcom.h new file mode 100644 index 0000000..229be2b --- a/dev/null +++ b/library/qcom.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #ifndef QCOM_H | ||
22 | #define QCOM_H | ||
23 | |||
24 | #include <qstringlist.h> | ||
25 | |||
26 | #ifndef QT_NO_COMPONENT | ||
27 | |||
28 | #include <qpe/quuid.h> | ||
29 | |||
30 | #define QRESULT unsigned long | ||
31 | #define QS_OK (QRESULT)0x00000000 | ||
32 | #define QS_FALSE (QRESULT)0x00000001 | ||
33 | |||
34 | #define QE_NOTIMPL (QRESULT)0x80000001 | ||
35 | #define QE_OUTOFMEMORY (QRESULT)0x80000002 | ||
36 | #define QE_INVALIDARG (QRESULT)0x80000003 | ||
37 | #define QE_NOINTERFACE (QRESULT)0x80000004 | ||
38 | #define QE_NOCOMPONENT (QRESULT)0x80000005 | ||
39 | |||
40 | // {1D8518CD-E8F5-4366-99E8-879FD7E482DE} | ||
41 | #ifndef IID_QUnknown | ||
42 | #define IID_QUnknown QUuid(0x1d8518cd, 0xe8f5, 0x4366, 0x99, 0xe8, 0x87, 0x9f, 0xd7, 0xe4, 0x82, 0xde) | ||
43 | #endif | ||
44 | |||
45 | struct Q_EXPORT QUnknownInterface | ||
46 | { | ||
47 | virtual QRESULT queryInterface( const QUuid&, QUnknownInterface** ) = 0; | ||
48 | virtual ulong addRef() = 0; | ||
49 | virtual ulong release() = 0; | ||
50 | }; | ||
51 | |||
52 | // {D16111D4-E1E7-4C47-8599-24483DAE2E07} | ||
53 | #ifndef IID_QLibrary | ||
54 | #define IID_QLibrary QUuid( 0xd16111d4, 0xe1e7, 0x4c47, 0x85, 0x99, 0x24, 0x48, 0x3d, 0xae, 0x2e, 0x07) | ||
55 | #endif | ||
56 | |||
57 | struct Q_EXPORT QLibraryInterface : public QUnknownInterface | ||
58 | { | ||
59 | virtual bool init() = 0; | ||
60 | virtual void cleanup() = 0; | ||
61 | virtual bool canUnload() const = 0; | ||
62 | }; | ||
63 | |||
64 | #define Q_CREATE_INSTANCE( IMPLEMENTATION ) \ | ||
65 | IMPLEMENTATION *i = new IMPLEMENTATION; \ | ||
66 | QUnknownInterface* iface = 0; \ | ||
67 | i->queryInterface( IID_QUnknown, &iface ); \ | ||
68 | return iface; | ||
69 | |||
70 | #define Q_EXPORT_INTERFACE() \ | ||
71 | extern "C" QUnknownInterface* ucm_instantiate() | ||
72 | |||
73 | #define Q_REFCOUNT ulong addRef() {return ref++;}ulong release() {if(!--ref){delete this;return 0;}return ref;} | ||
74 | |||
75 | #else // QT_NO_COMPONENT | ||
76 | |||
77 | struct Q_EXPORT QUnknownInterface | ||
78 | { | ||
79 | }; | ||
80 | |||
81 | #endif // QT_NO_COMPONENT | ||
82 | |||
83 | #endif // QCOM_H | ||