[][src]Struct qt_core::QRegularExpressionMatchIterator

#[repr(C)]
pub struct QRegularExpressionMatchIterator { /* fields omitted */ }

The QRegularExpressionMatchIterator class provides an iterator on the results of a global match of a QRegularExpression object against a string.

C++ class: QRegularExpressionMatchIterator.

C++ documentation:

The QRegularExpressionMatchIterator class provides an iterator on the results of a global match of a QRegularExpression object against a string.

A QRegularExpressionMatchIterator object is a forward only Java-like iterator; it can be obtained by calling the QRegularExpression::globalMatch() function. A new QRegularExpressionMatchIterator will be positioned before the first result. You can then call the hasNext() function to check if there are more results available; if so, the next() function will return the next result and advance the iterator.

Each result is a QRegularExpressionMatch object holding all the information for that result (including captured substrings).

For instance:

// extracts the words QRegularExpression re("(\w+)"); QString subject("the quick fox"); QRegularExpressionMatchIterator i = re.globalMatch(subject); while (i.hasNext()) { QRegularExpressionMatch match = i.next(); // ... }

Moreover, QRegularExpressionMatchIterator offers a peekNext() function to get the next result without advancing the iterator.

You can retrieve the QRegularExpression object the subject string was matched against by calling the regularExpression() function; the match type and the match options are available as well by calling the matchType() and the matchOptions() respectively.

Please refer to the QRegularExpression documentation for more information about the Qt regular expression classes.

Methods

impl QRegularExpressionMatchIterator[src]

pub unsafe fn copy_from(
    &mut self,
    iterator: impl CastInto<Ref<QRegularExpressionMatchIterator>>
) -> MutRef<QRegularExpressionMatchIterator>
[src]

Assigns the iterator iterator to this object, and returns a reference to the copy.

Calls C++ function: QRegularExpressionMatchIterator& QRegularExpressionMatchIterator::operator=(const QRegularExpressionMatchIterator& iterator).

C++ documentation:

Assigns the iterator iterator to this object, and returns a reference to the copy.

pub unsafe fn has_next(&self) -> bool[src]

Returns true if there is at least one match result ahead of the iterator; otherwise it returns false.

Calls C++ function: bool QRegularExpressionMatchIterator::hasNext() const.

C++ documentation:

Returns true if there is at least one match result ahead of the iterator; otherwise it returns false.

See also next().

pub unsafe fn is_valid(&self) -> bool[src]

Returns true if the iterator object was obtained as a result from the QRegularExpression::globalMatch() function invoked on a valid QRegularExpression object; returns false if the QRegularExpression was invalid.

Calls C++ function: bool QRegularExpressionMatchIterator::isValid() const.

C++ documentation:

Returns true if the iterator object was obtained as a result from the QRegularExpression::globalMatch() function invoked on a valid QRegularExpression object; returns false if the QRegularExpression was invalid.

See also QRegularExpression::globalMatch() and QRegularExpression::isValid().

pub unsafe fn match_options(&self) -> QFlags<MatchOption>[src]

Returns the match options that were used to get this QRegularExpressionMatchIterator object, that is, the match options that were passed to QRegularExpression::globalMatch().

Calls C++ function: QFlags<QRegularExpression::MatchOption> QRegularExpressionMatchIterator::matchOptions() const.

C++ documentation:

Returns the match options that were used to get this QRegularExpressionMatchIterator object, that is, the match options that were passed to QRegularExpression::globalMatch().

See also QRegularExpression::globalMatch(), regularExpression(), and matchType().

pub unsafe fn match_type(&self) -> MatchType[src]

Returns the match type that was used to get this QRegularExpressionMatchIterator object, that is, the match type that was passed to QRegularExpression::globalMatch().

Calls C++ function: QRegularExpression::MatchType QRegularExpressionMatchIterator::matchType() const.

C++ documentation:

Returns the match type that was used to get this QRegularExpressionMatchIterator object, that is, the match type that was passed to QRegularExpression::globalMatch().

See also QRegularExpression::globalMatch(), regularExpression(), and matchOptions().

pub unsafe fn new() -> CppBox<QRegularExpressionMatchIterator>[src]

Constructs an empty, valid QRegularExpressionMatchIterator object. The regular expression is set to a default-constructed one; the match type to QRegularExpression::NoMatch and the match options to QRegularExpression::NoMatchOption.

Calls C++ function: [constructor] void QRegularExpressionMatchIterator::QRegularExpressionMatchIterator().

C++ documentation:

Constructs an empty, valid QRegularExpressionMatchIterator object. The regular expression is set to a default-constructed one; the match type to QRegularExpression::NoMatch and the match options to QRegularExpression::NoMatchOption.

Invoking the hasNext() member function on the constructed object will return false, as the iterator is not iterating on a valid sequence of matches.

This function was introduced in Qt 5.1.

pub unsafe fn new_copy(
    iterator: impl CastInto<Ref<QRegularExpressionMatchIterator>>
) -> CppBox<QRegularExpressionMatchIterator>
[src]

Constructs a QRegularExpressionMatchIterator object as a copy of iterator.

Calls C++ function: [constructor] void QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator& iterator).

C++ documentation:

Constructs a QRegularExpressionMatchIterator object as a copy of iterator.

See also operator=().

pub unsafe fn next(&mut self) -> CppBox<QRegularExpressionMatch>[src]

Returns the next match result and advances the iterator by one position.

Calls C++ function: QRegularExpressionMatch QRegularExpressionMatchIterator::next().

C++ documentation:

Returns the next match result and advances the iterator by one position.

Note: Calling this function when the iterator is at the end of the result set leads to undefined results.

pub unsafe fn peek_next(&self) -> CppBox<QRegularExpressionMatch>[src]

Returns the next match result without moving the iterator.

Calls C++ function: QRegularExpressionMatch QRegularExpressionMatchIterator::peekNext() const.

C++ documentation:

Returns the next match result without moving the iterator.

Note: Calling this function when the iterator is at the end of the result set leads to undefined results.

pub unsafe fn regular_expression(&self) -> CppBox<QRegularExpression>[src]

Returns the QRegularExpression object whose globalMatch() function returned this object.

Calls C++ function: QRegularExpression QRegularExpressionMatchIterator::regularExpression() const.

C++ documentation:

Returns the QRegularExpression object whose globalMatch() function returned this object.

See also QRegularExpression::globalMatch(), matchType(), and matchOptions().

pub unsafe fn swap(
    &mut self,
    other: impl CastInto<MutRef<QRegularExpressionMatchIterator>>
)
[src]

Swaps the iterator other with this iterator object. This operation is very fast and never fails.

Calls C++ function: void QRegularExpressionMatchIterator::swap(QRegularExpressionMatchIterator& other).

C++ documentation:

Swaps the iterator other with this iterator object. This operation is very fast and never fails.

Trait Implementations

impl CppDeletable for QRegularExpressionMatchIterator[src]

unsafe fn delete(&mut self)[src]

Destroys the QRegularExpressionMatchIterator object.

Calls C++ function: [destructor] void QRegularExpressionMatchIterator::~QRegularExpressionMatchIterator().

C++ documentation:

Destroys the QRegularExpressionMatchIterator object.

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]