1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qbytearraymatcher.cpp -->
<title>QByteArrayMatcher Class | Qt Core 5.11</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QByteArrayMatcher</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QByteArrayMatcher Class</h1>
<!-- $$$QByteArrayMatcher-brief -->
<p>The <a href="qbytearraymatcher.html">QByteArrayMatcher</a> class holds a sequence of bytes that can be quickly matched in a byte array. <a href="#details">More...</a></p>
<!-- @@@QByteArrayMatcher -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QByteArrayMatcher></span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr></table></div><ul>
<li><a href="qbytearraymatcher-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#QByteArrayMatcher">QByteArrayMatcher</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#QByteArrayMatcher-1">QByteArrayMatcher</a></b>(const QByteArray &<i>pattern</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#QByteArrayMatcher-2">QByteArrayMatcher</a></b>(const char *<i>pattern</i>, int <i>length</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#QByteArrayMatcher-3">QByteArrayMatcher</a></b>(const QByteArrayMatcher &<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#dtor.QByteArrayMatcher">~QByteArrayMatcher</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#indexIn">indexIn</a></b>(const QByteArray &<i>ba</i>, int <i>from</i> = 0) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#indexIn-1">indexIn</a></b>(const char *<i>str</i>, int <i>len</i>, int <i>from</i> = 0) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#pattern">pattern</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#setPattern">setPattern</a></b>(const QByteArray &<i>pattern</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArrayMatcher &</td><td class="memItemRight bottomAlign"><b><a href="qbytearraymatcher.html#operator-eq">operator=</a></b>(const QByteArrayMatcher &<i>other</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QByteArrayMatcher-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qbytearraymatcher.html">QByteArrayMatcher</a> class holds a sequence of bytes that can be quickly matched in a byte array.</p>
<p>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 <a href="qbytearraymatcher.html#indexIn">indexIn</a>() is faster than matching a plain <a href="qbytearray.html">QByteArray</a> with <a href="qbytearray.html#indexOf">QByteArray::indexOf</a>() if repeated matching takes place. This class offers no benefit if you are doing one-off byte array matches.</p>
<p>Create the <a href="qbytearraymatcher.html">QByteArrayMatcher</a> with the <a href="qbytearray.html">QByteArray</a> you want to search for. Then call <a href="qbytearraymatcher.html#indexIn">indexIn</a>() on the <a href="qbytearray.html">QByteArray</a> that you want to search.</p>
</div>
<p><b>See also </b><a href="qbytearray.html">QByteArray</a> and <a href="qstringmatcher.html">QStringMatcher</a>.</p>
<!-- @@@QByteArrayMatcher -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QByteArrayMatcher[overload1]$$$QByteArrayMatcher -->
<h3 class="fn" id="QByteArrayMatcher"><a name="QByteArrayMatcher"></a>QByteArrayMatcher::<span class="name">QByteArrayMatcher</span>()</h3>
<p>Constructs an empty byte array matcher that won't match anything. Call <a href="qbytearraymatcher.html#setPattern">setPattern</a>() to give it a pattern to match.</p>
<!-- @@@QByteArrayMatcher -->
<!-- $$$QByteArrayMatcher$$$QByteArrayMatcherconstQByteArray& -->
<h3 class="fn" id="QByteArrayMatcher-1"><a name="QByteArrayMatcher-1"></a>QByteArrayMatcher::<span class="name">QByteArrayMatcher</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>pattern</i>)</h3>
<p>Constructs a byte array matcher that will search for <i>pattern</i>. Call <a href="qbytearraymatcher.html#indexIn">indexIn</a>() to perform a search.</p>
<!-- @@@QByteArrayMatcher -->
<!-- $$$QByteArrayMatcher$$$QByteArrayMatcherconstchar*int -->
<h3 class="fn" id="QByteArrayMatcher-2"><a name="QByteArrayMatcher-2"></a>QByteArrayMatcher::<span class="name">QByteArrayMatcher</span>(const <span class="type">char</span> *<i>pattern</i>, <span class="type">int</span> <i>length</i>)</h3>
<p>Constructs a byte array matcher from <i>pattern</i>. <i>pattern</i> has the given <i>length</i>. <i>pattern</i> must remain in scope, but the destructor does not delete <i>pattern</i>.</p>
<!-- @@@QByteArrayMatcher -->
<!-- $$$QByteArrayMatcher$$$QByteArrayMatcherconstQByteArrayMatcher& -->
<h3 class="fn" id="QByteArrayMatcher-3"><a name="QByteArrayMatcher-3"></a>QByteArrayMatcher::<span class="name">QByteArrayMatcher</span>(const <span class="type"><a href="qbytearraymatcher.html#QByteArrayMatcher">QByteArrayMatcher</a></span> &<i>other</i>)</h3>
<p>Copies the <i>other</i> byte array matcher to this byte array matcher.</p>
<!-- @@@QByteArrayMatcher -->
<!-- $$$~QByteArrayMatcher[overload1]$$$~QByteArrayMatcher -->
<h3 class="fn" id="dtor.QByteArrayMatcher"><a name="dtor.QByteArrayMatcher"></a>QByteArrayMatcher::<span class="name">~QByteArrayMatcher</span>()</h3>
<p>Destroys the byte array matcher.</p>
<!-- @@@~QByteArrayMatcher -->
<!-- $$$indexIn[overload1]$$$indexInconstQByteArray&int -->
<h3 class="fn" id="indexIn"><a name="indexIn"></a><span class="type">int</span> QByteArrayMatcher::<span class="name">indexIn</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>ba</i>, <span class="type">int</span> <i>from</i> = 0) const</h3>
<p>Searches the byte array <i>ba</i>, from byte position <i>from</i> (default 0, i.e. from the first byte), for the byte array <a href="qbytearraymatcher.html#pattern">pattern</a>() that was set in the constructor or in the most recent call to <a href="qbytearraymatcher.html#setPattern">setPattern</a>(). Returns the position where the <a href="qbytearraymatcher.html#pattern">pattern</a>() matched in <i>ba</i>, or -1 if no match was found.</p>
<!-- @@@indexIn -->
<!-- $$$indexIn$$$indexInconstchar*intint -->
<h3 class="fn" id="indexIn-1"><a name="indexIn-1"></a><span class="type">int</span> QByteArrayMatcher::<span class="name">indexIn</span>(const <span class="type">char</span> *<i>str</i>, <span class="type">int</span> <i>len</i>, <span class="type">int</span> <i>from</i> = 0) const</h3>
<p>Searches the char string <i>str</i>, which has length <i>len</i>, from byte position <i>from</i> (default 0, i.e. from the first byte), for the byte array <a href="qbytearraymatcher.html#pattern">pattern</a>() that was set in the constructor or in the most recent call to <a href="qbytearraymatcher.html#setPattern">setPattern</a>(). Returns the position where the <a href="qbytearraymatcher.html#pattern">pattern</a>() matched in <i>str</i>, or -1 if no match was found.</p>
<!-- @@@indexIn -->
<!-- $$$pattern[overload1]$$$pattern -->
<h3 class="fn" id="pattern"><a name="pattern"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QByteArrayMatcher::<span class="name">pattern</span>() const</h3>
<p>Returns the byte array pattern that this byte array matcher will search for.</p>
<p><b>See also </b><a href="qbytearraymatcher.html#setPattern">setPattern</a>().</p>
<!-- @@@pattern -->
<!-- $$$setPattern[overload1]$$$setPatternconstQByteArray& -->
<h3 class="fn" id="setPattern"><a name="setPattern"></a><span class="type">void</span> QByteArrayMatcher::<span class="name">setPattern</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>pattern</i>)</h3>
<p>Sets the byte array that this byte array matcher will search for to <i>pattern</i>.</p>
<p><b>See also </b><a href="qbytearraymatcher.html#pattern">pattern</a>() and <a href="qbytearraymatcher.html#indexIn">indexIn</a>().</p>
<!-- @@@setPattern -->
<!-- $$$operator=[overload1]$$$operator=constQByteArrayMatcher& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qbytearraymatcher.html#QByteArrayMatcher">QByteArrayMatcher</a></span> &QByteArrayMatcher::<span class="name">operator=</span>(const <span class="type"><a href="qbytearraymatcher.html#QByteArrayMatcher">QByteArrayMatcher</a></span> &<i>other</i>)</h3>
<p>Assigns the <i>other</i> byte array matcher to this byte array matcher.</p>
<!-- @@@operator= -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2018 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>