Struct qt_core::q_associative_iterable::ConstIterator
source · #[repr(C)]pub struct ConstIterator { /* private fields */ }
Expand description
The QAssociativeIterable::const_iterator allows iteration over a container in a QVariant.
C++ class: QAssociativeIterable::const_iterator
.
The QAssociativeIterable::const_iterator allows iteration over a container in a QVariant.
A QAssociativeIterable::const_iterator can only be created by a QAssociativeIterable instance, and can be used in a way similar to other stl-style iterators.
QHash<int, QString> mapping; mapping.insert(7, “Seven”); mapping.insert(11, “Eleven”); mapping.insert(42, “Forty-two”);
QVariant variant = QVariant::fromValue(mapping); if (variant.canConvert<QVariantHash>()) { QAssociativeIterable iterable = variant.value<QAssociativeIterable>(); // Can use foreach over the values: foreach (const QVariant &v, iterable) { qDebug() << v; } // Can use C++11 range-for over the values: for (const QVariant &v : iterable) { qDebug() << v; } // Can use iterators: QAssociativeIterable::const_iterator it = iterable.begin(); const QAssociativeIterable::const_iterator end = iterable.end(); for ( ; it != end; ++it) { qDebug() << *it; // The current value qDebug() << it.key(); qDebug() << it.value(); } }
Implementations§
source§impl ConstIterator
impl ConstIterator
sourcepub unsafe fn add_assign(&self, j: c_int) -> Ref<ConstIterator>
pub unsafe fn add_assign(&self, j: c_int) -> Ref<ConstIterator>
Advances the iterator by j items.
Calls C++ function: QAssociativeIterable::const_iterator& QAssociativeIterable::const_iterator::operator+=(int j)
.
Advances the iterator by j items.
See also operator-=() and operator+().
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<ConstIterator>>
) -> Ref<ConstIterator>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<ConstIterator>> ) -> Ref<ConstIterator>
Assigns other to this.
Calls C++ function: QAssociativeIterable::const_iterator& QAssociativeIterable::const_iterator::operator=(const QAssociativeIterable::const_iterator& other)
.
Assigns other to this.
sourcepub unsafe fn dec(&self) -> Ref<ConstIterator>
pub unsafe fn dec(&self) -> Ref<ConstIterator>
The prefix -- operator (--it
) makes the preceding item current and returns an iterator to the new current item.
Calls C++ function: QAssociativeIterable::const_iterator& QAssociativeIterable::const_iterator::operator--()
.
The prefix – operator (–it
) makes the preceding item current and returns an iterator to the new current item.
Calling this function on QAssociativeIterable::begin() leads to undefined results.
See also operator++().
sourcepub unsafe fn dec_postfix(&self, arg1: c_int) -> CppBox<ConstIterator>
pub unsafe fn dec_postfix(&self, arg1: c_int) -> CppBox<ConstIterator>
This is an overloaded function.
Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::const_iterator::operator--(int arg1)
.
This is an overloaded function.
The postfix -- operator (it--
) makes the preceding item current and returns an iterator to the previously current item.
sourcepub unsafe fn inc(&self) -> Ref<ConstIterator>
pub unsafe fn inc(&self) -> Ref<ConstIterator>
The prefix ++ operator (++it
) advances the iterator to the next item in the container and returns an iterator to the new current item.
Calls C++ function: QAssociativeIterable::const_iterator& QAssociativeIterable::const_iterator::operator++()
.
The prefix ++ operator (++it
) advances the iterator to the next item in the container and returns an iterator to the new current item.
Calling this function on QAssociativeIterable::end() leads to undefined results.
See also operator--().
sourcepub unsafe fn inc_postfix(&self, arg1: c_int) -> CppBox<ConstIterator>
pub unsafe fn inc_postfix(&self, arg1: c_int) -> CppBox<ConstIterator>
This is an overloaded function.
Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::const_iterator::operator++(int arg1)
.
This is an overloaded function.
The postfix ++ operator (it++
) advances the iterator to the next item in the container and returns an iterator to the previously current item.
sourcepub unsafe fn indirection(&self) -> CppBox<QVariant>
pub unsafe fn indirection(&self) -> CppBox<QVariant>
sourcepub unsafe fn key(&self) -> CppBox<QVariant>
pub unsafe fn key(&self) -> CppBox<QVariant>
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<ConstIterator>>
) -> CppBox<ConstIterator>
pub unsafe fn new_copy( other: impl CastInto<Ref<ConstIterator>> ) -> CppBox<ConstIterator>
Creates a copy of other.
Calls C++ function: [constructor] void QAssociativeIterable::const_iterator::const_iterator(const QAssociativeIterable::const_iterator& other)
.
Creates a copy of other.
sourcepub unsafe fn sub_assign(&self, j: c_int) -> Ref<ConstIterator>
pub unsafe fn sub_assign(&self, j: c_int) -> Ref<ConstIterator>
Makes the iterator go back by j items.
Calls C++ function: QAssociativeIterable::const_iterator& QAssociativeIterable::const_iterator::operator-=(int j)
.
Makes the iterator go back by j items.
See also operator+=() and operator-().
Trait Implementations§
source§impl Add<i32> for &ConstIterator
impl Add<i32> for &ConstIterator
source§fn add(self, j: c_int) -> CppBox<ConstIterator>
fn add(self, j: c_int) -> CppBox<ConstIterator>
Returns an iterator to the item at j positions forward from this iterator.
Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::const_iterator::operator+(int j) const
.
Returns an iterator to the item at j positions forward from this iterator.
See also operator-() and operator+=().
§type Output = CppBox<ConstIterator>
type Output = CppBox<ConstIterator>
+
operator.source§impl CppDeletable for ConstIterator
impl CppDeletable for ConstIterator
source§unsafe fn delete(&self)
unsafe fn delete(&self)
Destroys the QAssociativeIterable::const_iterator.
Calls C++ function: [destructor] void QAssociativeIterable::const_iterator::~const_iterator()
.
Destroys the QAssociativeIterable::const_iterator.
source§impl Decrement for ConstIterator
impl Decrement for ConstIterator
source§unsafe fn dec(&self) -> Ref<ConstIterator>
unsafe fn dec(&self) -> Ref<ConstIterator>
The prefix -- operator (--it
) makes the preceding item current and returns an iterator to the new current item.
Calls C++ function: QAssociativeIterable::const_iterator& QAssociativeIterable::const_iterator::operator--()
.
The prefix – operator (–it
) makes the preceding item current and returns an iterator to the new current item.
Calling this function on QAssociativeIterable::begin() leads to undefined results.
See also operator++().
§type Output = Ref<ConstIterator>
type Output = Ref<ConstIterator>
source§impl Increment for ConstIterator
impl Increment for ConstIterator
source§unsafe fn inc(&self) -> Ref<ConstIterator>
unsafe fn inc(&self) -> Ref<ConstIterator>
The prefix ++ operator (++it
) advances the iterator to the next item in the container and returns an iterator to the new current item.
Calls C++ function: QAssociativeIterable::const_iterator& QAssociativeIterable::const_iterator::operator++()
.
The prefix ++ operator (++it
) advances the iterator to the next item in the container and returns an iterator to the new current item.
Calling this function on QAssociativeIterable::end() leads to undefined results.
See also operator--().
§type Output = Ref<ConstIterator>
type Output = Ref<ConstIterator>
source§impl Indirection for ConstIterator
impl Indirection for ConstIterator
source§impl PartialEq<Ref<ConstIterator>> for ConstIterator
impl PartialEq<Ref<ConstIterator>> for ConstIterator
source§fn eq(&self, o: &Ref<ConstIterator>) -> bool
fn eq(&self, o: &Ref<ConstIterator>) -> bool
Returns true
if other points to the same item as this iterator; otherwise returns false
.
Calls C++ function: bool QAssociativeIterable::const_iterator::operator==(const QAssociativeIterable::const_iterator& o) const
.
Returns true
if other points to the same item as this iterator; otherwise returns false
.
See also operator!=().
source§impl Sub<i32> for &ConstIterator
impl Sub<i32> for &ConstIterator
source§fn sub(self, j: c_int) -> CppBox<ConstIterator>
fn sub(self, j: c_int) -> CppBox<ConstIterator>
Returns an iterator to the item at j positions backward from this iterator.
Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::const_iterator::operator-(int j) const
.
Returns an iterator to the item at j positions backward from this iterator.
See also operator+() and operator-=().
§type Output = CppBox<ConstIterator>
type Output = CppBox<ConstIterator>
-
operator.