summaryrefslogtreecommitdiffstats
path: root/qtscriptclassic/doc/html/qscriptengine-obsolete.html
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2010-10-06 12:57:48 +0200
committeraavit <qt-info@nokia.com>2010-10-06 12:57:48 +0200
commit5019ece540d1f9dc08157f67b55d1c4ed896ae39 (patch)
tree2983f19a546336def390f7a43fa4f8426eea8bc8 /qtscriptclassic/doc/html/qscriptengine-obsolete.html
Long live the Qt Solutions archive!
This commit adds the contents of distribution packages of the relevant subset of the Qt Solutions components, generated from the last versions in Perforce.
Diffstat (limited to 'qtscriptclassic/doc/html/qscriptengine-obsolete.html')
-rw-r--r--qtscriptclassic/doc/html/qscriptengine-obsolete.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/qtscriptclassic/doc/html/qscriptengine-obsolete.html b/qtscriptclassic/doc/html/qscriptengine-obsolete.html
new file mode 100644
index 0000000..1a07db3
--- /dev/null
+++ b/qtscriptclassic/doc/html/qscriptengine-obsolete.html
@@ -0,0 +1,53 @@
+<?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">
+<!-- qscriptengine.cpp -->
+<head>
+ <title>Obsolete Members for QScriptEngine</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">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
+</tr></table><h1 class="title">Obsolete Members for QScriptEngine</h1>
+<p><b>The following class members are obsolete.</b> They are provided to keep old source code working. We strongly advise against using them in new code.</p>
+<p><ul><li><a href="qscriptengine.html">QScriptEngine class reference</a></li></ul></p>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qscriptengine-obsolete.html#canEvaluate">canEvaluate</a></b> ( const QString &amp; <i>program</i> ) const&nbsp;&nbsp;<tt> (obsolete)</tt></td></tr>
+</table>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="canEvaluate"></a>bool QScriptEngine::canEvaluate ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>program</i> ) const</h3>
+<p>Returns true if <i>program</i> can be evaluated; i.e&#x2e; the code is sufficient to determine whether it appears to be a syntactically correct program, or contains a syntax error.</p>
+<p>This function returns false if <i>program</i> is incomplete; i.e&#x2e; the input is syntactically correct up to the point where the input is terminated.</p>
+<p>Note that this function only does a static check of <i>program</i>; e.g&#x2e; it does not check whether references to variables are valid, and so on.</p>
+<p>A typical usage of canEvaluate() is to implement an interactive interpreter for <a href="http://qt.nokia.com/doc/4.6/qtscript.html">QtScript</a>. The user is repeatedly queried for individual lines of code; the lines are concatened internally, and only when canEvaluate() returns true for the resulting program is it passed to <a href="qscriptengine.html#evaluate">evaluate</a>().</p>
+<p>The following are some examples to illustrate the behavior of canEvaluate(). (Note that all example inputs are assumed to have an explicit newline as their last character, since otherwise the <a href="http://qt.nokia.com/doc/4.6/qtscript.html">QtScript</a> parser would automatically insert a semi-colon character at the end of the input, and this could cause canEvaluate() to produce different results.)</p>
+<p>Given the input</p>
+<pre> if (hello &amp;&amp; world)
+ print(&quot;hello world&quot;);</pre>
+<p>canEvaluate() will return true, since the program appears to be complete.</p>
+<p>Given the input</p>
+<pre> if (hello &amp;&amp;</pre>
+<p>canEvaluate() will return false, since the if-statement is not complete, but is syntactically correct so far.</p>
+<p>Given the input</p>
+<pre> 0 = 0</pre>
+<p>canEvaluate() will return true, but <a href="qscriptengine.html#evaluate">evaluate</a>() will throw a SyntaxError given the same input.</p>
+<p>Given the input</p>
+<pre> ./test.js</pre>
+<p>canEvaluate() will return true, even though the code is clearly not syntactically valid <a href="http://qt.nokia.com/doc/4.6/qtscript.html">QtScript</a> code. <a href="qscriptengine.html#evaluate">evaluate</a>() will throw a SyntaxError when this code is evaluated.</p>
+<p>Given the input</p>
+<pre> foo[&quot;bar&quot;]</pre>
+<p>canEvaluate() will return true, but <a href="qscriptengine.html#evaluate">evaluate</a>() will throw a ReferenceError if <tt>foo</tt> is not defined in the script environment.</p>
+<p>See also <a href="qscriptengine.html#evaluate">evaluate</a>() and <a href="qscriptengine.html#checkSyntax">checkSyntax</a>().</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 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>