source: trunk/include/qgplugin.h@ 137

Last change on this file since 137 was 99, checked in by dmik, 19 years ago

Plugin Support: Fixed: Q_EXPORT_PLUGIN and Q_EXPORT_COMPONENT macros procudced entry points with underscores, but resolved them without. Now, entry points use the _System decl to prevent underscores at all.

  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1/****************************************************************************
2** $Id: qgplugin.h 99 2006-07-21 19:24:43Z dmik $
3**
4** ...
5**
6** Copyright (C) 2001-2002 Trolltech AS. All rights reserved.
7**
8** This file is part of the kernel module of the Qt GUI Toolkit.
9**
10** This file may be distributed under the terms of the Q Public License
11** as defined by Trolltech AS of Norway and appearing in the file
12** LICENSE.QPL included in the packaging of this file.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
20** licenses may use this file in accordance with the Qt Commercial License
21** Agreement provided with the Software.
22**
23** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25**
26** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27** information about Qt Commercial License Agreements.
28** See http://www.trolltech.com/qpl/ for QPL licensing information.
29** See http://www.trolltech.com/gpl/ for GPL licensing information.
30**
31** Contact info@trolltech.com if any conditions of this licensing are
32** not clear to you.
33**
34**********************************************************************/
35
36#ifndef QGPLUGIN_H
37#define QGPLUGIN_H
38
39//
40// W A R N I N G
41// -------------
42//
43// This file is not part of the Qt API. It exists for the convenience
44// of a number of Qt sources files. This header file may change from
45// version to version without notice, or even be removed.
46//
47// We mean it.
48//
49//
50
51#ifndef QT_H
52#include "qobject.h"
53#endif // QT_H
54
55#ifndef QT_NO_COMPONENT
56
57#ifndef Q_EXTERN_C
58#ifdef __cplusplus
59#define Q_EXTERN_C extern "C"
60#else
61#define Q_EXTERN_C extern
62#endif
63#endif
64
65#ifndef Q_EXPORT_PLUGIN
66#if defined(QT_THREAD_SUPPORT)
67#define QT_THREADED_BUILD 1
68#define Q_PLUGIN_FLAGS_STRING "11"
69#else
70#define QT_THREADED_BUILD 0
71#define Q_PLUGIN_FLAGS_STRING "01"
72#endif
73
74// this is duplicated at Q_UCM_VERIFICATION_DATA in qcom_p.h
75// NOTE: if you change pattern, you MUST change the pattern in
76// qcomlibrary.cpp as well. changing the pattern will break all
77// backwards compatibility as well (no old plugins will be loaded).
78#ifndef Q_PLUGIN_VERIFICATION_DATA
79# define Q_PLUGIN_VERIFICATION_DATA \
80 static const char *qt_ucm_verification_data = \
81 "pattern=""QT_UCM_VERIFICATION_DATA""\n" \
82 "version="QT_VERSION_STR"\n" \
83 "flags="Q_PLUGIN_FLAGS_STRING"\n" \
84 "buildkey="QT_BUILD_KEY"\0";
85#endif // Q_PLUGIN_VERIFICATION_DATA
86
87#define Q_PLUGIN_INSTANTIATE( IMPLEMENTATION ) \
88 { \
89 IMPLEMENTATION *i = new IMPLEMENTATION; \
90 return i->iface(); \
91 }
92
93# if defined(Q_WS_WIN)
94# ifdef Q_CC_BOR
95# define Q_EXPORT_PLUGIN(PLUGIN) \
96 Q_PLUGIN_VERIFICATION_DATA \
97 Q_EXTERN_C __declspec(dllexport) \
98 const char * __stdcall qt_ucm_query_verification_data() \
99 { return qt_ucm_verification_data; } \
100 Q_EXTERN_C __declspec(dllexport) QUnknownInterface* \
101 __stdcall ucm_instantiate() \
102 Q_PLUGIN_INSTANTIATE( PLUGIN )
103# else
104# define Q_EXPORT_PLUGIN(PLUGIN) \
105 Q_PLUGIN_VERIFICATION_DATA \
106 Q_EXTERN_C __declspec(dllexport) \
107 const char *qt_ucm_query_verification_data() \
108 { return qt_ucm_verification_data; } \
109 Q_EXTERN_C __declspec(dllexport) QUnknownInterface* ucm_instantiate() \
110 Q_PLUGIN_INSTANTIATE( PLUGIN )
111# endif
112# elif defined(Q_OS_OS2)
113# define Q_EXPORT_PLUGIN(PLUGIN) \
114 Q_PLUGIN_VERIFICATION_DATA \
115 Q_EXTERN_C \
116 const char * _System qt_ucm_query_verification_data() \
117 { return qt_ucm_verification_data; } \
118 Q_EXTERN_C QUnknownInterface * _System ucm_instantiate() \
119 Q_PLUGIN_INSTANTIATE( PLUGIN )
120# else
121# define Q_EXPORT_PLUGIN(PLUGIN) \
122 Q_PLUGIN_VERIFICATION_DATA \
123 Q_EXTERN_C \
124 const char *qt_ucm_query_verification_data() \
125 { return qt_ucm_verification_data; } \
126 Q_EXTERN_C QUnknownInterface* ucm_instantiate() \
127 Q_PLUGIN_INSTANTIATE( PLUGIN )
128# endif
129
130#endif
131
132struct QUnknownInterface;
133
134class Q_EXPORT QGPlugin : public QObject
135{
136 Q_OBJECT
137public:
138 QGPlugin( QUnknownInterface *i );
139 ~QGPlugin();
140
141 QUnknownInterface* iface();
142 void setIface( QUnknownInterface *iface );
143
144private:
145 QGPlugin();
146 QUnknownInterface* _iface;
147};
148
149#endif // QT_NO_COMPONENT
150
151#endif // QGPLUGIN_H
Note: See TracBrowser for help on using the repository browser.