File: class_qaregexp.html

package info (click to toggle)
regexplorer 0.1.3-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 332 kB
  • ctags: 222
  • sloc: cpp: 1,166; perl: 99; makefile: 45; sh: 32
file content (306 lines) | stat: -rw-r--r-- 9,085 bytes parent folder | download
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<title>QaRegExp Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<center><a href="annotated.html">Compound list</a> &nbsp; <a href="files.html">File list</a> &nbsp; <a href="headers.html">Header files</a> &nbsp; <a href="functions.html">Compound Members</a> &nbsp; <a href="globals.html">File Members</a> &nbsp; 
</center><hr>
<h1>QaRegExp Class Reference</h1>

<p>
Matches Regular Expressions against strings. <a href="#details">More...</a>
<p>
<code>#include &lt;<a class="el" href="class_qaregexp-include.html">qaregexp.hpp</a>&gt;</code>
<p>
<a href="class_qaregexp-members.html">List of all members.</a><h2>Public Members</h2>
<ul>
<li> <a class="el" href="class_qaregexp.html#a0">QaRegExp</a> ( const QString &amp;r, bool c = true )
<li> <a class="el" href="class_qaregexp.html#a1">QaRegExp</a> ( const QaRegExp &amp;r )
<li>virtual <a class="el" href="class_qaregexp.html#a2">~QaRegExp</a> ()
<li>bool <a class="el" href="class_qaregexp.html#a3">caseSensitive</a> () const
<li>void <a class="el" href="class_qaregexp.html#a4">setCaseSensitive</a> ( bool s )
<li>bool <a class="el" href="class_qaregexp.html#a5">match</a> ( const QString &amp;s, int sub = 0 )
<li>int <a class="el" href="class_qaregexp.html#a6">matchMultiple</a> ( const QString &amp;s, int sub = 0 )
<li>QString <a class="el" href="class_qaregexp.html#a7">matchString</a> ( int sub = 0 )
<li>QStringList <a class="el" href="class_qaregexp.html#a8">matchStrings</a> ()
<li>int <a class="el" href="class_qaregexp.html#a9">matchBeginning</a> ( int sub = 0 ) const
<li>int <a class="el" href="class_qaregexp.html#a10">matchEnd</a> ( int sub = 0 ) const
<li>const QaRegExpMatch&amp; <a class="el" href="class_qaregexp.html#a11">matches</a> () const
<li>void <a class="el" href="class_qaregexp.html#a12">split</a> ( const QString &amp;s )
<li>int <a class="el" href="class_qaregexp.html#a13">subCount</a> () const
<li>void <a class="el" href="class_qaregexp.html#a14">setExpression</a> ( const QString &amp;r )
<li>QaRegExp&amp; <a class="el" href="class_qaregexp.html#a15">operator =</a> ( const QaRegExp &amp;r )
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
Matches Regular Expressions against strings.
<p>

<p>
  <dl compact><dt>
<b>Warning: </b><dd>
 This version does not support unicode strings, they are converted to ascii before being used.

<p>
</dl>  This class uses the system calls reg_comp and reg_exec, see the man pages for regex for more information
  on regular expressions.

<p>
  Example:
  <div class="fragment"><pre>
  // Match for &lt;text&gt; = &lt;text&gt;
  <a class="el" href="class_qaregexp.html">QaRegExp</a> reg( "([a-zA-Z]+)[ \t]*=[ \t]*([a-zA-Z]+)" );

  // Now match the string
  if ( reg.<a class="el" href="class_qaregexp.html#a5">match</a>( "RegExpTest = True" ) )
  {
      <a class="el" href="class_qaregexpmatch.html">QaRegExpMatch</a> m = reg.<a class="el" href="class_qaregexp.html#a11">matches</a>();

      // Now print out all matches
      for ( QStringList::ConstIterator it = m.<a class="el" href="class_qaregexpmatch.html#a6">toString</a>().begin(); it != m.<a class="el" href="class_qaregexpmatch.html#a6">toString</a>().end(); ++it )
      {
          qDebug( "\"%s\"", (*it).ascii() );
      }
  }

  // Or use it like this
  if ( reg.<a class="el" href="class_qaregexp.html#a5">match</a>( "RegExpTest = True", 2 ) )
      qDebug( "%s", reg.<a class="el" href="class_qaregexp.html#a7">matchString</a>( 2 ).ascii() );</div></pre>

<p>

<p>

<p>
<hr><h2>Member Function Documentation</h2>

<h3><a name="a0" doxytag="QaRegExp::QaRegExp"></a> QaRegExp::QaRegExp( const <a class="el" doxygen="qt.tag:/usr/lib/qt/doc/" href="/usr/lib/qt/doc/qstring.html">QString</a> &amp;r, bool c = true )</h3>
<div class="in">

<p>

<p>
  Creates a regexp query.
  <dl compact><dt>
<b>Parameters: </b><dd>
<em>r</em> -  The string to use for regular expression matching.
  <dd>
<em>c</em> -  True means match case sensitive.

<p>
</dl>
<p>
</div>

<h3><a name="a1" doxytag="QaRegExp::QaRegExp"></a> QaRegExp::QaRegExp( const QaRegExp &amp;r )</h3>
<div class="in">

<p>
</div>

<h3><a name="a2" doxytag="QaRegExp::~QaRegExp"></a>virtual QaRegExp::~QaRegExp()<code> [virtual]</code></h3>
<div class="in">

<p>

<p>
  Destroys the object

<p>

<p>
</div>

<h3><a name="a3" doxytag="QaRegExp::caseSensitive"></a>bool QaRegExp::caseSensitive() const</h3>
<div class="in">

<p>

<p>
  <dl compact><dt>
<b>Returns: </b><dd>
 True if matching is done case sensitive.

<p>
</dl>
<p>
</div>

<h3><a name="a4" doxytag="QaRegExp::setCaseSensitive"></a>void QaRegExp::setCaseSensitive( bool s )</h3>
<div class="in">

<p>

<p>
  Sets the case sensitivity flag.

<p>

<p>
</div>

<h3><a name="a5" doxytag="QaRegExp::match"></a>bool QaRegExp::match( const <a class="el" doxygen="qt.tag:/usr/lib/qt/doc/" href="/usr/lib/qt/doc/qstring.html">QString</a> &amp;s, int sub = 0 )</h3>
<div class="in">

<p>

<p>
  Matches a string against the regexp on the given sub expression.
  <dl compact><dt>
<b>Parameters: </b><dd>
<em>s</em> -  The string to match on.
  <dd>
<em>sub</em> -  Which sub expression should be checked, 0 is default and means the whole regexp.
  </dl><dl compact><dt>
<b>Returns: </b><dd>
 True if the subexpression matched.

<p>
</dl>
<p>
</div>

<h3><a name="a6" doxytag="QaRegExp::matchMultiple"></a>int QaRegExp::matchMultiple( const <a class="el" doxygen="qt.tag:/usr/lib/qt/doc/" href="/usr/lib/qt/doc/qstring.html">QString</a> &amp;s, int sub = 0 )</h3>
<div class="in">

<p>

<p>
  Matches a string against the regexp on the given sub expression, will match as
  many times as possible and extracting the wanted subexpression every time it
  matches.
  <dl compact><dt>
<b>Parameters: </b><dd>
<em>s</em> -  The string to match on.
  <dd>
<em>sub</em> -  Which sub expression should be checked, 0 is default and means the whole regexp.
  </dl><dl compact><dt>
<b>Returns: </b><dd>
 Number of matches.

<p>
</dl>
<p>
</div>

<h3><a name="a7" doxytag="QaRegExp::matchString"></a><a class="el" doxygen="qt.tag:/usr/lib/qt/doc/" href="/usr/lib/qt/doc/qstring.html">QString</a> QaRegExp::matchString( int sub = 0 )</h3>
<div class="in">

<p>

<p>
  <dl compact><dt>
<b>Returns: </b><dd>
 The string that matched the sub expression.

<p>
</dl>
<p>
</div>

<h3><a name="a8" doxytag="QaRegExp::matchStrings"></a><a class="el" doxygen="qt.tag:/usr/lib/qt/doc/" href="/usr/lib/qt/doc/qstringlist.html">QStringList</a> QaRegExp::matchStrings()</h3>
<div class="in">

<p>

<p>
  <dl compact><dt>
<b>Returns: </b><dd>
 A list of sub expression strings.

<p>
</dl>
<p>
</div>

<h3><a name="a9" doxytag="QaRegExp::matchBeginning"></a>int QaRegExp::matchBeginning( int sub = 0 ) const</h3>
<div class="in">

<p>

<p>
  <dl compact><dt>
<b>Returns: </b><dd>
 The start offset of the matched sub expression.

<p>
</dl>
<p>
</div>

<h3><a name="a10" doxytag="QaRegExp::matchEnd"></a>int QaRegExp::matchEnd( int sub = 0 ) const</h3>
<div class="in">

<p>

<p>
  <dl compact><dt>
<b>Returns: </b><dd>
 The start offset of the matched sub expression.

<p>
</dl>
<p>
</div>

<h3><a name="a11" doxytag="QaRegExp::matches"></a>const <a class="el" href="class_qaregexpmatch.html">QaRegExpMatch</a>&amp;  QaRegExp::matches() const</h3>
<div class="in">

<p>

<p>
  <dl compact><dt>
<b>Returns: </b><dd>
 A class with all matching information.

<p>
</dl>
<p>
</div>

<h3><a name="a12" doxytag="QaRegExp::split"></a>void QaRegExp::split( const <a class="el" doxygen="qt.tag:/usr/lib/qt/doc/" href="/usr/lib/qt/doc/qstring.html">QString</a> &amp;s )</h3>
<div class="in">

<p>

<p>
  Splits up the string using the regexp string as the delimiter.
  <dl compact><dt>
<b>Parameters: </b><dd>
<em>s</em> -  The string to split.

<p>
</dl>
<p>
</div>

<h3><a name="a13" doxytag="QaRegExp::subCount"></a>int QaRegExp::subCount() const</h3>
<div class="in">

<p>

<p>
  <dl compact><dt>
<b>Returns: </b><dd>
 The subexpression count, excluding the master expression.

<p>
</dl>
<p>
</div>

<h3><a name="a14" doxytag="QaRegExp::setExpression"></a>void QaRegExp::setExpression( const <a class="el" doxygen="qt.tag:/usr/lib/qt/doc/" href="/usr/lib/qt/doc/qstring.html">QString</a> &amp;r )</h3>
<div class="in">

<p>
</div>

<h3><a name="a15" doxytag="QaRegExp::operator ="></a>QaRegExp&amp;  QaRegExp::operator =( const QaRegExp &amp;r )</h3>
<div class="in">

<p>
</div>
<hr>The documentation for this  class was generated from the following files:<ul>
<li><a class="el" href="qaregexp.cpp.html">qaregexp.cpp</a><li><a class="el" href="qaregexp.hpp.html">qaregexp.hpp</a></ul>
<hr><address><small>Generated at Mon Aug 16 02:11:02 1999 for QaRegExp by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"><img src="doxygen.gif" alt="doxygen" align=center border=0 width=118 height=53></a>&nbsp; written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, &copy; 1997-1998</small></address>
</body>
</html>