Struct qt_core::QByteArrayMatcher
source · #[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
.
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
impl QByteArrayMatcher
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QByteArrayMatcher>>
) -> Ref<QByteArrayMatcher>
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)
.
Assigns the other byte array matcher to this byte array matcher.
sourcepub unsafe fn index_in_q_byte_array_int(
&self,
ba: impl CastInto<Ref<QByteArray>>,
from: c_int
) -> c_int
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
.
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.
sourcepub unsafe fn index_in_char2_int(
&self,
str: *const c_char,
len: c_int,
from: c_int
) -> c_int
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
.
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.
sourcepub unsafe fn index_in_q_byte_array(
&self,
ba: impl CastInto<Ref<QByteArray>>
) -> c_int
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
.
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.
sourcepub unsafe fn index_in_char_int(&self, str: *const c_char, len: c_int) -> c_int
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
.
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.
sourcepub unsafe fn new_0a() -> CppBox<QByteArrayMatcher>
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()
.
Constructs an empty byte array matcher that won’t match anything. Call setPattern() to give it a pattern to match.
sourcepub unsafe fn new_1a(
pattern: impl CastInto<Ref<QByteArray>>
) -> CppBox<QByteArrayMatcher>
pub unsafe fn new_1a( pattern: impl CastInto<Ref<QByteArray>> ) -> CppBox<QByteArrayMatcher>
sourcepub unsafe fn new_2a(
pattern: *const c_char,
length: c_int
) -> CppBox<QByteArrayMatcher>
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)
.
Constructs a byte array matcher from pattern. pattern has the given length. pattern must remain in scope, but the destructor does not delete pattern.
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QByteArrayMatcher>>
) -> CppBox<QByteArrayMatcher>
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)
.
Copies the other byte array matcher to this byte array matcher.
sourcepub unsafe fn pattern(&self) -> CppBox<QByteArray>
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
.
Returns the byte array pattern that this byte array matcher will search for.
See also setPattern().
sourcepub unsafe fn set_pattern(&self, pattern: impl CastInto<Ref<QByteArray>>)
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)
.