From Jason Turner

[category.ctype]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpxu5qcc73/{from.md → to.md} +35 -22
tmp/tmpxu5qcc73/{from.md → to.md} RENAMED
@@ -1,7 +1,9 @@
1
  ### The `ctype` category <a id="category.ctype">[[category.ctype]]</a>
2
 
 
 
3
  ``` cpp
4
  namespace std {
5
  class ctype_base {
6
  public:
7
  using mask = see below;
@@ -25,10 +27,12 @@ namespace std {
25
 
26
  The type `mask` is a bitmask type [[bitmask.types]].
27
 
28
  #### Class template `ctype` <a id="locale.ctype">[[locale.ctype]]</a>
29
 
 
 
30
  ``` cpp
31
  namespace std {
32
  template<class charT>
33
  class ctype : public locale::facet, public ctype_base {
34
  public:
@@ -198,12 +202,14 @@ charT do_widen(char c) const;
198
  const char* do_widen(const char* low, const char* high, charT* dest) const;
199
  ```
200
 
201
  *Effects:* Applies the simplest reasonable transformation from a `char`
202
  value or sequence of `char` values to the corresponding `charT` value or
203
- values.[^5] The only characters for which unique transformations are
204
- required are those in the basic source character set [[lex.charset]].
 
 
205
 
206
  For any named `ctype` category with a `ctype<charT>` facet `ctc` and
207
  valid `ctype_base::mask` value `M`,
208
  `(ctc.is(M, c) || !is(M, do_widen(c)) )` is `true`.[^6]
209
 
@@ -220,12 +226,12 @@ const charT* do_narrow(const charT* low, const charT* high, char dfault, char* d
220
 
221
  *Effects:* Applies the simplest reasonable transformation from a `charT`
222
  value or sequence of `charT` values to the corresponding `char` value or
223
  values.
224
 
225
- For any character `c` in the basic source character set [[lex.charset]]
226
- the transformation is such that
227
 
228
  ``` cpp
229
  do_widen(do_narrow(c, 0)) == c
230
  ```
231
 
@@ -263,10 +269,12 @@ namespace std {
263
  }
264
  ```
265
 
266
  #### `ctype<char>` specialization <a id="facet.ctype.special">[[facet.ctype.special]]</a>
267
 
 
 
268
  ``` cpp
269
  namespace std {
270
  template<>
271
  class ctype<char> : public locale::facet, public ctype_base {
272
  public:
@@ -310,12 +318,14 @@ namespace std {
310
  };
311
  }
312
  ```
313
 
314
  A specialization `ctype<char>` is provided so that the member functions
315
- on type `char` can be implemented inline.[^7] The
316
- *implementation-defined* value of member `table_size` is at least 256.
 
 
317
 
318
  ##### Destructor <a id="facet.ctype.char.dtor">[[facet.ctype.char.dtor]]</a>
319
 
320
  ``` cpp
321
  ~ctype();
@@ -439,10 +449,12 @@ virtual const char* do_narrow(const char* low, const char* high,
439
  These functions are described identically as those members of the same
440
  name in the `ctype` class template [[locale.ctype.members]].
441
 
442
  #### Class template `codecvt` <a id="locale.codecvt">[[locale.codecvt]]</a>
443
 
 
 
444
  ``` cpp
445
  namespace std {
446
  class codecvt_base {
447
  public:
448
  enum result { ok, partial, error, noconv };
@@ -511,19 +523,19 @@ mapped between.
511
  The specializations required in [[locale.category.facets]]
512
  [[locale.category]] convert the implementation-defined native character
513
  set. `codecvt<char, char, mbstate_t>` implements a degenerate
514
  conversion; it does not convert at all. The specialization
515
  `codecvt<char16_t, char8_t, mbstate_t>` converts between the UTF-16 and
516
- UTF-8 encoding forms, and the specialization `codecvt`
517
- `<char32_t, char8_t, mbstate_t>` converts between the UTF-32 and UTF-8
518
- encoding forms. `codecvt<wchar_t, char, mbstate_t>` converts between the
519
- native character sets for ordinary and wide characters. Specializations
520
- on `mbstate_t` perform conversion between encodings known to the library
521
- implementer. Other encodings can be converted by specializing on a
522
- program-defined `stateT` type. Objects of type `stateT` can contain any
523
- state that is useful to communicate to or from the specialized `do_in`
524
- or `do_out` members.
525
 
526
  ##### Members <a id="locale.codecvt.members">[[locale.codecvt.members]]</a>
527
 
528
  ``` cpp
529
  result out(
@@ -636,44 +648,45 @@ shall also return `ok`.[^8]
636
 
637
  [*Note 1*: As a result of operations on `state`, it can return `ok` or
638
  `partial` and set `from_next == from` and
639
  `to_next != to`. — *end note*]
640
 
641
- *Remarks:* Its operations on `state` are unspecified.
642
-
643
- [*Note 2*: This argument can be used, for example, to maintain shift
644
- state, to specify conversion options (such as count only), or to
645
- identify a cache of seek offsets. — *end note*]
646
-
647
  *Returns:* An enumeration value, as summarized in
648
  [[locale.codecvt.inout]].
649
 
650
  **Table: `do_in/do_out` result values** <a id="locale.codecvt.inout">[locale.codecvt.inout]</a>
651
 
652
  | Value | Meaning |
653
  | --------- | ------------------------------------------------------------------------------------------------ |
654
  | `ok` | completed the conversion |
655
  | `partial` | not all source characters converted |
656
- | `error` | encountered a character in {[}`from`, `from_end`{)} that it could not convert |
657
  | `noconv` | `internT` and `externT` are the same type, and input sequence is identical to converted sequence |
658
 
659
 
660
  A return value of `partial`, if `(from_next == from_end)`, indicates
661
  that either the destination sequence has not absorbed all the available
662
  destination elements, or that additional source elements are needed
663
  before another destination element can be produced.
664
 
 
 
 
 
 
 
665
  ``` cpp
666
  result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
667
  ```
668
 
669
  *Preconditions:* `(to <= to_end)` is well-defined and `true`; `state` is
670
  initialized, if at the beginning of a sequence, or else is equal to the
671
  result of converting the preceding characters in the sequence.
672
 
673
  *Effects:* Places characters starting at `to` that should be appended to
674
  terminate a sequence when the current `stateT` is given by `state`.[^9]
 
675
  Stores no more than `(to_end - to)` destination elements, and leaves the
676
  `to_next` pointer pointing one beyond the last element successfully
677
  stored.
678
 
679
  *Returns:* An enumeration value, as summarized in
 
1
  ### The `ctype` category <a id="category.ctype">[[category.ctype]]</a>
2
 
3
+ #### General <a id="category.ctype.general">[[category.ctype.general]]</a>
4
+
5
  ``` cpp
6
  namespace std {
7
  class ctype_base {
8
  public:
9
  using mask = see below;
 
27
 
28
  The type `mask` is a bitmask type [[bitmask.types]].
29
 
30
  #### Class template `ctype` <a id="locale.ctype">[[locale.ctype]]</a>
31
 
32
+ ##### General <a id="locale.ctype.general">[[locale.ctype.general]]</a>
33
+
34
  ``` cpp
35
  namespace std {
36
  template<class charT>
37
  class ctype : public locale::facet, public ctype_base {
38
  public:
 
202
  const char* do_widen(const char* low, const char* high, charT* dest) const;
203
  ```
204
 
205
  *Effects:* Applies the simplest reasonable transformation from a `char`
206
  value or sequence of `char` values to the corresponding `charT` value or
207
+ values.[^5]
208
+
209
+ The only characters for which unique transformations are required are
210
+ those in the basic character set [[lex.charset]].
211
 
212
  For any named `ctype` category with a `ctype<charT>` facet `ctc` and
213
  valid `ctype_base::mask` value `M`,
214
  `(ctc.is(M, c) || !is(M, do_widen(c)) )` is `true`.[^6]
215
 
 
226
 
227
  *Effects:* Applies the simplest reasonable transformation from a `charT`
228
  value or sequence of `charT` values to the corresponding `char` value or
229
  values.
230
 
231
+ For any character `c` in the basic character set [[lex.charset]] the
232
+ transformation is such that
233
 
234
  ``` cpp
235
  do_widen(do_narrow(c, 0)) == c
236
  ```
237
 
 
269
  }
270
  ```
271
 
272
  #### `ctype<char>` specialization <a id="facet.ctype.special">[[facet.ctype.special]]</a>
273
 
274
+ ##### General <a id="facet.ctype.special.general">[[facet.ctype.special.general]]</a>
275
+
276
  ``` cpp
277
  namespace std {
278
  template<>
279
  class ctype<char> : public locale::facet, public ctype_base {
280
  public:
 
318
  };
319
  }
320
  ```
321
 
322
  A specialization `ctype<char>` is provided so that the member functions
323
+ on type `char` can be implemented inline.[^7]
324
+
325
+ The *implementation-defined* value of member `table_size` is at least
326
+ 256.
327
 
328
  ##### Destructor <a id="facet.ctype.char.dtor">[[facet.ctype.char.dtor]]</a>
329
 
330
  ``` cpp
331
  ~ctype();
 
449
  These functions are described identically as those members of the same
450
  name in the `ctype` class template [[locale.ctype.members]].
451
 
452
  #### Class template `codecvt` <a id="locale.codecvt">[[locale.codecvt]]</a>
453
 
454
+ ##### General <a id="locale.codecvt.general">[[locale.codecvt.general]]</a>
455
+
456
  ``` cpp
457
  namespace std {
458
  class codecvt_base {
459
  public:
460
  enum result { ok, partial, error, noconv };
 
523
  The specializations required in [[locale.category.facets]]
524
  [[locale.category]] convert the implementation-defined native character
525
  set. `codecvt<char, char, mbstate_t>` implements a degenerate
526
  conversion; it does not convert at all. The specialization
527
  `codecvt<char16_t, char8_t, mbstate_t>` converts between the UTF-16 and
528
+ UTF-8 encoding forms, and the specialization
529
+ `codecvt<char32_t, char8_t, mbstate_t>` converts between the UTF-32 and
530
+ UTF-8 encoding forms. `codecvt<wchar_t, char, mbstate_t>` converts
531
+ between the native character sets for ordinary and wide characters.
532
+ Specializations on `mbstate_t` perform conversion between encodings
533
+ known to the library implementer. Other encodings can be converted by
534
+ specializing on a program-defined `stateT` type. Objects of type
535
+ `stateT` can contain any state that is useful to communicate to or from
536
+ the specialized `do_in` or `do_out` members.
537
 
538
  ##### Members <a id="locale.codecvt.members">[[locale.codecvt.members]]</a>
539
 
540
  ``` cpp
541
  result out(
 
648
 
649
  [*Note 1*: As a result of operations on `state`, it can return `ok` or
650
  `partial` and set `from_next == from` and
651
  `to_next != to`. — *end note*]
652
 
 
 
 
 
 
 
653
  *Returns:* An enumeration value, as summarized in
654
  [[locale.codecvt.inout]].
655
 
656
  **Table: `do_in/do_out` result values** <a id="locale.codecvt.inout">[locale.codecvt.inout]</a>
657
 
658
  | Value | Meaning |
659
  | --------- | ------------------------------------------------------------------------------------------------ |
660
  | `ok` | completed the conversion |
661
  | `partial` | not all source characters converted |
662
+ | `error` | encountered a character in {[}`from`, `from_end`{)} that cannot be converted |
663
  | `noconv` | `internT` and `externT` are the same type, and input sequence is identical to converted sequence |
664
 
665
 
666
  A return value of `partial`, if `(from_next == from_end)`, indicates
667
  that either the destination sequence has not absorbed all the available
668
  destination elements, or that additional source elements are needed
669
  before another destination element can be produced.
670
 
671
+ *Remarks:* Its operations on `state` are unspecified.
672
+
673
+ [*Note 2*: This argument can be used, for example, to maintain shift
674
+ state, to specify conversion options (such as count only), or to
675
+ identify a cache of seek offsets. — *end note*]
676
+
677
  ``` cpp
678
  result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
679
  ```
680
 
681
  *Preconditions:* `(to <= to_end)` is well-defined and `true`; `state` is
682
  initialized, if at the beginning of a sequence, or else is equal to the
683
  result of converting the preceding characters in the sequence.
684
 
685
  *Effects:* Places characters starting at `to` that should be appended to
686
  terminate a sequence when the current `stateT` is given by `state`.[^9]
687
+
688
  Stores no more than `(to_end - to)` destination elements, and leaves the
689
  `to_next` pointer pointing one beyond the last element successfully
690
  stored.
691
 
692
  *Returns:* An enumeration value, as summarized in