summaryrefslogtreecommitdiff
path: root/library/qcom.h
Unidiff
Diffstat (limited to 'library/qcom.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qcom.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/qcom.h b/library/qcom.h
index 9972d8f..5703800 100644
--- a/library/qcom.h
+++ b/library/qcom.h
@@ -1,76 +1,77 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef QCOM_H 21#ifndef QCOM_H
22#define QCOM_H 22#define QCOM_H
23 23
24#include <qstringlist.h> 24#include <qstringlist.h>
25 25
26#ifndef QT_NO_COMPONENT 26#ifndef QT_NO_COMPONENT
27 27
28#include <qpe/quuid.h> 28#include <qpe/quuid.h>
29#include <qpe/qpeglobal.h>
29 30
30#define QRESULT unsigned long 31#define QRESULT unsigned long
31#define QS_OK (QRESULT)0x00000000 32#define QS_OK (QRESULT)0x00000000
32#define QS_FALSE (QRESULT)0x00000001 33#define QS_FALSE (QRESULT)0x00000001
33 34
34#define QE_NOTIMPL (QRESULT)0x80000001 35#define QE_NOTIMPL (QRESULT)0x80000001
35#define QE_OUTOFMEMORY (QRESULT)0x80000002 36#define QE_OUTOFMEMORY (QRESULT)0x80000002
36#define QE_INVALIDARG (QRESULT)0x80000003 37#define QE_INVALIDARG (QRESULT)0x80000003
37#define QE_NOINTERFACE (QRESULT)0x80000004 38#define QE_NOINTERFACE (QRESULT)0x80000004
38#define QE_NOCOMPONENT (QRESULT)0x80000005 39#define QE_NOCOMPONENT (QRESULT)0x80000005
39 40
40// {1D8518CD-E8F5-4366-99E8-879FD7E482DE} 41// {1D8518CD-E8F5-4366-99E8-879FD7E482DE}
41#ifndef IID_QUnknown 42#ifndef IID_QUnknown
42#define IID_QUnknown QUuid(0x1d8518cd, 0xe8f5, 0x4366, 0x99, 0xe8, 0x87, 0x9f, 0xd7, 0xe4, 0x82, 0xde) 43#define IID_QUnknown QUuid(0x1d8518cd, 0xe8f5, 0x4366, 0x99, 0xe8, 0x87, 0x9f, 0xd7, 0xe4, 0x82, 0xde)
43#endif 44#endif
44 45
45struct Q_EXPORT QUnknownInterface 46struct Q_EXPORT QUnknownInterface
46{ 47{
47 virtual QRESULT queryInterface( const QUuid&, QUnknownInterface** ) = 0; 48 virtual QRESULT queryInterface( const QUuid&, QUnknownInterface** ) = 0;
48 virtual ulong addRef() = 0; 49 virtual ulong addRef() = 0;
49 virtual ulong release() = 0; 50 virtual ulong release() = 0;
50}; 51};
51 52
52// {D16111D4-E1E7-4C47-8599-24483DAE2E07} 53// {D16111D4-E1E7-4C47-8599-24483DAE2E07}
53#ifndef IID_QLibrary 54#ifndef IID_QLibrary
54#define IID_QLibrary QUuid( 0xd16111d4, 0xe1e7, 0x4c47, 0x85, 0x99, 0x24, 0x48, 0x3d, 0xae, 0x2e, 0x07) 55#define IID_QLibrary QUuid( 0xd16111d4, 0xe1e7, 0x4c47, 0x85, 0x99, 0x24, 0x48, 0x3d, 0xae, 0x2e, 0x07)
55#endif 56#endif
56 57
57struct Q_EXPORT QLibraryInterface : public QUnknownInterface 58struct Q_EXPORT QLibraryInterface : public QUnknownInterface
58{ 59{
59 virtual bool init() = 0; 60 virtual bool init() = 0;
60 virtual void cleanup() = 0; 61 virtual void cleanup() = 0;
61 virtual bool canUnload() const = 0; 62 virtual bool canUnload() const = 0;
62}; 63};
63 64
64#define Q_CREATE_INSTANCE( IMPLEMENTATION ) \ 65#define Q_CREATE_INSTANCE( IMPLEMENTATION ) \
65 IMPLEMENTATION *i = new IMPLEMENTATION; \ 66 IMPLEMENTATION *i = new IMPLEMENTATION; \
66 QUnknownInterface* iface = 0; \ 67 QUnknownInterface* iface = 0; \
67 i->queryInterface( IID_QUnknown, &iface ); \ 68 i->queryInterface( IID_QUnknown, &iface ); \
68 return iface; 69 return iface;
69 70
70template <class T> 71template <class T>
71class QInterfacePtr 72class QInterfacePtr
72{ 73{
73public: 74public:
74 QInterfacePtr():iface(0){} 75 QInterfacePtr():iface(0){}
75 76
76 QInterfacePtr( T* i) { 77 QInterfacePtr( T* i) {
@@ -106,66 +107,66 @@ public:
106 iface->addRef(); 107 iface->addRef();
107 } 108 }
108 return *this; 109 return *this;
109 } 110 }
110 111
111 bool operator==( const QInterfacePtr<T> &p ) const { return iface == p.iface; } 112 bool operator==( const QInterfacePtr<T> &p ) const { return iface == p.iface; }
112 113
113 bool operator!= ( const QInterfacePtr<T>& p ) const { return !( *this == p ); } 114 bool operator!= ( const QInterfacePtr<T>& p ) const { return !( *this == p ); }
114 115
115 bool isNull() const { return !iface; } 116 bool isNull() const { return !iface; }
116 117
117 T* operator->() const { return iface; } 118 T* operator->() const { return iface; }
118 119
119 T& operator*() const { return *iface; } 120 T& operator*() const { return *iface; }
120 121
121 operator T*() const { return iface; } 122 operator T*() const { return iface; }
122 123
123 QUnknownInterface** operator &() const { 124 QUnknownInterface** operator &() const {
124 if( iface ) 125 if( iface )
125 iface->release(); 126 iface->release();
126 return (QUnknownInterface**)&iface; 127 return (QUnknownInterface**)&iface;
127 } 128 }
128 129
129 T** operator &() { 130 T** operator &() {
130 if ( iface ) 131 if ( iface )
131 iface->release(); 132 iface->release();
132 return &iface; 133 return &iface;
133 } 134 }
134 135
135private: 136private:
136 T* iface; 137 T* iface;
137}; 138};
138 139
139 140
140// internal class that wraps an initialized ulong 141// internal class that wraps an initialized ulong
141struct Q_EXPORT QtULong 142struct Q_EXPORT QtULong
142{ 143{
143 QtULong() : ref( 0 ) { } 144 QtULong() : ref( 0 ) { }
144 operator unsigned long () const { return ref; } 145 operator unsigned long () const { return ref; }
145 unsigned long& operator++() { return ++ref; } 146 unsigned long& operator++() { return ++ref; }
146 unsigned long operator++( int ) { return ref++; } 147 unsigned long operator++( int ) { return ref++; }
147 unsigned long& operator--() { return --ref; } 148 unsigned long& operator--() { return --ref; }
148 unsigned long operator--( int ) { return ref--; } 149 unsigned long operator--( int ) { return ref--; }
149 150
150 unsigned long ref; 151 unsigned long ref;
151}; 152};
152 153
153#define Q_EXPORT_INTERFACE() \ 154#define Q_EXPORT_INTERFACE() \
154 extern "C" QUnknownInterface* ucm_instantiate() 155 extern "C" QUnknownInterface* ucm_instantiate QPE_EXPORT_SYMBOL ()
155 156
156#define Q_REFCOUNT \ 157#define Q_REFCOUNT \
157private: \ 158private: \
158 QtULong qtrefcount; \ 159 QtULong qtrefcount; \
159public: \ 160public: \
160 ulong addRef() {return qtrefcount++;} \ 161 ulong addRef() {return qtrefcount++;} \
161 ulong release() {if(!--qtrefcount){delete this;return 0;}return qtrefcount;} 162 ulong release() {if(!--qtrefcount){delete this;return 0;}return qtrefcount;}
162 163
163#else // QT_NO_COMPONENT 164#else // QT_NO_COMPONENT
164 165
165struct Q_EXPORT QUnknownInterface 166struct Q_EXPORT QUnknownInterface
166{ 167{
167}; 168};
168 169
169#endif // QT_NO_COMPONENT 170#endif // QT_NO_COMPONENT
170 171
171#endif // QCOM_H 172#endif // QCOM_H