1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qscriptextensionplugin.cpp -->
<head>
<title>QScriptExtensionPlugin Class Reference</title>
<link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
</tr></table><h1 class="title">QScriptExtensionPlugin Class Reference<br /><span class="small-subtitle">[<a href="http://qt.nokia.com/doc/4.6/qtscript.html">QtScript</a> module]</span>
</h1>
<p>The QScriptExtensionPlugin class provides an abstract base for custom QScript extension plugins. <a href="#details">More...</a></p>
<pre> #include <QScriptExtensionPlugin></pre><p><b>This class is not part of the Qt GUI Framework Edition.</b></p>
<p>Inherits <a href="http://qt.nokia.com/doc/4.6/qobject.html">QObject</a>.</p>
<p>This class was introduced in qtscriptclassic 4.3.</p>
<ul>
<li><a href="qscriptextensionplugin-members.html">List of all members, including inherited members</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qscriptextensionplugin.html#QScriptExtensionPlugin">QScriptExtensionPlugin</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qscriptextensionplugin.html#dtor.QScriptExtensionPlugin">~QScriptExtensionPlugin</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qscriptextensionplugin.html#keys">keys</a></b> () const = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QScriptValue </td><td class="memItemRight" valign="bottom"><b><a href="qscriptextensionplugin.html#setupPackage">setupPackage</a></b> ( const QString & <i>key</i>, QScriptEngine * <i>engine</i> ) const</td></tr>
</table>
<hr />
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qscriptextensionplugin.html#initialize">initialize</a></b> ( const QString & <i>key</i>, QScriptEngine * <i>engine</i> ) = 0</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>1 property inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#properties">QObject</a></li>
<li><div class="fn"></div>1 public slot inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-slots">QObject</a></li>
<li><div class="fn"></div>1 signal inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#signals">QObject</a></li>
<li><div class="fn"></div>1 public type inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-variables">QObject</a></li>
<li><div class="fn"></div>4 static public members inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"></div>7 protected functions inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"></div>2 protected variables inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QScriptExtensionPlugin class provides an abstract base for custom QScript extension plugins.</p>
<p>QScriptExtensionPlugin is a plugin interface that makes it possible to offer extensions that can be loaded dynamically into applications using the <a href="qscriptengine.html">QScriptEngine</a> class.</p>
<p>Writing a script extension plugin is achieved by subclassing this base class, reimplementing the pure virtual <a href="qscriptextensionplugin.html#keys">keys</a>() and <a href="qscriptextensionplugin.html#initialize">initialize</a>() functions, and exporting the class using the <a href="http://qt.nokia.com/doc/4.6/qtplugin.html#Q_EXPORT_PLUGIN2">Q_EXPORT_PLUGIN2</a>() macro. See <a href="http://qt.nokia.com/doc/4.6/plugins-howto.html">How to Create Qt Plugins</a> for details.</p>
<p>See also <a href="qscriptengine.html#importExtension">QScriptEngine::importExtension</a>() and <a href="http://qt.nokia.com/doc/4.6/qtscriptextensions.html">Creating QtScript Extensions</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QScriptExtensionPlugin"></a>QScriptExtensionPlugin::QScriptExtensionPlugin ( <a href="http://qt.nokia.com/doc/4.6/qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a script extension plugin with the given <i>parent</i>.</p>
<p>Note that this constructor is invoked automatically by the <a href="http://qt.nokia.com/doc/4.6/qtplugin.html#Q_EXPORT_PLUGIN2">Q_EXPORT_PLUGIN2</a>() macro, so there is no need for calling it explicitly.</p>
<h3 class="fn"><a name="dtor.QScriptExtensionPlugin"></a>QScriptExtensionPlugin::~QScriptExtensionPlugin ()</h3>
<p>Destroys the script extension plugin.</p>
<p>Note that Qt destroys a plugin automatically when it is no longer used, so there is no need for calling the destructor explicitly.</p>
<h3 class="fn"><a name="initialize"></a>void QScriptExtensionPlugin::initialize ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> & <i>key</i>, <a href="qscriptengine.html">QScriptEngine</a> * <i>engine</i> ) <tt> [pure virtual]</tt></h3>
<p>Initializes the extension specified by <i>key</i> in the given <i>engine</i>. The key must come from the set of <a href="qscriptextensionplugin.html#keys">keys</a>().</p>
<p>See also <a href="qscriptextensionplugin.html#keys">keys</a>().</p>
<h3 class="fn"><a name="keys"></a><a href="http://qt.nokia.com/doc/4.6/qstringlist.html">QStringList</a> QScriptExtensionPlugin::keys () const <tt> [pure virtual]</tt></h3>
<p>Returns the list of keys this plugin supports.</p>
<p>These keys are usually the names of the "modules" or "packages" that are implemented in the plugin (e.g. <tt>com.mycompany.MyProduct</tt>).</p>
<p>See also <a href="qscriptextensionplugin.html#initialize">initialize</a>().</p>
<h3 class="fn"><a name="setupPackage"></a><a href="qscriptvalue.html">QScriptValue</a> QScriptExtensionPlugin::setupPackage ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> & <i>key</i>, <a href="qscriptengine.html">QScriptEngine</a> * <i>engine</i> ) const</h3>
<p>This function is provided for convenience when reimplementing <a href="qscriptextensionplugin.html#initialize">initialize</a>(). It splits the given <i>key</i> on <tt>'.'</tt> (dot), and ensures that there's a corresponding path of objects in the environment of the given <i>engine</i>, creating new objects to complete the path if necessary. E.g. if the key is "com.trolltech", after the call to setupPackage() the script expression <tt>com.trolltech</tt> will evaluate to an object. More specifically, the engine's Global Object will have a property called "com", which in turn has a property called "trolltech".</p>
<p>Use this function to avoid global namespace pollution when installing your extensions in the engine.</p>
<p>See also <a href="qscriptextensionplugin.html#initialize">initialize</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
</tr></table></div></address></body>
</html>
|