From Jason Turner

[locale.nm.put]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2cl6dj86/{from.md → to.md} +22 -19
tmp/tmp2cl6dj86/{from.md → to.md} RENAMED
@@ -36,11 +36,11 @@ namespace std {
36
  ```
37
 
38
  The facet `num_put` is used to format numeric values to a character
39
  sequence such as an ostream.
40
 
41
- ##### `num_put` members <a id="facet.num.put.members">[[facet.num.put.members]]</a>
42
 
43
  ``` cpp
44
  iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
45
  iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
46
  iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
@@ -51,11 +51,11 @@ iter_type put(iter_type out, ios_base& str, char_type fill, long double val) con
51
  iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
52
  ```
53
 
54
  *Returns:* `do_put(out, str, fill, val)`.
55
 
56
- ##### `num_put` virtual functions <a id="facet.num.put.virtuals">[[facet.num.put.virtuals]]</a>
57
 
58
  ``` cpp
59
  iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
60
  iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
61
  iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
@@ -64,30 +64,30 @@ iter_type do_put(iter_type out, ios_base& str, char_type fill, double val) const
64
  iter_type do_put(iter_type out, ios_base& str, char_type fill, long double val) const;
65
  iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val) const;
66
  ```
67
 
68
  *Effects:* Writes characters to the sequence `out`, formatting `val` as
69
- desired. In the following description, a local variable initialized
70
- with:
71
 
72
  ``` cpp
73
  locale loc = str.getloc();
74
  ```
75
 
76
  The details of this operation occur in several stages:
77
 
78
  - Stage 1: Determine a printf conversion specifier `spec` and determine
79
- the characters that would be printed by `printf` ([[c.files]]) given
80
  this conversion specifier for
81
  ``` cpp
82
  printf(spec, val)
83
  ```
84
 
85
  assuming that the current locale is the `"C"` locale.
86
  - Stage 2: Adjust the representation by converting each `char`
87
  determined by stage 1 to a `charT` using a conversion and values
88
- returned by members of `use_facet<numpunct<charT>>(str.getloc())`
89
  - Stage 3: Determine where padding is required.
90
  - Stage 4: Insert the sequence into the `out`.
91
 
92
  Detailed descriptions of each stage follow.
93
 
@@ -113,13 +113,13 @@ All tables used in describing stage 1 are ordered. That is, the first
113
  line whose condition is true applies. A line without a condition is the
114
  default behavior when none of the earlier lines apply.
115
 
116
  For conversion from an integral type other than a character type, the
117
  function determines the integral conversion specifier as indicated in
118
- Table [[tab:localization.integer.conversions.out]].
119
 
120
- **Table: Integer conversions** <a id="tab:localization.integer.conversions.out">[tab:localization.integer.conversions.out]</a>
121
 
122
  | State | `stdio` equivalent |
123
  | -------------------------------------------- | ------------------ |
124
  | `basefield == ios_base::oct` | `%o` |
125
  | `(basefield == ios_base::hex) && !uppercase` | `%x` |
@@ -128,13 +128,13 @@ Table [[tab:localization.integer.conversions.out]].
128
  | for an `unsigned` integral type | `%u` |
129
 
130
 
131
  For conversion from a floating-point type, the function determines the
132
  floating-point conversion specifier as indicated in
133
- Table [[tab:localization.fp.conversions.out]].
134
 
135
- **Table: Floating-point conversions** <a id="tab:localization.fp.conversions.out">[tab:localization.fp.conversions.out]</a>
136
 
137
  | State | `stdio` equivalent |
138
  | ---------------------------------------------------------------------- | ------------------ |
139
  | `floatfield == ios_base::fixed` | `%f` |
140
  | `floatfield == ios_base::scientific && !uppercase` | `%e` |
@@ -145,13 +145,13 @@ Table [[tab:localization.fp.conversions.out]].
145
  | otherwise | `%G` |
146
 
147
 
148
  For conversions from an integral or floating-point type a length
149
  modifier is added to the conversion specifier as indicated in
150
- Table [[tab:localization.length.modifier.out]].
151
 
152
- **Table: Length modifier** <a id="tab:localization.length.modifier.out">[tab:localization.length.modifier.out]</a>
153
 
154
  | Type | Length modifier |
155
  | -------------------- | --------------- |
156
  | `long` | `l` |
157
  | `long long` | `ll` |
@@ -160,14 +160,13 @@ Table [[tab:localization.length.modifier.out]].
160
  | `long double` | `L` |
161
  | otherwise | none |
162
 
163
 
164
  The conversion specifier has the following optional additional
165
- qualifiers prepended as indicated in
166
- Table [[tab:localization.numeric.conversions]].
167
 
168
- **Table: Numeric conversions** <a id="tab:localization.numeric.conversions">[tab:localization.numeric.conversions]</a>
169
 
170
  | Type(s) | State | `stdio` equivalent |
171
  | --------------------- | ----------- | ------------------ |
172
  | an integral type | `showpos` | `+` |
173
  | | `showbase` | `#` |
@@ -187,16 +186,20 @@ would be printed by a call of `printf(s, val)` where `s` is the
187
  conversion specifier determined above.
188
 
189
  - **Stage 2:**
190
 
191
  Any character `c` other than a decimal point(.) is converted to a
192
- `charT` via `use_facet<ctype<charT>>(loc).widen( c )`
 
 
 
 
193
 
194
  A local variable `punct` is initialized via
195
 
196
  ``` cpp
197
- const numpunct<charT>& punct = use_facet<numpunct<charT>>(str.getloc());
198
  ```
199
 
200
  For arithmetic types, `punct.thousands_sep()` characters are inserted
201
  into the sequence as determined by the value returned by
202
  `punct.do_grouping()` using the method described
@@ -211,13 +214,13 @@ A local variable is initialized as
211
  ``` cpp
212
  fmtflags adjustfield = (flags & (ios_base::adjustfield));
213
  ```
214
 
215
  The location of any padding[^12] is determined according to
216
- Table [[tab:localization.fill.padding]].
217
 
218
- **Table: Fill padding** <a id="tab:localization.fill.padding">[tab:localization.fill.padding]</a>
219
 
220
  | State | Location |
221
  | ------------------------------------------------------------------------------ | ------------------ |
222
  | `adjustfield == ios_base::left` | pad after |
223
  | `adjustfield == ios_base::right` | pad before |
 
36
  ```
37
 
38
  The facet `num_put` is used to format numeric values to a character
39
  sequence such as an ostream.
40
 
41
+ ##### Members <a id="facet.num.put.members">[[facet.num.put.members]]</a>
42
 
43
  ``` cpp
44
  iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
45
  iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
46
  iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
 
51
  iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
52
  ```
53
 
54
  *Returns:* `do_put(out, str, fill, val)`.
55
 
56
+ ##### Virtual functions <a id="facet.num.put.virtuals">[[facet.num.put.virtuals]]</a>
57
 
58
  ``` cpp
59
  iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
60
  iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
61
  iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
 
64
  iter_type do_put(iter_type out, ios_base& str, char_type fill, long double val) const;
65
  iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val) const;
66
  ```
67
 
68
  *Effects:* Writes characters to the sequence `out`, formatting `val` as
69
+ desired. In the following description, `loc` names a local variable
70
+ initialized as
71
 
72
  ``` cpp
73
  locale loc = str.getloc();
74
  ```
75
 
76
  The details of this operation occur in several stages:
77
 
78
  - Stage 1: Determine a printf conversion specifier `spec` and determine
79
+ the characters that would be printed by `printf` [[c.files]] given
80
  this conversion specifier for
81
  ``` cpp
82
  printf(spec, val)
83
  ```
84
 
85
  assuming that the current locale is the `"C"` locale.
86
  - Stage 2: Adjust the representation by converting each `char`
87
  determined by stage 1 to a `charT` using a conversion and values
88
+ returned by members of `use_facet<numpunct<charT>>(loc)`.
89
  - Stage 3: Determine where padding is required.
90
  - Stage 4: Insert the sequence into the `out`.
91
 
92
  Detailed descriptions of each stage follow.
93
 
 
113
  line whose condition is true applies. A line without a condition is the
114
  default behavior when none of the earlier lines apply.
115
 
116
  For conversion from an integral type other than a character type, the
117
  function determines the integral conversion specifier as indicated in
118
+ [[facet.num.put.int]].
119
 
120
+ **Table: Integer conversions** <a id="facet.num.put.int">[facet.num.put.int]</a>
121
 
122
  | State | `stdio` equivalent |
123
  | -------------------------------------------- | ------------------ |
124
  | `basefield == ios_base::oct` | `%o` |
125
  | `(basefield == ios_base::hex) && !uppercase` | `%x` |
 
128
  | for an `unsigned` integral type | `%u` |
129
 
130
 
131
  For conversion from a floating-point type, the function determines the
132
  floating-point conversion specifier as indicated in
133
+ [[facet.num.put.fp]].
134
 
135
+ **Table: Floating-point conversions** <a id="facet.num.put.fp">[facet.num.put.fp]</a>
136
 
137
  | State | `stdio` equivalent |
138
  | ---------------------------------------------------------------------- | ------------------ |
139
  | `floatfield == ios_base::fixed` | `%f` |
140
  | `floatfield == ios_base::scientific && !uppercase` | `%e` |
 
145
  | otherwise | `%G` |
146
 
147
 
148
  For conversions from an integral or floating-point type a length
149
  modifier is added to the conversion specifier as indicated in
150
+ [[facet.num.put.length]].
151
 
152
+ **Table: Length modifier** <a id="facet.num.put.length">[facet.num.put.length]</a>
153
 
154
  | Type | Length modifier |
155
  | -------------------- | --------------- |
156
  | `long` | `l` |
157
  | `long long` | `ll` |
 
160
  | `long double` | `L` |
161
  | otherwise | none |
162
 
163
 
164
  The conversion specifier has the following optional additional
165
+ qualifiers prepended as indicated in [[facet.num.put.conv]].
 
166
 
167
+ **Table: Numeric conversions** <a id="facet.num.put.conv">[facet.num.put.conv]</a>
168
 
169
  | Type(s) | State | `stdio` equivalent |
170
  | --------------------- | ----------- | ------------------ |
171
  | an integral type | `showpos` | `+` |
172
  | | `showbase` | `#` |
 
186
  conversion specifier determined above.
187
 
188
  - **Stage 2:**
189
 
190
  Any character `c` other than a decimal point(.) is converted to a
191
+ `charT` via
192
+
193
+ ``` cpp
194
+ use_facet<ctype<charT>>(loc).widen(c)
195
+ ```
196
 
197
  A local variable `punct` is initialized via
198
 
199
  ``` cpp
200
+ const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
201
  ```
202
 
203
  For arithmetic types, `punct.thousands_sep()` characters are inserted
204
  into the sequence as determined by the value returned by
205
  `punct.do_grouping()` using the method described
 
214
  ``` cpp
215
  fmtflags adjustfield = (flags & (ios_base::adjustfield));
216
  ```
217
 
218
  The location of any padding[^12] is determined according to
219
+ [[facet.num.put.fill]].
220
 
221
+ **Table: Fill padding** <a id="facet.num.put.fill">[facet.num.put.fill]</a>
222
 
223
  | State | Location |
224
  | ------------------------------------------------------------------------------ | ------------------ |
225
  | `adjustfield == ios_base::left` | pad after |
226
  | `adjustfield == ios_base::right` | pad before |