1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/corelib/tools/qbytearraymatcher.cpp -->
7
<title>Qt 4.0: QByteArrayMatcher Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QByteArrayMatcher Class Reference</h1>
21
<p>The QByteArrayMatcher class holds a sequence of bytes that can be quickly matched in a byte array. <a href="#details">More...</a></p>
22
<pre>#include <QByteArrayMatcher></pre><p>Part of the <a href="qtcore.html">QtCore</a> module.</p>
24
<li><a href="qbytearraymatcher-members.html">List of all members, including inherited members</a></li>
26
<a name="public-functions"></a>
27
<h3>Public Functions</h3>
29
<li><div class="fn"/><b><a href="qbytearraymatcher.html#QByteArrayMatcher">QByteArrayMatcher</a></b> ()</li>
30
<li><div class="fn"/><b><a href="qbytearraymatcher.html#QByteArrayMatcher-2">QByteArrayMatcher</a></b> ( const QByteArray & <i>pattern</i> )</li>
31
<li><div class="fn"/><b><a href="qbytearraymatcher.html#QByteArrayMatcher-3">QByteArrayMatcher</a></b> ( const QByteArrayMatcher & <i>other</i> )</li>
32
<li><div class="fn"/><b><a href="qbytearraymatcher.html#dtor.QByteArrayMatcher">~QByteArrayMatcher</a></b> ()</li>
33
<li><div class="fn"/>int <b><a href="qbytearraymatcher.html#indexIn">indexIn</a></b> ( const QByteArray & <i>ba</i>, int <i>from</i> = 0 ) const</li>
34
<li><div class="fn"/>QByteArray <b><a href="qbytearraymatcher.html#pattern">pattern</a></b> () const</li>
35
<li><div class="fn"/>void <b><a href="qbytearraymatcher.html#setPattern">setPattern</a></b> ( const QByteArray & <i>pattern</i> )</li>
36
<li><div class="fn"/>QByteArrayMatcher & <b><a href="qbytearraymatcher.html#operator-eq">operator=</a></b> ( const QByteArrayMatcher & <i>other</i> )</li>
38
<a name="details"></a>
40
<h2>Detailed Description</h2>
41
<p>The QByteArrayMatcher class holds a sequence of bytes that can be quickly matched in a byte array.</p>
42
<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>
43
<p>Create the QByteArrayMatcher 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>
44
<p>See also <a href="qbytearray.html">QByteArray</a> and <a href="qstringmatcher.html">QStringMatcher</a>.</p>
46
<h2>Member Function Documentation</h2>
47
<h3 class="fn"><a name="QByteArrayMatcher"></a>QByteArrayMatcher::QByteArrayMatcher ()</h3>
48
<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>
49
<h3 class="fn"><a name="QByteArrayMatcher-2"></a>QByteArrayMatcher::QByteArrayMatcher ( const <a href="qbytearray.html">QByteArray</a> & <i>pattern</i> )</h3>
50
<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>
51
<h3 class="fn"><a name="QByteArrayMatcher-3"></a>QByteArrayMatcher::QByteArrayMatcher ( const QByteArrayMatcher & <i>other</i> )</h3>
52
<p>Copies the <i>other</i> byte array matcher to this byte array matcher.</p>
53
<h3 class="fn"><a name="dtor.QByteArrayMatcher"></a>QByteArrayMatcher::~QByteArrayMatcher ()</h3>
54
<p>Destroys the byte array matcher.</p>
55
<h3 class="fn"><a name="indexIn"></a>int QByteArrayMatcher::indexIn ( const <a href="qbytearray.html">QByteArray</a> & <i>ba</i>, int <i>from</i> = 0 ) const</h3>
56
<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>
57
<h3 class="fn"><a name="pattern"></a><a href="qbytearray.html">QByteArray</a> QByteArrayMatcher::pattern () const</h3>
58
<p>Returns the byte array pattern that this byte array matcher will search for.</p>
59
<p>See also <a href="qbytearraymatcher.html#setPattern">setPattern</a>().</p>
60
<h3 class="fn"><a name="setPattern"></a>void QByteArrayMatcher::setPattern ( const <a href="qbytearray.html">QByteArray</a> & <i>pattern</i> )</h3>
61
<p>Sets the byte array that this byte array matcher will search for to <i>pattern</i>.</p>
62
<p>See also <a href="qbytearraymatcher.html#pattern">pattern</a>() and <a href="qbytearraymatcher.html#indexIn">indexIn</a>().</p>
63
<h3 class="fn"><a name="operator-eq"></a>QByteArrayMatcher & QByteArrayMatcher::operator= ( const QByteArrayMatcher & <i>other</i> )</h3>
64
<p>Assigns the <i>other</i> byte array matcher to this byte array matcher.</p>
65
<p /><address><hr /><div align="center">
66
<table width="100%" cellspacing="0" border="0"><tr class="address">
67
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
68
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
69
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
70
</tr></table></div></address></body>