• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Traits Class Requirements</title>
5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Boost.Regex 5.1.4">
8<link rel="up" href="../concepts.html" title="Concepts">
9<link rel="prev" href="charT_concept.html" title="charT Requirements">
10<link rel="next" href="iterator_concepts.html" title="Iterator Requirements">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<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>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="boost_regex.ref.concepts.traits_concept"></a><a class="link" href="traits_concept.html" title="Traits Class Requirements">Traits Class
28        Requirements</a>
29</h4></div></div></div>
30<p>
31          There are two sets of requirements for the <code class="computeroutput"><span class="identifier">traits</span></code>
32          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
33          (which is part of the regex standardization proposal), and an optional
34          Boost-specific enhanced interface.
35        </p>
36<h5>
37<a name="boost_regex.ref.concepts.traits_concept.h0"></a>
38          <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
39          requirements.</a>
40        </h5>
41<p>
42          In the following table <code class="computeroutput"><span class="identifier">X</span></code>
43          denotes a traits class defining types and functions for the character container
44          type <code class="computeroutput"><span class="identifier">charT</span></code>; <span class="emphasis"><em>u</em></span>
45          is an object of type <code class="computeroutput"><span class="identifier">X</span></code>;
46          <span class="emphasis"><em>v</em></span> is an object of type <code class="computeroutput"><span class="keyword">const</span>
47          <span class="identifier">X</span></code>; <span class="emphasis"><em>p</em></span> is
48          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>
49          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>;
50          <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>;
51          <span class="emphasis"><em>cs</em></span> is an object of type <code class="computeroutput"><span class="keyword">const</span>
52          <span class="identifier">X</span><span class="special">::</span><span class="identifier">string_type</span></code>; <span class="emphasis"><em>b</em></span> is
53          a value of type <code class="computeroutput"><span class="keyword">bool</span></code>; <span class="emphasis"><em>I</em></span>
54          is a value of type <code class="computeroutput"><span class="keyword">int</span></code>; <span class="emphasis"><em>F1</em></span>
55          and <span class="emphasis"><em>F2</em></span> are values of type <code class="computeroutput"><span class="keyword">const</span>
56          <span class="identifier">charT</span><span class="special">*</span></code>;
57          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>.
58        </p>
59<div class="informaltable"><table class="table">
60<colgroup>
61<col>
62<col>
63<col>
64</colgroup>
65<thead><tr>
66<th>
67                  <p>
68                    Expression
69                  </p>
70                </th>
71<th>
72                  <p>
73                    Return type
74                  </p>
75                </th>
76<th>
77                  <p>
78                    Assertion / Note Pre / Post condition
79                  </p>
80                </th>
81</tr></thead>
82<tbody>
83<tr>
84<td>
85                  <p>
86                    X::char_type
87                  </p>
88                </td>
89<td>
90                  <p>
91                    charT
92                  </p>
93                </td>
94<td>
95                  <p>
96                    The character container type used in the implementation of class
97                    template basic_regex.
98                  </p>
99                </td>
100</tr>
101<tr>
102<td>
103                  <p>
104                    X::size_type
105                  </p>
106                </td>
107<td>
108                </td>
109<td>
110                  <p>
111                    An unsigned integer type, capable of holding the length of a
112                    null-terminated string of charT's.
113                  </p>
114                </td>
115</tr>
116<tr>
117<td>
118                  <p>
119                    X::string_type
120                  </p>
121                </td>
122<td>
123                  <p>
124                    std::basic_string&lt;charT&gt; or std::vector&lt;charT&gt;
125                  </p>
126                </td>
127<td>
128                </td>
129</tr>
130<tr>
131<td>
132                  <p>
133                    X::locale_type
134                  </p>
135                </td>
136<td>
137                  <p>
138                    Implementation defined
139                  </p>
140                </td>
141<td>
142                  <p>
143                    A copy constructible type that represents the locale used by
144                    the traits class.
145                  </p>
146                </td>
147</tr>
148<tr>
149<td>
150                  <p>
151                    X::char_class_type
152                  </p>
153                </td>
154<td>
155                  <p>
156                    Implementation defined
157                  </p>
158                </td>
159<td>
160                  <p>
161                    A bitmask type representing a particular character classification.
162                    Multiple values of this type can be bitwise-or'ed together to
163                    obtain a new valid value.
164                  </p>
165                </td>
166</tr>
167<tr>
168<td>
169                  <p>
170                    X::length(p)
171                  </p>
172                </td>
173<td>
174                  <p>
175                    X::size_type
176                  </p>
177                </td>
178<td>
179                  <p>
180                    Yields the smallest i such that p[i] == 0. Complexity is linear
181                    in i.
182                  </p>
183                </td>
184</tr>
185<tr>
186<td>
187                  <p>
188                    v.translate(c)
189                  </p>
190                </td>
191<td>
192                  <p>
193                    X::char_type
194                  </p>
195                </td>
196<td>
197                  <p>
198                    Returns a character such that for any character d that is to
199                    be considered equivalent to c then v.translate(c) == v.translate(d).
200                  </p>
201                </td>
202</tr>
203<tr>
204<td>
205                  <p>
206                    v.translate_nocase(c)
207                  </p>
208                </td>
209<td>
210                  <p>
211                    X::char_type
212                  </p>
213                </td>
214<td>
215                  <p>
216                    For all characters C that are to be considered equivalent to
217                    c when comparisons are to be performed without regard to case,
218                    then v.translate_nocase(c) == v.translate_nocase(C).
219                  </p>
220                </td>
221</tr>
222<tr>
223<td>
224                  <p>
225                    v.transform(F1, F2)
226                  </p>
227                </td>
228<td>
229                  <p>
230                    X::string_type
231                  </p>
232                </td>
233<td>
234                  <p>
235                    Returns a sort key for the character sequence designated by the
236                    iterator range [F1, F2) such that if the character sequence [G1,
237                    G2) sorts before the character sequence [H1, H2) then v.transform(G1,
238                    G2) &lt; v.transform(H1, H2).
239                  </p>
240                </td>
241</tr>
242<tr>
243<td>
244                  <p>
245                    v.transform_primary(F1, F2)
246                  </p>
247                </td>
248<td>
249                  <p>
250                    X::string_type
251                  </p>
252                </td>
253<td>
254                  <p>
255                    Returns a sort key for the character sequence designated by the
256                    iterator range [F1, F2) such that if the character sequence [G1,
257                    G2) sorts before the character sequence [H1, H2) when character
258                    case is not considered then v.transform_primary(G1, G2) &lt;
259                    v.transform_primary(H1, H2).
260                  </p>
261                </td>
262</tr>
263<tr>
264<td>
265                  <p>
266                    v.lookup_classname(F1, F2)
267                  </p>
268                </td>
269<td>
270                  <p>
271                    X::char_class_type
272                  </p>
273                </td>
274<td>
275                  <p>
276                    Converts the character sequence designated by the iterator range
277                    [F1,F2) into a bitmask type that can subsequently be passed to
278                    isctype. Values returned from lookup_classname can be safely
279                    bitwise or'ed together. Returns 0 if the character sequence is
280                    not the name of a character class recognized by X. The value
281                    returned shall be independent of the case of the characters in
282                    the sequence.
283                  </p>
284                </td>
285</tr>
286<tr>
287<td>
288                  <p>
289                    v.lookup_collatename(F1, F2)
290                  </p>
291                </td>
292<td>
293                  <p>
294                    X::string_type
295                  </p>
296                </td>
297<td>
298                  <p>
299                    Returns a sequence of characters that represents the collating
300                    element consisting of the character sequence designated by the
301                    iterator range [F1, F2). Returns an empty string if the character
302                    sequence is not a valid collating element.
303                  </p>
304                </td>
305</tr>
306<tr>
307<td>
308                  <p>
309                    v.isctype(c, v.lookup_classname (F1, F2))
310                  </p>
311                </td>
312<td>
313                  <p>
314                    bool
315                  </p>
316                </td>
317<td>
318                  <p>
319                    Returns true if character c is a member of the character class
320                    designated by the iterator range [F1, F2), false otherwise.
321                  </p>
322                </td>
323</tr>
324<tr>
325<td>
326                  <p>
327                    v.value(c, I)
328                  </p>
329                </td>
330<td>
331                  <p>
332                    int
333                  </p>
334                </td>
335<td>
336                  <p>
337                    Returns the value represented by the digit c in base I if the
338                    character c is a valid digit in base I; otherwise returns -1.
339                    [Note: the value of I will only be 8, 10, or 16. -end note]
340                  </p>
341                </td>
342</tr>
343<tr>
344<td>
345                  <p>
346                    u.imbue(loc)
347                  </p>
348                </td>
349<td>
350                  <p>
351                    X::locale_type
352                  </p>
353                </td>
354<td>
355                  <p>
356                    Imbues u with the locale loc, returns the previous locale used
357                    by u if any.
358                  </p>
359                </td>
360</tr>
361<tr>
362<td>
363                  <p>
364                    v.getloc()
365                  </p>
366                </td>
367<td>
368                  <p>
369                    X::locale_type
370                  </p>
371                </td>
372<td>
373                  <p>
374                    Returns the current locale used by v if any.
375                  </p>
376                </td>
377</tr>
378</tbody>
379</table></div>
380<h5>
381<a name="boost_regex.ref.concepts.traits_concept.h1"></a>
382          <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
383          Optional Requirements</a>
384        </h5>
385<p>
386          The following additional requirements are strictly optional, however in
387          order for <a class="link" href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>
388          to take advantage of these additional interfaces, all of the following
389          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
390          or absence of the member <code class="computeroutput"><span class="identifier">boost_extensions_tag</span></code>
391          and configure itself appropriately.
392        </p>
393<div class="informaltable"><table class="table">
394<colgroup>
395<col>
396<col>
397<col>
398</colgroup>
399<thead><tr>
400<th>
401                  <p>
402                    Expression
403                  </p>
404                </th>
405<th>
406                  <p>
407                    Result
408                  </p>
409                </th>
410<th>
411                  <p>
412                    Assertion / Note Pre / Post condition
413                  </p>
414                </th>
415</tr></thead>
416<tbody>
417<tr>
418<td>
419                  <p>
420                    X::boost_extensions_tag
421                  </p>
422                </td>
423<td>
424                  <p>
425                    An unspecified type.
426                  </p>
427                </td>
428<td>
429                  <p>
430                    When present, all of the extensions listed in this table must
431                    be present.
432                  </p>
433                </td>
434</tr>
435<tr>
436<td>
437                  <p>
438                    v.syntax_type(c)
439                  </p>
440                </td>
441<td>
442                  <p>
443                    regex_constants::syntax_type
444                  </p>
445                </td>
446<td>
447                  <p>
448                    Returns a symbolic value of type regex_constants::syntax_type
449                    that signifies the meaning of character c within the regular
450                    expression grammar.
451                  </p>
452                </td>
453</tr>
454<tr>
455<td>
456                  <p>
457                    v.escape_syntax_type(c)
458                  </p>
459                </td>
460<td>
461                  <p>
462                    regex_constants::escape_syntax_type
463                  </p>
464                </td>
465<td>
466                  <p>
467                    Returns a symbolic value of type regex_constants::escape_syntax_type,
468                    that signifies the meaning of character c within the regular
469                    expression grammar, when c has been preceded by an escape character.
470                    Precondition: if b is the character preceding c in the expression
471                    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>
472                    <span class="identifier">syntax_escape</span></code>
473                  </p>
474                </td>
475</tr>
476<tr>
477<td>
478                  <p>
479                    v.translate(c, b)
480                  </p>
481                </td>
482<td>
483                  <p>
484                    X::char_type
485                  </p>
486                </td>
487<td>
488                  <p>
489                    Returns a character d such that: for any character d that is
490                    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
491                    C that are to be considered equivalent to c when comparisons
492                    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>.
493                  </p>
494                </td>
495</tr>
496<tr>
497<td>
498                  <p>
499                    v.toi(I1, I2, i)
500                  </p>
501                </td>
502<td>
503                  <p>
504                    An integer type capable of holding either a charT or an int.
505                  </p>
506                </td>
507<td>
508                  <p>
509                    Behaves as follows: if <code class="computeroutput"><span class="identifier">p</span>
510                    <span class="special">==</span> <span class="identifier">q</span></code>
511                    or if <code class="computeroutput"><span class="special">*</span><span class="identifier">p</span></code>
512                    is not a digit character then returns -1. Otherwise performs
513                    formatted numeric input on the sequence [p,q) and returns the
514                    result as an int. Postcondition: either p == q or *p is a non-digit
515                    character.
516                  </p>
517                </td>
518</tr>
519<tr>
520<td>
521                  <p>
522                    v.error_string(I)
523                  </p>
524                </td>
525<td>
526                  <p>
527                    std::string
528                  </p>
529                </td>
530<td>
531                  <p>
532                    Returns a human readable error string for the error condition
533                    i, where i is one of the values enumerated by type regex_constants::error_type.
534                    If the value <span class="emphasis"><em>I</em></span> is not recognized then returns
535                    the string "Unknown error" or a localized equivalent.
536                  </p>
537                </td>
538</tr>
539<tr>
540<td>
541                  <p>
542                    v.tolower(c)
543                  </p>
544                </td>
545<td>
546                  <p>
547                    X::char_type
548                  </p>
549                </td>
550<td>
551                  <p>
552                    Converts c to lower case, used for Perl-style \l and \L formatting
553                    operations.
554                  </p>
555                </td>
556</tr>
557<tr>
558<td>
559                  <p>
560                    v.toupper(c)
561                  </p>
562                </td>
563<td>
564                  <p>
565                    X::char_type
566                  </p>
567                </td>
568<td>
569                  <p>
570                    Converts c to upper case, used for Perl-style \u and \U formatting
571                    operations.
572                  </p>
573                </td>
574</tr>
575</tbody>
576</table></div>
577</div>
578<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
579<td align="left"></td>
580<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p>
581        Distributed under the Boost Software License, Version 1.0. (See accompanying
582        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>)
583      </p>
584</div></td>
585</tr></table>
586<hr>
587<div class="spirit-nav">
588<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>
589</div>
590</body>
591</html>
592