1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qaxscript.h:1 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>qaxscript.h Include File</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qaxscript.h</h1>
|
---|
33 |
|
---|
34 | <p>This is the verbatim text of the qaxscript.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
35 | <hr>
|
---|
36 | <pre>
|
---|
37 | /****************************************************************************
|
---|
38 | ** $Id: qaxscript-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
39 | **
|
---|
40 | ** Declaration of the QAxScriptEngine, QAxScript and QAxScriptManager classes
|
---|
41 | **
|
---|
42 | ** Copyright (C) 2002-2007 Trolltech ASA. All rights reserved.
|
---|
43 | **
|
---|
44 | ** This file is part of the Active Qt integration.
|
---|
45 | **
|
---|
46 | ** Licensees holding valid Qt Enterprise Edition
|
---|
47 | ** licenses for Windows may use this file in accordance with the Qt Commercial
|
---|
48 | ** License Agreement provided with the Software.
|
---|
49 | **
|
---|
50 | ** This file is not available for use under any other license without
|
---|
51 | ** express written permission from the copyright holder.
|
---|
52 | **
|
---|
53 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
54 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
55 | **
|
---|
56 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
57 | ** information about Qt Commercial License Agreements.
|
---|
58 | **
|
---|
59 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
60 | ** not clear to you.
|
---|
61 | **
|
---|
62 | **********************************************************************/
|
---|
63 |
|
---|
64 | #ifndef QAXSCRIPT_H
|
---|
65 | #define QAXSCRIPT_H
|
---|
66 |
|
---|
67 | #include <qaxobject.h>
|
---|
68 |
|
---|
69 | class QAxBase;
|
---|
70 | class QAxScript;
|
---|
71 | class QAxScriptSite;
|
---|
72 | class QAxScriptEngine;
|
---|
73 | class QAxScriptManager;
|
---|
74 | class QAxScriptManagerPrivate;
|
---|
75 | struct IActiveScript;
|
---|
76 |
|
---|
77 | class QAxScriptEngine : public QAxObject
|
---|
78 | {
|
---|
79 | public:
|
---|
80 | enum State {
|
---|
81 | Uninitialized = 0,
|
---|
82 | Initialized = 5,
|
---|
83 | Started = 1,
|
---|
84 | Connected = 2,
|
---|
85 | Disconnected = 3,
|
---|
86 | Closed = 4
|
---|
87 | };
|
---|
88 |
|
---|
89 | QAxScriptEngine(const QString &language, QAxScript *script);
|
---|
90 | ~QAxScriptEngine();
|
---|
91 |
|
---|
92 | bool isValid() const;
|
---|
93 | bool hasIntrospection() const;
|
---|
94 |
|
---|
95 | QString scriptLanguage() const;
|
---|
96 |
|
---|
97 | State state() const;
|
---|
98 | void setState(State st);
|
---|
99 |
|
---|
100 | void addItem(const QString &name);
|
---|
101 |
|
---|
102 | long queryInterface( const QUuid &, void** ) const;
|
---|
103 |
|
---|
104 | protected:
|
---|
105 | bool initialize(IUnknown** ptr);
|
---|
106 |
|
---|
107 | private:
|
---|
108 | QAxScript *script_code;
|
---|
109 | IActiveScript *engine;
|
---|
110 |
|
---|
111 | QString script_language;
|
---|
112 | };
|
---|
113 |
|
---|
114 | class QAxScript : public QObject
|
---|
115 | {
|
---|
116 | Q_OBJECT
|
---|
117 |
|
---|
118 | public:
|
---|
119 | enum FunctionFlags {
|
---|
120 | FunctionNames = 0,
|
---|
121 | FunctionSignatures
|
---|
122 | };
|
---|
123 |
|
---|
124 | QAxScript(const QString &name, QAxScriptManager *manager);
|
---|
125 | ~QAxScript();
|
---|
126 |
|
---|
127 | bool load(const QString &code, const QString &language = QString::null);
|
---|
128 |
|
---|
129 | QStringList functions(FunctionFlags = FunctionNames) const;
|
---|
130 |
|
---|
131 | QString scriptCode() const;
|
---|
132 | QString scriptName() const;
|
---|
133 | QAxScriptEngine *scriptEngine() const;
|
---|
134 |
|
---|
135 | QVariant call(const QString &function, const QVariant &v1 = QVariant(),
|
---|
136 | const QVariant &v2 = QVariant(),
|
---|
137 | const QVariant &v3 = QVariant(),
|
---|
138 | const QVariant &v4 = QVariant(),
|
---|
139 | const QVariant &v5 = QVariant(),
|
---|
140 | const QVariant &v6 = QVariant(),
|
---|
141 | const QVariant &v7 = QVariant(),
|
---|
142 | const QVariant &v8 = QVariant());
|
---|
143 | QVariant call(const QString &function, QValueList<QVariant> &arguments);
|
---|
144 |
|
---|
145 | signals:
|
---|
146 | void entered();
|
---|
147 | void finished();
|
---|
148 | void finished(const QVariant &result);
|
---|
149 | void finished(int code, const QString &source,const QString &description, const QString &help);
|
---|
150 | void stateChanged(int state);
|
---|
151 | void error(int code, const QString &description, int sourcePosition, const QString &sourceText);
|
---|
152 |
|
---|
153 | private:
|
---|
154 | friend class QAxScriptSite;
|
---|
155 | friend class QAxScriptEngine;
|
---|
156 |
|
---|
157 | void updateObjects();
|
---|
158 | QAxBase *findObject(const QString &name);
|
---|
159 |
|
---|
160 | QString script_name;
|
---|
161 | QString script_code;
|
---|
162 | QAxScriptManager *script_manager;
|
---|
163 | QAxScriptEngine *script_engine;
|
---|
164 | QAxScriptSite *script_site;
|
---|
165 | };
|
---|
166 |
|
---|
167 | class QAxScriptManager : public QObject
|
---|
168 | {
|
---|
169 | Q_OBJECT
|
---|
170 |
|
---|
171 | public:
|
---|
172 | QAxScriptManager( QObject *parent = 0, const char *name = 0 );
|
---|
173 | ~QAxScriptManager();
|
---|
174 |
|
---|
175 | void addObject(QAxBase *object);
|
---|
176 | void addObject(QObject *object);
|
---|
177 |
|
---|
178 | QStringList functions(QAxScript::FunctionFlags = QAxScript::FunctionNames) const;
|
---|
179 | QStringList scriptNames() const;
|
---|
180 | QAxScript *script(const QString &name) const;
|
---|
181 |
|
---|
182 | QAxScript* load(const QString &code, const QString &name, const QString &language);
|
---|
183 | QAxScript* load(const QString &file, const QString &name);
|
---|
184 |
|
---|
185 | QVariant call(const QString &function, const QVariant &v1 = QVariant(),
|
---|
186 | const QVariant &v2 = QVariant(),
|
---|
187 | const QVariant &v3 = QVariant(),
|
---|
188 | const QVariant &v4 = QVariant(),
|
---|
189 | const QVariant &v5 = QVariant(),
|
---|
190 | const QVariant &v6 = QVariant(),
|
---|
191 | const QVariant &v7 = QVariant(),
|
---|
192 | const QVariant &v8 = QVariant());
|
---|
193 | QVariant call(const QString &function, QValueList<QVariant> &arguments);
|
---|
194 |
|
---|
195 | static bool registerEngine(const QString &name, const QString &extension, const QString &code = QString());
|
---|
196 | static QString scriptFileFilter();
|
---|
197 |
|
---|
198 | signals:
|
---|
199 | void error(QAxScript *script, int code, const QString &description, int sourcePosition, const QString &sourceText);
|
---|
200 |
|
---|
201 | private slots:
|
---|
202 | void objectDestroyed(QObject *o);
|
---|
203 | void scriptError(int code, const QString &description, int sourcePosition, const QString &sourceText);
|
---|
204 |
|
---|
205 | private:
|
---|
206 | friend class QAxScript;
|
---|
207 | QAxScriptManagerPrivate *d;
|
---|
208 |
|
---|
209 | void updateScript(QAxScript*);
|
---|
210 | QAxScript *scriptForFunction(const QString &function) const;
|
---|
211 | };
|
---|
212 |
|
---|
213 |
|
---|
214 | // QAxScript inlines
|
---|
215 |
|
---|
216 | inline QString QAxScript::scriptCode() const
|
---|
217 | {
|
---|
218 | return script_code;
|
---|
219 | }
|
---|
220 |
|
---|
221 | inline QString QAxScript::scriptName() const
|
---|
222 | {
|
---|
223 | return script_name;
|
---|
224 | }
|
---|
225 |
|
---|
226 | inline QAxScriptEngine *QAxScript::scriptEngine() const
|
---|
227 | {
|
---|
228 | return script_engine;
|
---|
229 | }
|
---|
230 |
|
---|
231 | // QAxScriptEngine inlines
|
---|
232 |
|
---|
233 | inline bool QAxScriptEngine::isValid() const
|
---|
234 | {
|
---|
235 | return engine != 0;
|
---|
236 | }
|
---|
237 |
|
---|
238 | inline QString QAxScriptEngine::scriptLanguage() const
|
---|
239 | {
|
---|
240 | return script_language;
|
---|
241 | }
|
---|
242 |
|
---|
243 | // QAxScriptManager inlines
|
---|
244 |
|
---|
245 | inline void QAxScriptManager::addObject(QObject *object)
|
---|
246 | {
|
---|
247 | extern QAxBase *qax_create_object_wrapper(QObject*);
|
---|
248 | QAxBase *wrapper = qax_create_object_wrapper(object);
|
---|
249 | addObject(wrapper);
|
---|
250 | }
|
---|
251 |
|
---|
252 | #endif // QAXSCRIPT_H
|
---|
253 | </pre>
|
---|
254 | <!-- eof -->
|
---|
255 | <p><address><hr><div align=center>
|
---|
256 | <table width=100% cellspacing=0 border=0><tr>
|
---|
257 | <td>Copyright © 2007
|
---|
258 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
259 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
260 | </table></div></address></body>
|
---|
261 | </html>
|
---|