#[repr(C)]
pub struct QByteArrayMatcher { /* private fields */ }
Expand description

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.

Implementations§

source§

impl QByteArrayMatcher

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source

pub unsafe fn new_0a() -> CppBox<QByteArrayMatcher>

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.

source

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

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.

source

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

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.

source

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

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.

source

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

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().

source

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

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§

source§

impl CppDeletable for QByteArrayMatcher

source§

unsafe fn delete(&self)

Destroys the byte array matcher.

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

C++ documentation:

Destroys the byte array matcher.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.