Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 986

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QScriptValueIterator Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QScriptValueIterator Class Reference<br /><sup><sup>[<a href="qtscript.html">QtScript</a> module]</sup></sup></h1><p>The QScriptValueIterator class provides a Java-style iterator
for <a href="qscriptvalue.html">QScriptValue</a>. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qscriptvalueiterator.html#QScriptValueIterator">__init__</a></b> (<i>self</i>, QScriptValue&#160;<i>value</i>)</li><li><div class="fn" />QScriptValue.PropertyFlags <b><a href="qscriptvalueiterator.html#flags">flags</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalueiterator.html#hasNext">hasNext</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalueiterator.html#hasPrevious">hasPrevious</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qscriptvalueiterator.html#name">name</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qscriptvalueiterator.html#next">next</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qscriptvalueiterator.html#previous">previous</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qscriptvalueiterator.html#remove">remove</a></b> (<i>self</i>)</li><li><div class="fn" />QScriptString <b><a href="qscriptvalueiterator.html#scriptName">scriptName</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qscriptvalueiterator.html#setValue">setValue</a></b> (<i>self</i>, QScriptValue&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qscriptvalueiterator.html#toBack">toBack</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qscriptvalueiterator.html#toFront">toFront</a></b> (<i>self</i>)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalueiterator.html#value">value</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QScriptValueIterator class provides a Java-style iterator
for <a href="qscriptvalue.html">QScriptValue</a>.</p>
<p>The QScriptValueIterator constructor takes a <a href="qscriptvalue.html">QScriptValue</a> as argument. After
construction, the iterator is located at the very beginning of the
sequence of properties. Here's how to iterate over all the
properties of a <a href="qscriptvalue.html">QScriptValue</a>:</p>
<pre class="cpp">
 <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> object;
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="type">QScriptValueIterator</span> it(object);
 <span class="keyword">while</span> (it<span class="operator">.</span>hasNext()) {
     it<span class="operator">.</span>next();
     <a href="qtcore.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> it<span class="operator">.</span>name() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">": "</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> it<span class="operator">.</span>value()<span class="operator">.</span>toString();
 }
</pre>
<p>The <a href="qscriptvalueiterator.html#next">next</a>() advances
the iterator. The <a href="qscriptvalueiterator.html#name">name</a>(), <a href="qscriptvalueiterator.html#value">value</a>() and <a href="qscriptvalueiterator.html#flags">flags</a>() functions return the
name, value and flags of the last item that was jumped over.</p>
<p>If you want to remove properties as you iterate over the
<a href="qscriptvalue.html">QScriptValue</a>, use <a href="qscriptvalueiterator.html#remove">remove</a>(). If you want to
modify the value of a property, use <a href="qscriptvalueiterator.html#setValue">setValue</a>().</p>
<p>Note that QScriptValueIterator only iterates over the <a href="qscriptvalue.html">QScriptValue</a>'s own properties; i.e. it does
not follow the prototype chain. You can use a loop like this to
follow the prototype chain:</p>
<pre class="cpp">
 <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> obj <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>; <span class="comment">// the object to iterate over</span>
 <span class="keyword">while</span> (obj<span class="operator">.</span>isObject()) {
     <span class="type">QScriptValueIterator</span> it(obj);
     <span class="keyword">while</span> (it<span class="operator">.</span>hasNext()) {
         it<span class="operator">.</span>next();
         <a href="qtcore.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> it<span class="operator">.</span>name();
     }
     obj <span class="operator">=</span> obj<span class="operator">.</span>prototype();
 }
</pre>
<p>Note that QScriptValueIterator will not automatically skip over
properties that have the <a href="qscriptvalue.html#PropertyFlag-enum">QScriptValue.SkipInEnumeration</a>
flag set; that flag only affects iteration in script code. If you
want, you can skip over such properties with code like the
following:</p>
<pre class="cpp">
 <span class="keyword">while</span> (it<span class="operator">.</span>hasNext()) {
     it<span class="operator">.</span>next();
     <span class="keyword">if</span> (it<span class="operator">.</span>flags() <span class="operator">&amp;</span> <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span><span class="operator">.</span>SkipInEnumeration)
         <span class="keyword">continue</span>;
     <a href="qtcore.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"found enumerated property:"</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> it<span class="operator">.</span>name();
 }
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QScriptValueIterator" />QScriptValueIterator.__init__ (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>value</i>)</h3><p>Constructs an iterator for traversing <i>object</i>. The
iterator is set to be at the front of the sequence of properties
(before the first property).</p>


<h3 class="fn"><a name="flags" /><a href="qscriptvalue-propertyflags.html">QScriptValue.PropertyFlags</a> QScriptValueIterator.flags (<i>self</i>)</h3><p>Returns the flags of the last property that was jumped over
using <a href="qscriptvalueiterator.html#next">next</a>() or
<a href="qscriptvalueiterator.html#previous">previous</a>().</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#value">value</a>().</p>


<h3 class="fn"><a name="hasNext" />bool QScriptValueIterator.hasNext (<i>self</i>)</h3><p>Returns true if there is at least one item ahead of the iterator
(i.e. the iterator is <i>not</i> at the back of the property
sequence); otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#next">next</a>() and <a href="qscriptvalueiterator.html#hasPrevious">hasPrevious</a>().</p>


<h3 class="fn"><a name="hasPrevious" />bool QScriptValueIterator.hasPrevious (<i>self</i>)</h3><p>Returns true if there is at least one item behind the iterator
(i.e. the iterator is <i>not</i> at the front of the property
sequence); otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#previous">previous</a>() and <a href="qscriptvalueiterator.html#hasNext">hasNext</a>().</p>


<h3 class="fn"><a name="name" />QString QScriptValueIterator.name (<i>self</i>)</h3><p>Returns the name of the last property that was jumped over using
<a href="qscriptvalueiterator.html#next">next</a>() or <a href="qscriptvalueiterator.html#previous">previous</a>().</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#value">value</a>() and <a href="qscriptvalueiterator.html#flags">flags</a>().</p>


<h3 class="fn"><a name="next" />QScriptValueIterator.next (<i>self</i>)</h3><p>Advances the iterator by one position.</p>
<p>Calling this function on an iterator located at the back of the
container leads to undefined results.</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#hasNext">hasNext</a>(), <a href="qscriptvalueiterator.html#previous">previous</a>(), and <a href="qscriptvalueiterator.html#name">name</a>().</p>


<h3 class="fn"><a name="previous" />QScriptValueIterator.previous (<i>self</i>)</h3><p>Moves the iterator back by one position.</p>
<p>Calling this function on an iterator located at the front of the
container leads to undefined results.</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#hasPrevious">hasPrevious</a>(), <a href="qscriptvalueiterator.html#next">next</a>(), and <a href="qscriptvalueiterator.html#name">name</a>().</p>


<h3 class="fn"><a name="remove" />QScriptValueIterator.remove (<i>self</i>)</h3><p>Removes the last property that was jumped over using <a href="qscriptvalueiterator.html#next">next</a>() or <a href="qscriptvalueiterator.html#previous">previous</a>().</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#setValue">setValue</a>().</p>


<h3 class="fn"><a name="scriptName" /><a href="qscriptstring.html">QScriptString</a> QScriptValueIterator.scriptName (<i>self</i>)</h3><p>Returns the name of the last property that was jumped over using
<a href="qscriptvalueiterator.html#next">next</a>() or <a href="qscriptvalueiterator.html#previous">previous</a>().</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="setValue" />QScriptValueIterator.setValue (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>value</i>)</h3><p>Sets the <i>value</i> of the last property that was jumped over
using <a href="qscriptvalueiterator.html#next">next</a>() or
<a href="qscriptvalueiterator.html#previous">previous</a>().</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#value">value</a>() and <a href="qscriptvalueiterator.html#name">name</a>().</p>


<h3 class="fn"><a name="toBack" />QScriptValueIterator.toBack (<i>self</i>)</h3><p>Moves the iterator to the back of the <a href="qscriptvalue.html">QScriptValue</a> (after the last property).</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#toFront">toFront</a>() and <a href="qscriptvalueiterator.html#previous">previous</a>().</p>


<h3 class="fn"><a name="toFront" />QScriptValueIterator.toFront (<i>self</i>)</h3><p>Moves the iterator to the front of the <a href="qscriptvalue.html">QScriptValue</a> (before the first
property).</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#toBack">toBack</a>() and <a href="qscriptvalueiterator.html#next">next</a>().</p>


<h3 class="fn"><a name="value" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValueIterator.value (<i>self</i>)</h3><p>Returns the value of the last property that was jumped over
using <a href="qscriptvalueiterator.html#next">next</a>() or
<a href="qscriptvalueiterator.html#previous">previous</a>().</p>
<p><b>See also</b> <a href="qscriptvalueiterator.html#setValue">setValue</a>() and <a href="qscriptvalueiterator.html#name">name</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>