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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Traits Class Requirements</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="../../../index.html" title="Boost.Regex 5.0.1">
<link rel="up" href="../concepts.html" title="Concepts">
<link rel="prev" href="charT_concept.html" title="charT Requirements">
<link rel="next" href="iterator_concepts.html" title="Iterator Requirements">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="charT_concept.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="iterator_concepts.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="boost_regex.ref.concepts.traits_concept"></a><a class="link" href="traits_concept.html" title="Traits Class Requirements">Traits Class
Requirements</a>
</h4></div></div></div>
<p>
There are two sets of requirements for the <code class="computeroutput"><span class="identifier">traits</span></code>
template argument to <a class="link" href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>: a minimal interface
(which is part of the regex standardization proposal), and an optional
Boost-specific enhanced interface.
</p>
<h5>
<a name="boost_regex.ref.concepts.traits_concept.h0"></a>
<span class="phrase"><a name="boost_regex.ref.concepts.traits_concept.minimal_requirements_"></a></span><a class="link" href="traits_concept.html#boost_regex.ref.concepts.traits_concept.minimal_requirements_">Minimal
requirements.</a>
</h5>
<p>
In the following table <code class="computeroutput"><span class="identifier">X</span></code>
denotes a traits class defining types and functions for the character container
type <code class="computeroutput"><span class="identifier">charT</span></code>; <span class="emphasis"><em>u</em></span>
is an object of type <code class="computeroutput"><span class="identifier">X</span></code>;
<span class="emphasis"><em>v</em></span> is an object of type <code class="computeroutput"><span class="keyword">const</span>
<span class="identifier">X</span></code>; <span class="emphasis"><em>p</em></span> is
a value of type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span></code>; <span class="emphasis"><em>I1</em></span> and <span class="emphasis"><em>I2</em></span>
are Input Iterators; <span class="emphasis"><em>c</em></span> is a value of type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">charT</span></code>;
<span class="emphasis"><em>s</em></span> is an object of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">string_type</span></code>;
<span class="emphasis"><em>cs</em></span> is an object of type <code class="computeroutput"><span class="keyword">const</span>
<span class="identifier">X</span><span class="special">::</span><span class="identifier">string_type</span></code>; <span class="emphasis"><em>b</em></span> is
a value of type <code class="computeroutput"><span class="keyword">bool</span></code>; <span class="emphasis"><em>I</em></span>
is a value of type <code class="computeroutput"><span class="keyword">int</span></code>; <span class="emphasis"><em>F1</em></span>
and <span class="emphasis"><em>F2</em></span> are values of type <code class="computeroutput"><span class="keyword">const</span>
<span class="identifier">charT</span><span class="special">*</span></code>;
and <span class="emphasis"><em>loc</em></span> is an object of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">locale_type</span></code>.
</p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Expression
</p>
</th>
<th>
<p>
Return type
</p>
</th>
<th>
<p>
Assertion / Note Pre / Post condition
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
charT
</p>
</td>
<td>
<p>
The character container type used in the implementation of class
template basic_regex.
</p>
</td>
</tr>
<tr>
<td>
<p>
X::size_type
</p>
</td>
<td>
</td>
<td>
<p>
An unsigned integer type, capable of holding the length of a
null-terminated string of charT's.
</p>
</td>
</tr>
<tr>
<td>
<p>
X::string_type
</p>
</td>
<td>
<p>
std::basic_string<charT> or std::vector<charT>
</p>
</td>
<td>
</td>
</tr>
<tr>
<td>
<p>
X::locale_type
</p>
</td>
<td>
<p>
Implementation defined
</p>
</td>
<td>
<p>
A copy constructible type that represents the locale used by
the traits class.
</p>
</td>
</tr>
<tr>
<td>
<p>
X::char_class_type
</p>
</td>
<td>
<p>
Implementation defined
</p>
</td>
<td>
<p>
A bitmask type representing a particular character classification.
Multiple values of this type can be bitwise-or'ed together to
obtain a new valid value.
</p>
</td>
</tr>
<tr>
<td>
<p>
X::length(p)
</p>
</td>
<td>
<p>
X::size_type
</p>
</td>
<td>
<p>
Yields the smallest i such that p[i] == 0. Complexity is linear
in i.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.translate(c)
</p>
</td>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
Returns a character such that for any character d that is to
be considered equivalent to c then v.translate(c) == v.translate(d).
</p>
</td>
</tr>
<tr>
<td>
<p>
v.translate_nocase(c)
</p>
</td>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
For all characters C that are to be considered equivalent to
c when comparisons are to be performed without regard to case,
then v.translate_nocase(c) == v.translate_nocase(C).
</p>
</td>
</tr>
<tr>
<td>
<p>
v.transform(F1, F2)
</p>
</td>
<td>
<p>
X::string_type
</p>
</td>
<td>
<p>
Returns a sort key for the character sequence designated by the
iterator range [F1, F2) such that if the character sequence [G1,
G2) sorts before the character sequence [H1, H2) then v.transform(G1,
G2) < v.transform(H1, H2).
</p>
</td>
</tr>
<tr>
<td>
<p>
v.transform_primary(F1, F2)
</p>
</td>
<td>
<p>
X::string_type
</p>
</td>
<td>
<p>
Returns a sort key for the character sequence designated by the
iterator range [F1, F2) such that if the character sequence [G1,
G2) sorts before the character sequence [H1, H2) when character
case is not considered then v.transform_primary(G1, G2) <
v.transform_primary(H1, H2).
</p>
</td>
</tr>
<tr>
<td>
<p>
v.lookup_classname(F1, F2)
</p>
</td>
<td>
<p>
X::char_class_type
</p>
</td>
<td>
<p>
Converts the character sequence designated by the iterator range
[F1,F2) into a bitmask type that can subsequently be passed to
isctype. Values returned from lookup_classname can be safely
bitwise or'ed together. Returns 0 if the character sequence is
not the name of a character class recognized by X. The value
returned shall be independent of the case of the characters in
the sequence.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.lookup_collatename(F1, F2)
</p>
</td>
<td>
<p>
X::string_type
</p>
</td>
<td>
<p>
Returns a sequence of characters that represents the collating
element consisting of the character sequence designated by the
iterator range [F1, F2). Returns an empty string if the character
sequence is not a valid collating element.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.isctype(c, v.lookup_classname (F1, F2))
</p>
</td>
<td>
<p>
bool
</p>
</td>
<td>
<p>
Returns true if character c is a member of the character class
designated by the iterator range [F1, F2), false otherwise.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.value(c, I)
</p>
</td>
<td>
<p>
int
</p>
</td>
<td>
<p>
Returns the value represented by the digit c in base I if the
character c is a valid digit in base I; otherwise returns -1.
[Note: the value of I will only be 8, 10, or 16. -end note]
</p>
</td>
</tr>
<tr>
<td>
<p>
u.imbue(loc)
</p>
</td>
<td>
<p>
X::locale_type
</p>
</td>
<td>
<p>
Imbues u with the locale loc, returns the previous locale used
by u if any.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.getloc()
</p>
</td>
<td>
<p>
X::locale_type
</p>
</td>
<td>
<p>
Returns the current locale used by v if any.
</p>
</td>
</tr>
</tbody>
</table></div>
<h5>
<a name="boost_regex.ref.concepts.traits_concept.h1"></a>
<span class="phrase"><a name="boost_regex.ref.concepts.traits_concept.additional_optional_requirements"></a></span><a class="link" href="traits_concept.html#boost_regex.ref.concepts.traits_concept.additional_optional_requirements">Additional
Optional Requirements</a>
</h5>
<p>
The following additional requirements are strictly optional, however in
order for <a class="link" href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>
to take advantage of these additional interfaces, all of the following
requirements must be met; <a class="link" href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a> will detect the presence
or absence of the member <code class="computeroutput"><span class="identifier">boost_extensions_tag</span></code>
and configure itself appropriately.
</p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Expression
</p>
</th>
<th>
<p>
Result
</p>
</th>
<th>
<p>
Assertion / Note Pre / Post condition
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
X::boost_extensions_tag
</p>
</td>
<td>
<p>
An unspecified type.
</p>
</td>
<td>
<p>
When present, all of the extensions listed in this table must
be present.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.syntax_type(c)
</p>
</td>
<td>
<p>
regex_constants::syntax_type
</p>
</td>
<td>
<p>
Returns a symbolic value of type regex_constants::syntax_type
that signifies the meaning of character c within the regular
expression grammar.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.escape_syntax_type(c)
</p>
</td>
<td>
<p>
regex_constants::escape_syntax_type
</p>
</td>
<td>
<p>
Returns a symbolic value of type regex_constants::escape_syntax_type,
that signifies the meaning of character c within the regular
expression grammar, when c has been preceded by an escape character.
Precondition: if b is the character preceding c in the expression
being parsed then: <code class="computeroutput"><span class="identifier">v</span><span class="special">.</span><span class="identifier">syntax_type</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special">==</span>
<span class="identifier">syntax_escape</span></code>
</p>
</td>
</tr>
<tr>
<td>
<p>
v.translate(c, b)
</p>
</td>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
Returns a character d such that: for any character d that is
to be considered equivalent to c then <code class="computeroutput"><span class="identifier">v</span><span class="special">.</span><span class="identifier">translate</span><span class="special">(</span><span class="identifier">c</span><span class="special">,</span><span class="keyword">false</span><span class="special">)==</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">translate</span><span class="special">(</span><span class="identifier">d</span><span class="special">,</span><span class="keyword">false</span><span class="special">)</span></code>. Likewise for all characters
C that are to be considered equivalent to c when comparisons
are to be performed without regard to case, then <code class="computeroutput"><span class="identifier">v</span><span class="special">.</span><span class="identifier">translate</span><span class="special">(</span><span class="identifier">c</span><span class="special">,</span><span class="keyword">true</span><span class="special">)==</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">translate</span><span class="special">(</span><span class="identifier">C</span><span class="special">,</span><span class="keyword">true</span><span class="special">)</span></code>.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.toi(I1, I2, i)
</p>
</td>
<td>
<p>
An integer type capable of holding either a charT or an int.
</p>
</td>
<td>
<p>
Behaves as follows: if <code class="computeroutput"><span class="identifier">p</span>
<span class="special">==</span> <span class="identifier">q</span></code>
or if <code class="computeroutput"><span class="special">*</span><span class="identifier">p</span></code>
is not a digit character then returns -1. Otherwise performs
formatted numeric input on the sequence [p,q) and returns the
result as an int. Postcondition: either p == q or *p is a non-digit
character.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.error_string(I)
</p>
</td>
<td>
<p>
std::string
</p>
</td>
<td>
<p>
Returns a human readable error string for the error condition
i, where i is one of the values enumerated by type regex_constants::error_type.
If the value <span class="emphasis"><em>I</em></span> is not recognized then returns
the string "Unknown error" or a localized equivalent.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.tolower(c)
</p>
</td>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
Converts c to lower case, used for Perl-style \l and \L formatting
operations.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.toupper(c)
</p>
</td>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
Converts c to upper case, used for Perl-style \u and \U formatting
operations.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="charT_concept.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="iterator_concepts.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|