<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qscriptengineagent.cpp --> <title>Qt 4.8: QScriptEngineAgent Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qtscript.html">QtScript</a></li> <li>QScriptEngineAgent</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QScriptEngineAgent Class Reference</h1> <!-- $$$QScriptEngineAgent-brief --> <p>The QScriptEngineAgent class provides an interface to report events pertaining to <a href="qscriptengine.html">QScriptEngine</a> execution. <a href="#details">More...</a></p> <!-- @@@QScriptEngineAgent --> <pre class="cpp"> <span class="preprocessor">#include <QScriptEngineAgent></span></pre><p>This class was introduced in Qt 4.4.</p> <ul> <li><a href="qscriptengineagent-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#Extension-enum">Extension</a></b> { DebuggerInvocationRequest }</td></tr> </table> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#QScriptEngineAgent">QScriptEngineAgent</a></b> ( QScriptEngine * <i>engine</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#dtor.QScriptEngineAgent">~QScriptEngineAgent</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#contextPop">contextPop</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#contextPush">contextPush</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QScriptEngine * </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#engine">engine</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#exceptionCatch">exceptionCatch</a></b> ( qint64 <i>scriptId</i>, const QScriptValue & <i>exception</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#exceptionThrow">exceptionThrow</a></b> ( qint64 <i>scriptId</i>, const QScriptValue & <i>exception</i>, bool <i>hasHandler</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#extension">extension</a></b> ( Extension <i>extension</i>, const QVariant & <i>argument</i> = QVariant() )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#functionEntry">functionEntry</a></b> ( qint64 <i>scriptId</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#functionExit">functionExit</a></b> ( qint64 <i>scriptId</i>, const QScriptValue & <i>returnValue</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#positionChange">positionChange</a></b> ( qint64 <i>scriptId</i>, int <i>lineNumber</i>, int <i>columnNumber</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#scriptLoad">scriptLoad</a></b> ( qint64 <i>id</i>, const QString & <i>program</i>, const QString & <i>fileName</i>, int <i>baseLineNumber</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#scriptUnload">scriptUnload</a></b> ( qint64 <i>id</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qscriptengineagent.html#supportsExtension">supportsExtension</a></b> ( Extension <i>extension</i> ) const</td></tr> </table> <a name="details"></a> <!-- $$$QScriptEngineAgent-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QScriptEngineAgent class provides an interface to report events pertaining to <a href="qscriptengine.html">QScriptEngine</a> execution.</p> <p>The QScriptEngineAgent class is the basis of tools that monitor and/or control the execution of a <a href="qscriptengine.html">QScriptEngine</a>, such as debuggers and profilers.</p> <p>To process script loading and unloading events, reimplement the <a href="qscriptengineagent.html#scriptLoad">scriptLoad</a>() and <a href="qscriptengineagent.html#scriptUnload">scriptUnload</a>() functions. <a href="qscriptengineagent.html#scriptLoad">scriptLoad</a>() is called after the input to <a href="qscriptengine.html#evaluate">QScriptEngine::evaluate</a>() has been parsed, right before the given script is executed. The engine assigns each script an ID, which is available as one of the arguments to <a href="qscriptengineagent.html#scriptLoad">scriptLoad</a>(); subsequently, other event handlers can use the ID to identify a particular script. One common usage of <a href="qscriptengineagent.html#scriptLoad">scriptLoad</a>() is to retain the script text, filename and base line number (the original input to <a href="qscriptengine.html#evaluate">QScriptEngine::evaluate</a>()), so that other event handlers can e.g. map a line number to the corresponding line of text.</p> <p><a href="qscriptengineagent.html#scriptUnload">scriptUnload</a>() is called when the <a href="qscriptengine.html">QScriptEngine</a> has no further use for a script; the QScriptEngineAgent may at this point safely discard any resources associated with the script (such as the script text). Note that after <a href="qscriptengineagent.html#scriptUnload">scriptUnload</a>() has been called, the <a href="qscriptengine.html">QScriptEngine</a> may reuse the relevant script ID for new scripts (i.e. as argument to a subsequent call to <a href="qscriptengineagent.html#scriptLoad">scriptLoad</a>()).</p> <p>Evaluating the following script will result in <a href="qscriptengineagent.html#scriptUnload">scriptUnload</a>() being called immediately after evaluation has completed:</p> <pre class="cpp"> var a <span class="operator">=</span> Math<span class="operator">.</span>random() <span class="operator">+</span> <span class="number">2</span>;</pre> <p>Evaluating the following script will \b{not} result in a call to <a href="qscriptengineagent.html#scriptUnload">scriptUnload</a>() when evaluation has completed:</p> <pre class="cpp"> function cube(a) { <span class="keyword">return</span> a <span class="operator">*</span> a <span class="operator">*</span> a; } var a <span class="operator">=</span> cube(<span class="number">3</span>);</pre> <p>The script isn't unloaded because it defines a function (<tt>cube</tt>) that remains in the script environment after evaluation has completed. If a subsequent script removed the <tt>cube</tt> function (e.g. by setting it to <tt>null</tt>), <a href="qscriptengineagent.html#scriptUnload">scriptUnload</a>() would be called when the function is garbage collected. In general terms, a script isn't unloaded until the engine has determined that none of its contents is referenced.</p> <p>To process script function calls and returns, reimplement the <a href="qscriptengineagent.html#functionEntry">functionEntry</a>() and <a href="qscriptengineagent.html#functionExit">functionExit</a>() functions. <a href="qscriptengineagent.html#functionEntry">functionEntry</a>() is called when a script function is about to be executed; <a href="qscriptengineagent.html#functionExit">functionExit</a>() is called when a script function is about to return, either normally or due to an exception.</p> <p>To process individual script statements, reimplement <a href="qscriptengineagent.html#positionChange">positionChange</a>(). <a href="qscriptengineagent.html#positionChange">positionChange</a>() is called each time the engine is about to execute a new statement of a script, and thus offers the finest level of script monitoring.</p> <p>To process exceptions, reimplement <a href="qscriptengineagent.html#exceptionThrow">exceptionThrow</a>() and <a href="qscriptengineagent.html#exceptionCatch">exceptionCatch</a>(). <a href="qscriptengineagent.html#exceptionThrow">exceptionThrow</a>() is called when a script exception is thrown, before it has been handled. <a href="qscriptengineagent.html#exceptionCatch">exceptionCatch</a>() is called when an exception handler is present, and execution is about to be resumed at the handler code.</p> </div> <p><b>See also </b><a href="qscriptengine.html#setAgent">QScriptEngine::setAgent</a>() and <a href="qscriptcontextinfo.html">QScriptContextInfo</a>.</p> <!-- @@@QScriptEngineAgent --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$Extension$$$DebuggerInvocationRequest --> <h3 class="fn"><a name="Extension-enum"></a>enum QScriptEngineAgent::<span class="name">Extension</span></h3> <p>This enum specifies the possible extensions to a <a href="qscriptengineagent.html">QScriptEngineAgent</a>.</p> <table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><tt>QScriptEngineAgent::DebuggerInvocationRequest</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">The agent handles <tt>debugger</tt> script statements.</td></tr> </table> <p><b>See also </b><a href="qscriptengineagent.html#extension">extension</a>().</p> <!-- @@@Extension --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QScriptEngineAgent[overload1]$$$QScriptEngineAgentQScriptEngine* --> <h3 class="fn"><a name="QScriptEngineAgent"></a>QScriptEngineAgent::<span class="name">QScriptEngineAgent</span> ( <span class="type"><a href="qscriptengine.html">QScriptEngine</a></span> * <i>engine</i> )</h3> <p>Constructs a <a href="qscriptengineagent.html">QScriptEngineAgent</a> object for the given <i>engine</i>.</p> <p>The engine takes ownership of the agent.</p> <p>Call <a href="qscriptengine.html#setAgent">QScriptEngine::setAgent</a>() to make this agent the active agent.</p> <!-- @@@QScriptEngineAgent --> <!-- $$$~QScriptEngineAgent[overload1]$$$~QScriptEngineAgent --> <h3 class="fn"><a name="dtor.QScriptEngineAgent"></a>QScriptEngineAgent::<span class="name">~QScriptEngineAgent</span> ()<tt> [virtual]</tt></h3> <p>Destroys this <a href="qscriptengineagent.html">QScriptEngineAgent</a>.</p> <!-- @@@~QScriptEngineAgent --> <!-- $$$contextPop[overload1]$$$contextPop --> <h3 class="fn"><a name="contextPop"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">contextPop</span> ()<tt> [virtual]</tt></h3> <p>This function is called when the current script context is about to be popped.</p> <p>The default implementation does nothing.</p> <p><b>See also </b><a href="qscriptengineagent.html#contextPush">contextPush</a>() and <a href="qscriptengineagent.html#functionExit">functionExit</a>().</p> <!-- @@@contextPop --> <!-- $$$contextPush[overload1]$$$contextPush --> <h3 class="fn"><a name="contextPush"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">contextPush</span> ()<tt> [virtual]</tt></h3> <p>This function is called when a new script context has been pushed.</p> <p>The default implementation does nothing.</p> <p><b>See also </b><a href="qscriptengineagent.html#contextPop">contextPop</a>() and <a href="qscriptengineagent.html#functionEntry">functionEntry</a>().</p> <!-- @@@contextPush --> <!-- $$$engine[overload1]$$$engine --> <h3 class="fn"><a name="engine"></a><span class="type"><a href="qscriptengine.html">QScriptEngine</a></span> * QScriptEngineAgent::<span class="name">engine</span> () const</h3> <p>Returns the <a href="qscriptengine.html">QScriptEngine</a> that this agent is associated with.</p> <!-- @@@engine --> <!-- $$$exceptionCatch[overload1]$$$exceptionCatchqint64constQScriptValue& --> <h3 class="fn"><a name="exceptionCatch"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">exceptionCatch</span> ( <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>scriptId</i>, const <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> & <i>exception</i> )<tt> [virtual]</tt></h3> <p>This function is called when the given <i>exception</i> is about to be caught, in the script identified by <i>scriptId</i>.</p> <p>Reimplement this function if you want to handle this event.</p> <p>The default implementation does nothing.</p> <p><b>See also </b><a href="qscriptengineagent.html#exceptionThrow">exceptionThrow</a>().</p> <!-- @@@exceptionCatch --> <!-- $$$exceptionThrow[overload1]$$$exceptionThrowqint64constQScriptValue&bool --> <h3 class="fn"><a name="exceptionThrow"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">exceptionThrow</span> ( <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>scriptId</i>, const <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> & <i>exception</i>, <span class="type">bool</span> <i>hasHandler</i> )<tt> [virtual]</tt></h3> <p>This function is called when the given <i>exception</i> has occurred in the engine, in the script identified by <i>scriptId</i>. If the exception was thrown by a native Qt Script function, <i>scriptId</i> is -1.</p> <p>If <i>hasHandler</i> is true, there is a <tt>catch</tt> or <tt>finally</tt> block that will handle the exception. If <i>hasHandler</i> is false, there is no handler for the exception.</p> <p>Reimplement this function if you want to handle this event. For example, a debugger can notify the user when an uncaught exception occurs (i.e. <i>hasHandler</i> is false).</p> <p>The default implementation does nothing.</p> <p><b>See also </b><a href="qscriptengineagent.html#exceptionCatch">exceptionCatch</a>().</p> <!-- @@@exceptionThrow --> <!-- $$$extension[overload1]$$$extensionExtensionconstQVariant& --> <h3 class="fn"><a name="extension"></a><span class="type"><a href="qvariant.html">QVariant</a></span> QScriptEngineAgent::<span class="name">extension</span> ( <span class="type"><a href="qscriptengineagent.html#Extension-enum">Extension</a></span> <i>extension</i>, const <span class="type"><a href="qvariant.html">QVariant</a></span> & <i>argument</i> = QVariant() )<tt> [virtual]</tt></h3> <p>This virtual function can be reimplemented in a <a href="qscriptengineagent.html">QScriptEngineAgent</a> subclass to provide support for extensions. The optional <i>argument</i> can be provided as input to the <i>extension</i>; the result must be returned in the form of a <a href="qvariant.html">QVariant</a>. You can call <a href="qscriptengineagent.html#supportsExtension">supportsExtension</a>() to check if an extension is supported by the <a href="qscriptengineagent.html">QScriptEngineAgent</a>. By default, no extensions are supported, and this function returns an invalid <a href="qvariant.html">QVariant</a>.</p> <p>If you implement the <a href="qscriptengineagent.html#Extension-enum">DebuggerInvocationRequest</a> extension, Qt Script will call this function when a <tt>debugger</tt> statement is encountered in a script. The <i>argument</i> is a <a href="qvariant.html#QVariantList-typedef">QVariantList</a> containing three items: The first item is the scriptId (a qint64), the second item is the line number (an int), and the third item is the column number (an int).</p> <p><b>See also </b><a href="qscriptengineagent.html#supportsExtension">supportsExtension</a>().</p> <!-- @@@extension --> <!-- $$$functionEntry[overload1]$$$functionEntryqint64 --> <h3 class="fn"><a name="functionEntry"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">functionEntry</span> ( <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>scriptId</i> )<tt> [virtual]</tt></h3> <p>This function is called when a script function is called in the engine. If the script function is not a native Qt Script function, it resides in the script identified by <i>scriptId</i>; otherwise, <i>scriptId</i> is -1.</p> <p>This function is called just before execution of the script function begins. You can obtain the <a href="qscriptcontext.html">QScriptContext</a> associated with the function call with <a href="qscriptengine.html#currentContext">QScriptEngine::currentContext</a>(). The arguments passed to the function are available.</p> <p>Reimplement this function to handle this event. For example, a debugger implementation could reimplement this function (and <a href="qscriptengineagent.html#functionExit">functionExit</a>()) to keep track of the call stack and provide step-over functionality.</p> <p>The default implementation does nothing.</p> <p><b>See also </b><a href="qscriptengineagent.html#functionExit">functionExit</a>(), <a href="qscriptengineagent.html#positionChange">positionChange</a>(), and <a href="qscriptengine.html#currentContext">QScriptEngine::currentContext</a>().</p> <!-- @@@functionEntry --> <!-- $$$functionExit[overload1]$$$functionExitqint64constQScriptValue& --> <h3 class="fn"><a name="functionExit"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">functionExit</span> ( <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>scriptId</i>, const <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> & <i>returnValue</i> )<tt> [virtual]</tt></h3> <p>This function is called when the currently executing script function is about to return. If the script function is not a native Qt Script function, it resides in the script identified by <i>scriptId</i>; otherwise, <i>scriptId</i> is -1. The <i>returnValue</i> is the value that the script function will return.</p> <p>This function is called just before the script function returns. You can still access the <a href="qscriptcontext.html">QScriptContext</a> associated with the script function call with <a href="qscriptengine.html#currentContext">QScriptEngine::currentContext</a>().</p> <p>If the engine's <a href="qscriptengine.html#hasUncaughtException">hasUncaughtException</a>() function returns true, the script function is exiting due to an exception; otherwise, the script function is returning normally.</p> <p>Reimplement this function to handle this event; typically you will then also want to reimplement <a href="qscriptengineagent.html#functionEntry">functionEntry</a>().</p> <p>The default implementation does nothing.</p> <p><b>See also </b><a href="qscriptengineagent.html#functionEntry">functionEntry</a>() and <a href="qscriptengine.html#hasUncaughtException">QScriptEngine::hasUncaughtException</a>().</p> <!-- @@@functionExit --> <!-- $$$positionChange[overload1]$$$positionChangeqint64intint --> <h3 class="fn"><a name="positionChange"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">positionChange</span> ( <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>scriptId</i>, <span class="type">int</span> <i>lineNumber</i>, <span class="type">int</span> <i>columnNumber</i> )<tt> [virtual]</tt></h3> <p>This function is called when the engine is about to execute a new statement in the script identified by <i>scriptId</i>. The statement begins on the line and column specified by <i>lineNumber</i> This event is not generated for native Qt Script functions.</p> <p>Reimplement this function to handle this event. For example, a debugger implementation could reimplement this function to provide line-by-line stepping, and a profiler implementation could use it to count the number of times each statement is executed.</p> <p>The default implementation does nothing.</p> <p><b>Note:</b> <i>columnNumber</i> is undefined</p> <p><b>See also </b><a href="qscriptengineagent.html#scriptLoad">scriptLoad</a>() and <a href="qscriptengineagent.html#functionEntry">functionEntry</a>().</p> <!-- @@@positionChange --> <!-- $$$scriptLoad[overload1]$$$scriptLoadqint64constQString&constQString&int --> <h3 class="fn"><a name="scriptLoad"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">scriptLoad</span> ( <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>id</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>program</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>fileName</i>, <span class="type">int</span> <i>baseLineNumber</i> )<tt> [virtual]</tt></h3> <p>This function is called when the engine has parsed a script and has associated it with the given <i>id</i>. The id can be used to identify this particular script in subsequent event notifications.</p> <p><i>program</i>, <i>fileName</i> and <i>baseLineNumber</i> are the original arguments to the <a href="qscriptengine.html#evaluate">QScriptEngine::evaluate</a>() call that triggered this event.</p> <p>This function is called just before the script is about to be evaluated.</p> <p>You can reimplement this function to record information about the script; for example, by retaining the script text, you can obtain the line of text corresponding to a line number in a subsequent call to <a href="qscriptengineagent.html#positionChange">positionChange</a>().</p> <p>The default implementation does nothing.</p> <p><b>See also </b><a href="qscriptengineagent.html#scriptUnload">scriptUnload</a>().</p> <!-- @@@scriptLoad --> <!-- $$$scriptUnload[overload1]$$$scriptUnloadqint64 --> <h3 class="fn"><a name="scriptUnload"></a><span class="type">void</span> QScriptEngineAgent::<span class="name">scriptUnload</span> ( <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>id</i> )<tt> [virtual]</tt></h3> <p>This function is called when the engine has discarded the script identified by the given <i>id</i>.</p> <p>You can reimplement this function to clean up any resources you have associated with the script.</p> <p>The default implementation does nothing.</p> <p><b>See also </b><a href="qscriptengineagent.html#scriptLoad">scriptLoad</a>().</p> <!-- @@@scriptUnload --> <!-- $$$supportsExtension[overload1]$$$supportsExtensionExtension --> <h3 class="fn"><a name="supportsExtension"></a><span class="type">bool</span> QScriptEngineAgent::<span class="name">supportsExtension</span> ( <span class="type"><a href="qscriptengineagent.html#Extension-enum">Extension</a></span> <i>extension</i> ) const<tt> [virtual]</tt></h3> <p>Returns true if the <a href="qscriptengineagent.html">QScriptEngineAgent</a> supports the given <i>extension</i>; otherwise, false is returned. By default, no extensions are supported.</p> <p><b>See also </b><a href="qscriptengineagent.html#extension">extension</a>().</p> <!-- @@@supportsExtension --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>