Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

qcom.h

Go to the documentation of this file.
00001 /****************************************************************************
00002  ** $Id:  qt/qlibrary.h   3.0.0   edited Sep 20 19:46 $
00003  **
00004  ** Definition of QLibrary class
00005  **
00006  ** Created : 2000-01-01
00007  **
00008  ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00009  **
00010  ** This file is part of the kernel module of the Qt GUI Toolkit.
00011  **
00012  ** This file may be distributed under the terms of the Q Public License
00013  ** as defined by Trolltech AS of Norway and appearing in the file
00014  ** LICENSE.QPL included in the packaging of this file.
00015  **
00016  ** This file may be distributed and/or modified under the terms of the
00017  ** GNU General Public License version 2 as published by the Free Software
00018  ** Foundation and appearing in the file LICENSE.GPL included in the
00019  ** packaging of this file.
00020  **
00021  ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022  ** licenses may use this file in accordance with the Qt Commercial License
00023  ** Agreement provided with the Software.
00024  **
00025  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027  **
00028  ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029  **       information about Qt Commercial License Agreements.
00030  ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031  ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032  **
00033  ** Contact info@trolltech.com if any conditions of this licensing are
00034  ** not clear to you.
00035  **
00036  **     Modified by BJDC, Motorola 
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  * internal class that wraps an initialized ulong
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  * Default implementation of ref counting.
00078  * A variable "ulong ref" has to be a member
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 // {1D8518CD-E8F5-4366-99E8-879FD7E482DE}
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 // {5F3968A5-F451-45b1-96FB-061AD98F926E}
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 // {B5FEB5DE-E0CD-4E37-B0EB-8A812499A0C1}
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

Generated at Wed Mar 3 13:21:57 2004 by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001