File: classWt_1_1WRegExpValidator.html

package info (click to toggle)
witty 3.1.2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 45,512 kB
  • ctags: 35,832
  • sloc: cpp: 69,469; ansic: 66,945; xml: 4,383; sh: 594; perl: 108; makefile: 106
file content (301 lines) | stat: -rw-r--r-- 18,493 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt: Wt::WRegExpValidator Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceWt.html">Wt</a>::<a class="el" href="classWt_1_1WRegExpValidator.html">WRegExpValidator</a>
  </div>
</div>
<div class="contents">
<h1>Wt::WRegExpValidator Class Reference</h1><!-- doxytag: class="Wt::WRegExpValidator" --><!-- doxytag: inherits="Wt::WValidator" -->A validator that checks user input against a regular expression.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;Wt/WRegExpValidator&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for Wt::WRegExpValidator:</div>
<div class="dynsection">
<p><center><img src="classWt_1_1WRegExpValidator__inherit__graph.png" border="0" usemap="#Wt_1_1WRegExpValidator__inherit__map" alt="Inheritance graph"></center>
<map name="Wt_1_1WRegExpValidator__inherit__map">
<area shape="rect" href="classWt_1_1WValidator.html" title="A validator is used to validate user input according to pre&#45;defined rules." alt="" coords="28,80,135,107"><area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="33,5,129,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>

<p>
<a href="classWt_1_1WRegExpValidator-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c73905fa4427ee0ab0ee83e6eeac0373"></a><!-- doxytag: member="Wt::WRegExpValidator::WRegExpValidator" ref="c73905fa4427ee0ab0ee83e6eeac0373" args="(WObject *parent=0)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#c73905fa4427ee0ab0ee83e6eeac0373">WRegExpValidator</a> (<a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets a new regular expression validator. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#7536b67e2bedd2dfdb5b89c9dd56602b">WRegExpValidator</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;pattern, <a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets a new regular expression validator that accepts input that matches the given regular expression.  <a href="#7536b67e2bedd2dfdb5b89c9dd56602b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a3a0d2b4c2bec81325eebfab1530d3dc"></a><!-- doxytag: member="Wt::WRegExpValidator::~WRegExpValidator" ref="a3a0d2b4c2bec81325eebfab1530d3dc" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#a3a0d2b4c2bec81325eebfab1530d3dc">~WRegExpValidator</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#71190cef122cc6000be16d9703393cd9">setRegExp</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;pattern)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the regular expression for valid input.  <a href="#71190cef122cc6000be16d9703393cd9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WString.html">WString</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#d4af69a61c23bf59db1b7c6bedf56311">regExp</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the regular expression for valid input.  <a href="#d4af69a61c23bf59db1b7c6bedf56311"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classWt_1_1WValidator.html#638a1feefca259ea2f806a8add2d18a3">State</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#cd0bc1ff9dc23f4f34c6840e3d0d5edc">validate</a> (<a class="el" href="classWt_1_1WString.html">WString</a> &amp;input) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Validates the given input.  <a href="#cd0bc1ff9dc23f4f34c6840e3d0d5edc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6ca44df82213538b13026d27f721669c"></a><!-- doxytag: member="Wt::WRegExpValidator::createExtConfig" ref="6ca44df82213538b13026d27f721669c" args="(std::ostream &amp;config) const " -->
virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#6ca44df82213538b13026d27f721669c">createExtConfig</a> (std::ostream &amp;config) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Provides Ext-compatible config options for client-side validation. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#41fdea26cc852b40a1f1c16c09624f01">setNoMatchText</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;text)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the text to be shown if no match can be found.  <a href="#41fdea26cc852b40a1f1c16c09624f01"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#41b52e1428a6561c5be695702e20318a">setInvalidNoMatchText</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;text)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the message to display when the input does not match.  <a href="#41b52e1428a6561c5be695702e20318a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WString.html">WString</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#144ed2ffa928a0f6f28e456880126397">invalidNoMatchText</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the message displayed when the input does not match.  <a href="#144ed2ffa928a0f6f28e456880126397"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WRegExpValidator.html#ae5e8bce20a76f654cd007b8b85cba0d">javaScriptValidate</a> (const std::string &amp;jsRef) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a Javascript expression that validates the input.  <a href="#ae5e8bce20a76f654cd007b8b85cba0d"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A validator that checks user input against a regular expression. 
<p>
This validator checks whether user input is matched by the given (perl-like) regular expression.<p>
The following perl features are not supported (since client-side validation cannot handle them): <ul>
<li>
No Lookbehind support, i.e. the constructs (?&lt;=text) and (?&lt;!text).  </li>
<li>
No atomic grouping, i.e. the construct (?&gt;group). </li>
<li>
No conditional expressions, i.e. the consturct (?ifthen|else). </li>
</ul>
<p>
Usage example:<p>
<div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a> *lineEdit = <span class="keyword">new</span> <a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a>(<span class="keyword">this</span>);
 <span class="comment">// an email address validator</span>
 <a class="code" href="classWt_1_1WRegExpValidator.html" title="A validator that checks user input against a regular expression.">Wt::WRegExpValidator</a> *validator = <span class="keyword">new</span> <a class="code" href="classWt_1_1WRegExpValidator.html" title="A validator that checks user input against a regular expression.">Wt::WRegExpValidator</a>(<span class="stringliteral">"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}"</span>);
 lineEdit-&gt;<a class="code" href="classWt_1_1WFormWidget.html#a773d16013d6959149ce5081e84b259c" title="Sets a validator for this field.">setValidator</a>(validator);
 lineEdit-&gt;<a class="code" href="classWt_1_1WLineEdit.html#ddb99c6ab5483836adf44a2706a410af" title="Sets the content of the line edit.">setText</a>(<span class="stringliteral">"koen@emweb.be"</span>);
</pre></div><p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This validator does not fully support unicode: it matches on the UTF8-encoded representation of the string. </dd></dl>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="7536b67e2bedd2dfdb5b89c9dd56602b"></a><!-- doxytag: member="Wt::WRegExpValidator::WRegExpValidator" ref="7536b67e2bedd2dfdb5b89c9dd56602b" args="(const WString &amp;pattern, WObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Wt::WRegExpValidator::WRegExpValidator           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>pattern</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classWt_1_1WObject.html">WObject</a> *&nbsp;</td>
          <td class="paramname"> <em>parent</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets a new regular expression validator that accepts input that matches the given regular expression. 
<p>
This constructs a validator that matches the perl regular expression <code>expr</code>. 
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="71190cef122cc6000be16d9703393cd9"></a><!-- doxytag: member="Wt::WRegExpValidator::setRegExp" ref="71190cef122cc6000be16d9703393cd9" args="(const WString &amp;pattern)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WRegExpValidator::setRegExp           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>pattern</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the regular expression for valid input. 
<p>
Sets the perl regular expression <code>expr</code>. 
</div>
</div><p>
<a class="anchor" name="d4af69a61c23bf59db1b7c6bedf56311"></a><!-- doxytag: member="Wt::WRegExpValidator::regExp" ref="d4af69a61c23bf59db1b7c6bedf56311" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1WString.html">WString</a> Wt::WRegExpValidator::regExp           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the regular expression for valid input. 
<p>
Returns the perl regular expression. 
</div>
</div><p>
<a class="anchor" name="cd0bc1ff9dc23f4f34c6840e3d0d5edc"></a><!-- doxytag: member="Wt::WRegExpValidator::validate" ref="cd0bc1ff9dc23f4f34c6840e3d0d5edc" args="(WString &amp;input) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1WValidator.html#638a1feefca259ea2f806a8add2d18a3">WValidator::State</a> Wt::WRegExpValidator::validate           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classWt_1_1WString.html">WString</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>input</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Validates the given input. 
<p>
The input is considered valid only when it is blank for a non-mandatory field, or matches the regular expression. 
<p>Reimplemented from <a class="el" href="classWt_1_1WValidator.html#fce53cf7c8fa1692234df0538163b4e0">Wt::WValidator</a>.</p>

</div>
</div><p>
<a class="anchor" name="41fdea26cc852b40a1f1c16c09624f01"></a><!-- doxytag: member="Wt::WRegExpValidator::setNoMatchText" ref="41fdea26cc852b40a1f1c16c09624f01" args="(const WString &amp;text)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WRegExpValidator::setNoMatchText           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>text</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the text to be shown if no match can be found. 
<p>
Sets the text to be shown if no match can be found. 
</div>
</div><p>
<a class="anchor" name="41b52e1428a6561c5be695702e20318a"></a><!-- doxytag: member="Wt::WRegExpValidator::setInvalidNoMatchText" ref="41b52e1428a6561c5be695702e20318a" args="(const WString &amp;text)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WRegExpValidator::setInvalidNoMatchText           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>text</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the message to display when the input does not match. 
<p>
The default value is "Invalid input". 
</div>
</div><p>
<a class="anchor" name="144ed2ffa928a0f6f28e456880126397"></a><!-- doxytag: member="Wt::WRegExpValidator::invalidNoMatchText" ref="144ed2ffa928a0f6f28e456880126397" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1WString.html">WString</a> Wt::WRegExpValidator::invalidNoMatchText           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the message displayed when the input does not match. 
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WRegExpValidator.html#41b52e1428a6561c5be695702e20318a" title="Sets the message to display when the input does not match.">setInvalidNoMatchText(const WString&amp;)</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="ae5e8bce20a76f654cd007b8b85cba0d"></a><!-- doxytag: member="Wt::WRegExpValidator::javaScriptValidate" ref="ae5e8bce20a76f654cd007b8b85cba0d" args="(const std::string &amp;jsRef) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string Wt::WRegExpValidator::javaScriptValidate           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>jsRef</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a Javascript expression that validates the input. 
<p>
The JavaScript expression should evaluate to an object with two fields: a boolean <em>valid</em>, and a <code>message</code> that indicates the problem if not valid.<p>
Return an empty string if you are not provide the client-side validation.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WValidator.html#1ca29b7eaabf4c1655200ec382a84554" title="Returns a regular expression that filters input.">inputFilter()</a> </dd></dl>

<p>Reimplemented from <a class="el" href="classWt_1_1WValidator.html#5141a6c178329e6d26faad71e7bf26aa">Wt::WValidator</a>.</p>

</div>
</div><p>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:07 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>