00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef QCOM_H
00041 #define QCOM_H
00042
00043 #ifndef __cplusplus
00044 #error "This is a C++ header file; it requires C++ to compile."
00045 #endif
00046
00047 #include "quuid.h"
00048
00049
00050 #define QRESULT unsigned long
00051 #define QS_OK (QRESULT)0x00000000
00052 #define QS_FALSE (QRESULT)0x00000001
00053
00054 #define QE_NOTIMPL (QRESULT)0x80000001
00055 #define QE_OUTOFMEMORY (QRESULT)0x80000002
00056 #define QE_INVALIDARG (QRESULT)0x80000003
00057 #define QE_NOINTERFACE (QRESULT)0x80000004
00058 #define QE_NOCOMPONENT (QRESULT)0x80000005
00059
00060
00061
00062
00063
00064 struct QtULong
00065 {
00066 QtULong() : ref( 0 ) { }
00067 operator unsigned long () const { return ref; }
00068 unsigned long& operator++() { return ++ref; }
00069 unsigned long operator++( int ) { return ref++; }
00070 unsigned long& operator--() { return --ref; }
00071 unsigned long operator--( int ) { return ref--; }
00072
00073 unsigned long ref;
00074 };
00075
00076
00077
00078
00079
00080 #define Q_REFCOUNT \
00081 private: \
00082 QtULong qtrefcount; \
00083 public: \
00084 ulong addRef() {return qtrefcount++;} \
00085 ulong release() {if(!--qtrefcount){delete this;return 0;}return qtrefcount;}
00086
00087 #ifndef Q_EXTERN_C
00088 #define Q_EXTERN_C extern "C"
00089 #endif
00090
00091
00092
00093 #ifndef IID_QUnknown
00094 #define IID_QUnknown QUuid(0x1d8518cd, 0xe8f5, 0x4366, 0x99, 0xe8, 0x87, 0x9f, 0xd7, 0xe4, 0x82, 0xde)
00095 #endif
00096
00097 struct QUnknownInterface
00098 {
00099 virtual QRESULT queryInterface( const QUuid&, QUnknownInterface** ) = 0;
00100 virtual ulong addRef() = 0;
00101 virtual ulong release() = 0;
00102 };
00103
00104
00105 #ifndef IID_QComponentInformation
00106 #define IID_QComponentInformation QUuid(0x5f3968a5, 0xf451, 0x45b1, 0x96, 0xfb, 0x6, 0x1a, 0xd9, 0x8f, 0x92, 0x6e)
00107 #endif
00108
00109 struct QComponentInformationInterface : public QUnknownInterface
00110 {
00111 virtual QString name() const = 0;
00112 virtual QString description() const = 0;
00113 virtual QString author() const = 0;
00114 virtual QString version() const = 0;
00115 };
00116
00117
00118 #ifndef IID_QComponentRegistration
00119 #define IID_QComponentRegistration QUuid( 0xb5feb5de, 0xe0cd, 0x4e37, 0xb0, 0xeb, 0x8a, 0x81, 0x24, 0x99, 0xa0, 0xc1)
00120 #endif
00121
00122 struct QComponentRegistrationInterface : public QUnknownInterface
00123 {
00124 virtual bool registerComponents( const QString &filepath ) const = 0;
00125 virtual bool unregisterComponents() const = 0;
00126 };
00127
00128 #ifndef IID_QLibrary
00129 #define IID_QLibrary QUuid( 0xd16111d4, 0xe1e7, 0x4c47, 0x85, 0x99, 0x24, 0x48, 0x3d, 0xae, 0x2e, 0x07)
00130 #endif
00131
00132 struct Q_EXPORT QLibraryInterface : public QUnknownInterface
00133 {
00134 virtual bool init() = 0;
00135 virtual void cleanup() = 0;
00136 virtual bool canUnload() const = 0;
00137 };
00138
00139 #define Q_CREATE_INSTANCE( IMPLEMENTATION ) \
00140 { \
00141 IMPLEMENTATION *i = new IMPLEMENTATION; \
00142 QUnknownInterface* iface = 0; \
00143 QRESULT rt; \
00144 rt = i->queryInterface( IID_QUnknown, &iface ); \
00145 if(rt == QS_OK) \
00146 return iface; \
00147 delete i; \
00148 return NULL; \
00149 }
00150
00151 #define Q_EXPORT_INTERFACE() extern "C" QUnknownInterface* ucm_instantiate()
00152
00153 #define EZX_CREATE_INSTANCE( IMPLEMENTATION ) Q_CREATE_INSTANCE( IMPLEMENTATION )
00154 #define EZX_EXPORT_INTERFACE() Q_EXPORT_INTERFACE()
00155
00156 #endif //QCOM_H