QScriptClassPropertyIterator Class Reference

[ QtScript module]

The QScriptClassPropertyIterator class provides an iterator interface for custom Qt Script objects. 更多...

方法


详细描述

The QScriptClassPropertyIterator class provides an iterator interface for custom Qt Script objects.

This class is only relevant if you have subclassed QScriptClass and want to provide enumeration of your custom properties (e.g. when objects of your class are used with QScriptValueIterator , or with the for-in statement in scripts).

object () function returns the Qt Script object the iterator is traversing.

toFront (), hasNext () 和 next () provide forward iteration.

toBack (), hasPrevious () and 上一 () provide backward iteration.

name (), id () 和 flags () return information about the last property that was jumped over 使用 next () or 上一 ().


方法文档编制

QScriptClassPropertyIterator.__init__ ( self , QScriptValue   object )

构造迭代器为遍历 object .

Subclasses should ensure that the iterator is set to the front of the sequence of properties (before the first property).

QScriptValue.PropertyFlags QScriptClassPropertyIterator.flags ( self )

Returns the flags of the last property that was jumped over 使用 next () or 上一 ().

The default implementation calls the propertyFlags() function of object () with argument name ().

bool QScriptClassPropertyIterator.hasNext ( self )

This method is abstract and should be reimplemented in any sub-class.

Returns true if there is at least one item ahead of the iterator (i.e. the iterator is not at the back of the property sequence); otherwise returns false.

另请参阅 next () 和 hasPrevious ().

bool QScriptClassPropertyIterator.hasPrevious ( self )

This method is abstract and should be reimplemented in any sub-class.

Returns true if there is at least one item behind the iterator (i.e. the iterator is not at the front of the property sequence); otherwise returns false.

另请参阅 上一 () 和 hasNext ().

int QScriptClassPropertyIterator.id ( self )

Returns the id of the last property that was jumped over using next () 或 上一 ().

The default implementation returns 0.

另请参阅 name ().

QScriptString QScriptClassPropertyIterator.name ( self )

This method is abstract and should be reimplemented in any sub-class.

Returns the name of the last property that was jumped over using next () 或 上一 ().

另请参阅 id ().

QScriptClassPropertyIterator.next ( self )

This method is abstract and should be reimplemented in any sub-class.

Advances the iterator by one position.

Calling this function on an iterator located at the back of the container leads to undefined results.

另请参阅 hasNext (), 上一 (),和 name ().

QScriptValue QScriptClassPropertyIterator.object ( self )

Returns the Qt Script object this iterator is traversing.

QScriptClassPropertyIterator.previous ( self )

This method is abstract and should be reimplemented in any sub-class.

Moves the iterator back by one position.

Calling this function on an iterator located at the front of the container leads to undefined results.

另请参阅 hasPrevious (), next (),和 name ().

QScriptClassPropertyIterator.toBack ( self )

This method is abstract and should be reimplemented in any sub-class.

Moves the iterator to the back of the QScriptValue (after the last property).

另请参阅 toFront () 和 上一 ().

QScriptClassPropertyIterator.toFront ( self )

This method is abstract and should be reimplemented in any sub-class.

Moves the iterator to the front of the QScriptValue (before the first 特性)。

另请参阅 toBack () 和 next ().