[][src]Struct qt_core::QByteArrayMatcher

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

The QByteArrayMatcher class holds a sequence of bytes that can be quickly matched in a byte array.

C++ class: QByteArrayMatcher.

C++ documentation:

The QByteArrayMatcher class holds a sequence of bytes that can be quickly matched in a byte array.

This class is useful when you have a sequence of bytes that you want to repeatedly match against some byte arrays (perhaps in a loop), or when you want to search for the same sequence of bytes multiple times in the same byte array. Using a matcher object and indexIn() is faster than matching a plain QByteArray with QByteArray::indexOf() if repeated matching takes place. This class offers no benefit if you are doing one-off byte array matches.

Create the QByteArrayMatcher with the QByteArray you want to search for. Then call indexIn() on the QByteArray that you want to search.

Methods

impl QByteArrayMatcher[src]

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QByteArrayMatcher>>
) -> Ref<QByteArrayMatcher>
[src]

Assigns the other byte array matcher to this byte array matcher.

Calls C++ function: QByteArrayMatcher& QByteArrayMatcher::operator=(const QByteArrayMatcher& other).

C++ documentation:

Assigns the other byte array matcher to this byte array matcher.

pub unsafe fn index_in_q_byte_array_int(
    &self,
    ba: impl CastInto<Ref<QByteArray>>,
    from: c_int
) -> c_int
[src]

Searches the byte array ba, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in ba, or -1 if no match was found.

Calls C++ function: int QByteArrayMatcher::indexIn(const QByteArray& ba, int from = …) const.

C++ documentation:

Searches the byte array ba, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in ba, or -1 if no match was found.

pub unsafe fn index_in_char2_int(
    &self,
    str: *const c_char,
    len: c_int,
    from: c_int
) -> c_int
[src]

Searches the char string str, which has length len, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in str, or -1 if no match was found.

Calls C++ function: int QByteArrayMatcher::indexIn(const char* str, int len, int from = …) const.

C++ documentation:

Searches the char string str, which has length len, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in str, or -1 if no match was found.

pub unsafe fn index_in_q_byte_array(
    &self,
    ba: impl CastInto<Ref<QByteArray>>
) -> c_int
[src]

Searches the byte array ba, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in ba, or -1 if no match was found.

Calls C++ function: int QByteArrayMatcher::indexIn(const QByteArray& ba) const.

C++ documentation:

Searches the byte array ba, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in ba, or -1 if no match was found.

pub unsafe fn index_in_char_int(&self, str: *const c_char, len: c_int) -> c_int[src]

Searches the char string str, which has length len, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in str, or -1 if no match was found.

Calls C++ function: int QByteArrayMatcher::indexIn(const char* str, int len) const.

C++ documentation:

Searches the char string str, which has length len, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in str, or -1 if no match was found.

pub unsafe fn new_0a() -> CppBox<QByteArrayMatcher>[src]

Constructs an empty byte array matcher that won't match anything. Call setPattern() to give it a pattern to match.

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

C++ documentation:

Constructs an empty byte array matcher that won't match anything. Call setPattern() to give it a pattern to match.

pub unsafe fn new_1a(
    pattern: impl CastInto<Ref<QByteArray>>
) -> CppBox<QByteArrayMatcher>
[src]

Constructs a byte array matcher that will search for pattern. Call indexIn() to perform a search.

Calls C++ function: [constructor] void QByteArrayMatcher::QByteArrayMatcher(const QByteArray& pattern).

C++ documentation:

Constructs a byte array matcher that will search for pattern. Call indexIn() to perform a search.

pub unsafe fn new_2a(
    pattern: *const c_char,
    length: c_int
) -> CppBox<QByteArrayMatcher>
[src]

Constructs a byte array matcher from pattern. pattern has the given length. pattern must remain in scope, but the destructor does not delete pattern.

Calls C++ function: [constructor] void QByteArrayMatcher::QByteArrayMatcher(const char* pattern, int length).

C++ documentation:

Constructs a byte array matcher from pattern. pattern has the given length. pattern must remain in scope, but the destructor does not delete pattern.

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

Copies the other byte array matcher to this byte array matcher.

Calls C++ function: [constructor] void QByteArrayMatcher::QByteArrayMatcher(const QByteArrayMatcher& other).

C++ documentation:

Copies the other byte array matcher to this byte array matcher.

pub unsafe fn pattern(&self) -> CppBox<QByteArray>[src]

Returns the byte array pattern that this byte array matcher will search for.

Calls C++ function: QByteArray QByteArrayMatcher::pattern() const.

C++ documentation:

Returns the byte array pattern that this byte array matcher will search for.

See also setPattern().

pub unsafe fn set_pattern(&self, pattern: impl CastInto<Ref<QByteArray>>)[src]

Sets the byte array that this byte array matcher will search for to pattern.

Calls C++ function: void QByteArrayMatcher::setPattern(const QByteArray& pattern).

C++ documentation:

Sets the byte array that this byte array matcher will search for to pattern.

See also pattern() and indexIn().

Trait Implementations

impl CppDeletable for QByteArrayMatcher[src]

unsafe fn delete(&self)[src]

Destroys the byte array matcher.

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

C++ documentation:

Destroys the byte array matcher.

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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

impl<T> StaticUpcast<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.