[−][src]Struct qt_qml::QJSValueIterator
The QJSValueIterator constructor takes a QJSValue 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 QJSValue:
C++ class: QJSValueIterator
.
The QJSValueIterator constructor takes a QJSValue 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 QJSValue:
QJSValue object; ... QJSValueIterator it(object); while (it.hasNext()) { it.next(); qDebug() << it.name() << ": " << it.value().toString(); }
The next() advances the iterator. The name() and value() functions return the name and value of the last item that was jumped over.
Note that QJSValueIterator only iterates over the QJSValue's own properties; i.e. it does not follow the prototype chain. You can use a loop like this to follow the prototype chain:
QJSValue obj = ...; // the object to iterate over while (obj.isObject()) { QJSValueIterator it(obj); while (it.hasNext()) { it.next(); qDebug() << it.name(); } obj = obj.prototype(); }
Methods
impl QJSValueIterator
[src]
pub unsafe fn copy_from(
&self,
value: impl CastInto<Ref<QJSValue>>
) -> Ref<QJSValueIterator>
[src]
&self,
value: impl CastInto<Ref<QJSValue>>
) -> Ref<QJSValueIterator>
Makes the iterator operate on object. The iterator is set to be at the front of the sequence of properties (before the first property).
Calls C++ function: QJSValueIterator& QJSValueIterator::operator=(QJSValue& value)
.
Makes the iterator operate on object. The iterator is set to be at the front of the sequence of properties (before the first property).
pub unsafe fn has_next(&self) -> bool
[src]
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.
Calls C++ function: bool QJSValueIterator::hasNext() const
.
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.
See also next().
pub unsafe fn name(&self) -> CppBox<QString>
[src]
Returns the name of the last property that was jumped over using next().
Calls C++ function: QString QJSValueIterator::name() const
.
pub unsafe fn new(
value: impl CastInto<Ref<QJSValue>>
) -> CppBox<QJSValueIterator>
[src]
value: impl CastInto<Ref<QJSValue>>
) -> CppBox<QJSValueIterator>
Constructs an iterator for traversing object. The iterator is set to be at the front of the sequence of properties (before the first property).
Calls C++ function: [constructor] void QJSValueIterator::QJSValueIterator(const QJSValue& value)
.
Constructs an iterator for traversing object. The iterator is set to be at the front of the sequence of properties (before the first property).
pub unsafe fn next(&self) -> bool
[src]
Advances the iterator by one position. Returns true if there was at least one item ahead of the iterator (i.e. the iterator was not already at the back of the property sequence); otherwise returns false.
Calls C++ function: bool QJSValueIterator::next()
.
pub unsafe fn value(&self) -> CppBox<QJSValue>
[src]
Returns the value of the last property that was jumped over using next().
Calls C++ function: QJSValue QJSValueIterator::value() const
.
Trait Implementations
impl CppDeletable for QJSValueIterator
[src]
Auto Trait Implementations
impl RefUnwindSafe for QJSValueIterator
impl Send for QJSValueIterator
impl Sync for QJSValueIterator
impl Unpin for QJSValueIterator
impl UnwindSafe for QJSValueIterator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,