libqmlbind
A C library for creating QML bindings for other languages easily through exporting objects to QML
|
provides a Java-style iterator for the properties of qmlbind_value
s.
More...
Files | |
file | iterator.h |
Contains all methods defined on qmlbind_iterator. | |
Classes | |
struct | qmlbind_iterator |
an opaque struct mainly used as self argument in the methods defined in qmlbind_iterator. More... | |
Functions | |
QMLBIND_API qmlbind_iterator * | qmlbind_iterator_new (const qmlbind_value *object) |
Constructs an iterator for traversing object . More... | |
QMLBIND_API void | qmlbind_iterator_release (qmlbind_iterator *self) |
Destroys this qmlbind_iterator . | |
QMLBIND_API qmlbind_string * | qmlbind_iterator_get_key (const qmlbind_iterator *self) |
Returns the name of the last property that was jumped over using qmlbind_iterator_next() . More... | |
QMLBIND_API qmlbind_value * | qmlbind_iterator_get_value (const qmlbind_iterator *self) |
Returns the value of the last property that was jumped over using qmlbind_iterator_next() . More... | |
QMLBIND_API void | qmlbind_iterator_next (qmlbind_iterator *self) |
Advances the iterator by one position. More... | |
QMLBIND_API int | qmlbind_iterator_has_next (const qmlbind_iterator *self) |
Returns 1 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 0. More... | |
provides a Java-style iterator for the properties of qmlbind_value
s.
The qmlbind_iterator_new()
constructor takes a qmlbind_value
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 qmlbind_value
:
The qmlbind_iterator_next()
advances the iterator. The qmlbind_iterator_get_key()
and qmlbind_iterator_get_value()
functions return the name and value of the last item that was jumped over.
Note that qmlbind_iterator
only iterates over the qmlbind_value
's own properties; i.e. it does not follow the prototype chain. You can use a loop like this to follow the prototype chain:
libqmlbind's equivalent of QJSValueIterator.
QMLBIND_API qmlbind_iterator* qmlbind_iterator_new | ( | const qmlbind_value * | object | ) |
Constructs an iterator for traversing object
.
The iterator is set to be at the front of the sequence of properties (before the first property).
libqmlbind's equivalent of QJSValueIterator::QJSValueIterator.
QMLBIND_API qmlbind_string* qmlbind_iterator_get_key | ( | const qmlbind_iterator * | self | ) |
Returns the name of the last property that was jumped over using qmlbind_iterator_next()
.
Ownership of the returned string is transfered to the caller.
libqmlbind's equivalent of QJSValueIterator::name().
QMLBIND_API qmlbind_value* qmlbind_iterator_get_value | ( | const qmlbind_iterator * | self | ) |
Returns the value of the last property that was jumped over using qmlbind_iterator_next()
.
Ownership of the returned value is transfered to the caller.
libqmlbind's equivalent of QJSValueIterator::value().
QMLBIND_API void qmlbind_iterator_next | ( | qmlbind_iterator * | self | ) |
Advances the iterator by one position.
Returns 1 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 0.
libqmlbind's equivalent of QJSValueIterator::next().
QMLBIND_API int qmlbind_iterator_has_next | ( | const qmlbind_iterator * | self | ) |
Returns 1 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 0.
libqmlbind's equivalent of QJSValueIterator::hasNext().