source: trunk/doc/html/qaxscript-h.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 7.8 KB
Line 
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"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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 &lt;qaxobject.h&gt;
68
69class QAxBase;
70class QAxScript;
71class QAxScriptSite;
72class QAxScriptEngine;
73class QAxScriptManager;
74class QAxScriptManagerPrivate;
75struct IActiveScript;
76
77class QAxScriptEngine : public QAxObject
78{
79public:
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 &amp;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 &amp;name);
101
102 long queryInterface( const QUuid &amp;, void** ) const;
103
104protected:
105 bool initialize(IUnknown** ptr);
106
107private:
108 QAxScript *script_code;
109 IActiveScript *engine;
110
111 QString script_language;
112};
113
114class QAxScript : public QObject
115{
116 Q_OBJECT
117
118public:
119 enum FunctionFlags {
120 FunctionNames = 0,
121 FunctionSignatures
122 };
123
124 QAxScript(const QString &amp;name, QAxScriptManager *manager);
125 ~QAxScript();
126
127 bool load(const QString &amp;code, const QString &amp;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 &amp;function, const QVariant &amp;v1 = QVariant(),
136 const QVariant &amp;v2 = QVariant(),
137 const QVariant &amp;v3 = QVariant(),
138 const QVariant &amp;v4 = QVariant(),
139 const QVariant &amp;v5 = QVariant(),
140 const QVariant &amp;v6 = QVariant(),
141 const QVariant &amp;v7 = QVariant(),
142 const QVariant &amp;v8 = QVariant());
143 QVariant call(const QString &amp;function, QValueList&lt;QVariant&gt; &amp;arguments);
144
145signals:
146 void entered();
147 void finished();
148 void finished(const QVariant &amp;result);
149 void finished(int code, const QString &amp;source,const QString &amp;description, const QString &amp;help);
150 void stateChanged(int state);
151 void error(int code, const QString &amp;description, int sourcePosition, const QString &amp;sourceText);
152
153private:
154 friend class QAxScriptSite;
155 friend class QAxScriptEngine;
156
157 void updateObjects();
158 QAxBase *findObject(const QString &amp;name);
159
160 QString script_name;
161 QString script_code;
162 QAxScriptManager *script_manager;
163 QAxScriptEngine *script_engine;
164 QAxScriptSite *script_site;
165};
166
167class QAxScriptManager : public QObject
168{
169 Q_OBJECT
170
171public:
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 &amp;name) const;
181
182 QAxScript* load(const QString &amp;code, const QString &amp;name, const QString &amp;language);
183 QAxScript* load(const QString &amp;file, const QString &amp;name);
184
185 QVariant call(const QString &amp;function, const QVariant &amp;v1 = QVariant(),
186 const QVariant &amp;v2 = QVariant(),
187 const QVariant &amp;v3 = QVariant(),
188 const QVariant &amp;v4 = QVariant(),
189 const QVariant &amp;v5 = QVariant(),
190 const QVariant &amp;v6 = QVariant(),
191 const QVariant &amp;v7 = QVariant(),
192 const QVariant &amp;v8 = QVariant());
193 QVariant call(const QString &amp;function, QValueList&lt;QVariant&gt; &amp;arguments);
194
195 static bool registerEngine(const QString &amp;name, const QString &amp;extension, const QString &amp;code = QString());
196 static QString scriptFileFilter();
197
198signals:
199 void error(QAxScript *script, int code, const QString &amp;description, int sourcePosition, const QString &amp;sourceText);
200
201private slots:
202 void objectDestroyed(QObject *o);
203 void scriptError(int code, const QString &amp;description, int sourcePosition, const QString &amp;sourceText);
204
205private:
206 friend class QAxScript;
207 QAxScriptManagerPrivate *d;
208
209 void updateScript(QAxScript*);
210 QAxScript *scriptForFunction(const QString &amp;function) const;
211};
212
213
214// QAxScript inlines
215
216inline QString QAxScript::scriptCode() const
217{
218 return script_code;
219}
220
221inline QString QAxScript::scriptName() const
222{
223 return script_name;
224}
225
226inline QAxScriptEngine *QAxScript::scriptEngine() const
227{
228 return script_engine;
229}
230
231// QAxScriptEngine inlines
232
233inline bool QAxScriptEngine::isValid() const
234{
235 return engine != 0;
236}
237
238inline QString QAxScriptEngine::scriptLanguage() const
239{
240 return script_language;
241}
242
243// QAxScriptManager inlines
244
245inline 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 &copy; 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>
Note: See TracBrowser for help on using the repository browser.