From Jason Turner

[category.monetary]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp8lnuz6jh/{from.md → to.md} +55 -48
tmp/tmp8lnuz6jh/{from.md → to.md} RENAMED
@@ -6,25 +6,24 @@ whether local or international monetary formats are to be used.
6
  All specifications of member functions for `money_put` and `money_get`
7
  in the subclauses of  [[category.monetary]] only apply to the
8
  specializations required in Tables  [[tab:localization.category.facets]]
9
  and  [[tab:localization.required.specializations]] (
10
  [[locale.category]]). Their members use their `ios_base&`,
11
- `ios_base :: iostate&`, and `fill` arguments as described in (
12
- [[locale.categories]]), and the `moneypunct<>` and `ctype<>` facets, to
13
  determine formatting details.
14
 
15
  #### Class template `money_get` <a id="locale.money.get">[[locale.money.get]]</a>
16
 
17
  ``` cpp
18
  namespace std {
19
- template <class charT,
20
- class InputIterator = istreambuf_iterator<charT> >
21
  class money_get : public locale::facet {
22
  public:
23
- typedef charT char_type;
24
- typedef InputIterator iter_type;
25
- typedef basic_string<charT> string_type;
26
 
27
  explicit money_get(size_t refs = 0);
28
 
29
  iter_type get(iter_type s, iter_type end, bool intl,
30
  ios_base& f, ios_base::iostate& err,
@@ -53,11 +52,11 @@ iter_type get(iter_type s, iter_type end, bool intl,
53
  long double& quant) const;
54
  iter_type get(s, iter_type end, bool intl, ios_base&f,
55
  ios_base::iostate& err, string_type& quant) const;
56
  ```
57
 
58
- *Returns:* `do_get(s, end, intl, f, err, quant)`
59
 
60
  ##### `money_get` virtual functions <a id="locale.money.get.virtuals">[[locale.money.get.virtuals]]</a>
61
 
62
  ``` cpp
63
  iter_type do_get(iter_type s, iter_type end, bool intl,
@@ -78,13 +77,17 @@ does not change `err`; otherwise, sets `err` to `(err|str.failbit)`, or
78
  does not change `units` or `digits`. Uses the pattern returned by
79
  `mp.neg_format()` to parse all values. The result is returned as an
80
  integral value stored in `units` or as a sequence of digits possibly
81
  preceded by a minus sign (as produced by `ct.widen(c)` where `c` is
82
  `’-’` or in the range from `’0’` through `’9’`, inclusive) stored in
83
- `digits`. The sequence `$1,056.23` in a common United States locale
84
- would yield, for `units`, `105623`, or, for `digits`, `"105623"`. If
85
- `mp.grouping()` indicates that no thousands separators are permitted,
 
 
 
 
86
  any such characters are not read, and parsing is terminated at the point
87
  where they first appear. Otherwise, thousands separators are optional;
88
  if present, they are checked for correct placement only after all format
89
  components have been read.
90
 
@@ -100,27 +103,30 @@ format; otherwise, the currency symbol is required.
100
 
101
  If the first character (if any) in the string `pos` returned by
102
  `mp.positive_sign()` or the string `neg` returned by
103
  `mp.negative_sign()` is recognized in the position indicated by `sign`
104
  in the format pattern, it is consumed and any remaining characters in
105
- the string are required after all the other format components. If
106
- `showbase` is off, then for a `neg` value of `"()"` and a currency
107
- symbol of `"L"`, in `"(100 L)"` the `"L"` is consumed; but if `neg` is
108
- `"-"`, the `"L"` in `"-100 L"` is not consumed. If `pos` or `neg` is
109
- empty, the sign component is optional, and if no sign is detected, the
110
- result is given the sign that corresponds to the source of the empty
111
- string. Otherwise, the character in the indicated position must match
112
- the first character of `pos` or `neg`, and the result is given the
113
- corresponding sign. If the first character of `pos` is equal to the
114
- first character of `neg`, or if both strings are empty, the result is
115
- given a positive sign.
 
 
 
116
 
117
  Digits in the numeric monetary component are extracted and placed in
118
  `digits`, or into a character buffer `buf1` for conversion to produce a
119
  value for `units`, in the order in which they appear, preceded by a
120
  minus sign if and only if the result is negative. The value `units` is
121
- produced as if by[^19]
122
 
123
  ``` cpp
124
  for (int i = 0; i < n; ++i)
125
  buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
126
  buf2[n] = 0;
@@ -141,17 +147,16 @@ recognized as part of a valid monetary quantity.
141
 
142
  #### Class template `money_put` <a id="locale.money.put">[[locale.money.put]]</a>
143
 
144
  ``` cpp
145
  namespace std {
146
- template <class charT,
147
- class OutputIterator = ostreambuf_iterator<charT> >
148
  class money_put : public locale::facet {
149
  public:
150
- typedef charT char_type;
151
- typedef OutputIterator iter_type;
152
- typedef basic_string<charT> string_type;
153
 
154
  explicit money_put(size_t refs = 0);
155
 
156
  iter_type put(iter_type s, bool intl, ios_base& f,
157
  char_type fill, long double units) const;
@@ -177,11 +182,11 @@ iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
177
  long double quant) const;
178
  iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
179
  const string_type& quant) const;
180
  ```
181
 
182
- *Returns:* `do_put(s, intl, f, loc, quant)`
183
 
184
  ##### `money_put` virtual functions <a id="locale.money.put.virtuals">[[locale.money.put.virtuals]]</a>
185
 
186
  ``` cpp
187
  iter_type do_put(iter_type s, bool intl, ios_base& str,
@@ -216,16 +221,18 @@ Calls `str.width(0)`.
216
  `(str.flags() & str.showbase)` is nonzero. If the number of characters
217
  generated for the specified format is less than the value returned by
218
  `str.width()` on entry to the function, then copies of `fill` are
219
  inserted as necessary to pad to the specified width. For the value `af`
220
  equal to `(str.flags() & str.adjustfield)`, if `(af == str.internal)` is
221
- true, the fill characters are placed where `none` or `space` appears in
222
- the formatting pattern; otherwise if `(af == str.left)` is true, they
223
- are placed after the other characters; otherwise, they are placed before
224
- the other characters. It is possible, with some combinations of format
225
- patterns and flag values, to produce output that cannot be parsed using
226
- `num_get<>::get`.
 
 
227
 
228
  *Returns:* An iterator pointing immediately after the last character
229
  produced.
230
 
231
  #### Class template `moneypunct` <a id="locale.moneypunct">[[locale.moneypunct]]</a>
@@ -239,12 +246,12 @@ namespace std {
239
  };
240
 
241
  template <class charT, bool International = false>
242
  class moneypunct : public locale::facet, public money_base {
243
  public:
244
- typedef charT char_type;
245
- typedef basic_string<charT> string_type;
246
 
247
  explicit moneypunct(size_t refs = 0);
248
 
249
  charT decimal_point() const;
250
  charT thousands_sep() const;
@@ -276,11 +283,11 @@ namespace std {
276
 
277
  The `moneypunct<>` facet defines monetary formatting parameters used by
278
  `money_get<>` and `money_put<>`. A monetary format is a sequence of four
279
  components, specified by a `pattern` value `p`, such that the `part`
280
  value `static_cast<part>(p.field[i])` determines the `i`th component of
281
- the format[^20] In the `field` member of a `pattern` object, each value
282
  `symbol`, `sign`, `value`, and either `space` or `none` appears exactly
283
  once. The value `none`, if present, is not first; the value `space`, if
284
  present, is neither first nor last.
285
 
286
  Where `none` or `space` appears, white space is permitted in the format,
@@ -343,56 +350,56 @@ int frac_digits() const;
343
  pattern pos_format() const;
344
  pattern neg_format() const;
345
  ```
346
 
347
  Each of these functions `F` returns the result of calling the
348
- corresponding virtual member function `do_`***F***`()`.
349
 
350
  ##### `moneypunct` virtual functions <a id="locale.moneypunct.virtuals">[[locale.moneypunct.virtuals]]</a>
351
 
352
  ``` cpp
353
  charT do_decimal_point() const;
354
  ```
355
 
356
  *Returns:* The radix separator to use in case `do_frac_digits()` is
357
- greater than zero.[^21]
358
 
359
  ``` cpp
360
  charT do_thousands_sep() const;
361
  ```
362
 
363
  *Returns:* The digit group separator to use in case `do_grouping()`
364
- specifies a digit grouping pattern.[^22]
365
 
366
  ``` cpp
367
  string do_grouping() const;
368
  ```
369
 
370
  *Returns:* A pattern defined identically as, but not necessarily equal
371
- to, the result of `numpunct<charT>::do_grouping()`.[^23]
372
 
373
  ``` cpp
374
  string_type do_curr_symbol() const;
375
  ```
376
 
377
- *Returns:* A string to use as the currency identifier symbol.[^24]
378
 
379
  ``` cpp
380
  string_type do_positive_sign() const;
381
  string_type do_negative_sign() const;
382
  ```
383
 
384
  *Returns:* `do_positive_sign()` returns the string to use to indicate a
385
- positive monetary value;[^25] `do_negative_sign()` returns the string to
386
  use to indicate a negative value.
387
 
388
  ``` cpp
389
  int do_frac_digits() const;
390
  ```
391
 
392
  *Returns:* The number of digits after the decimal radix separator, if
393
- any.[^26]
394
 
395
  ``` cpp
396
  pattern do_pos_format() const;
397
  pattern do_neg_format() const;
398
  ```
@@ -400,21 +407,21 @@ pattern do_neg_format() const;
400
  *Returns:* The specializations required in
401
  Table  [[tab:localization.required.specializations]] ([[locale.category]]),
402
  namely `moneypunct<char>`, `moneypunct<wchar_t>`,
403
  `moneypunct<char, true>`, and `moneypunct<wchar_t, true>`, return an
404
  object of type `pattern` initialized to
405
- `{ symbol, sign, none, value }`.[^27]
406
 
407
  #### Class template `moneypunct_byname` <a id="locale.moneypunct.byname">[[locale.moneypunct.byname]]</a>
408
 
409
  ``` cpp
410
  namespace std {
411
  template <class charT, bool Intl = false>
412
  class moneypunct_byname : public moneypunct<charT, Intl> {
413
  public:
414
- typedef money_base::pattern pattern;
415
- typedef basic_string<charT> string_type;
416
 
417
  explicit moneypunct_byname(const char*, size_t refs = 0);
418
  explicit moneypunct_byname(const string&, size_t refs = 0);
419
  protected:
420
  ~moneypunct_byname();
 
6
  All specifications of member functions for `money_put` and `money_get`
7
  in the subclauses of  [[category.monetary]] only apply to the
8
  specializations required in Tables  [[tab:localization.category.facets]]
9
  and  [[tab:localization.required.specializations]] (
10
  [[locale.category]]). Their members use their `ios_base&`,
11
+ `ios_base::iostate&`, and `fill` arguments as described in 
12
+ [[locale.categories]], and the `moneypunct<>` and `ctype<>` facets, to
13
  determine formatting details.
14
 
15
  #### Class template `money_get` <a id="locale.money.get">[[locale.money.get]]</a>
16
 
17
  ``` cpp
18
  namespace std {
19
+ template <class charT, class InputIterator = istreambuf_iterator<charT>>
 
20
  class money_get : public locale::facet {
21
  public:
22
+ using char_type = charT;
23
+ using iter_type = InputIterator;
24
+ using string_type = basic_string<charT>;
25
 
26
  explicit money_get(size_t refs = 0);
27
 
28
  iter_type get(iter_type s, iter_type end, bool intl,
29
  ios_base& f, ios_base::iostate& err,
 
52
  long double& quant) const;
53
  iter_type get(s, iter_type end, bool intl, ios_base&f,
54
  ios_base::iostate& err, string_type& quant) const;
55
  ```
56
 
57
+ *Returns:* `do_get(s, end, intl, f, err, quant)`.
58
 
59
  ##### `money_get` virtual functions <a id="locale.money.get.virtuals">[[locale.money.get.virtuals]]</a>
60
 
61
  ``` cpp
62
  iter_type do_get(iter_type s, iter_type end, bool intl,
 
77
  does not change `units` or `digits`. Uses the pattern returned by
78
  `mp.neg_format()` to parse all values. The result is returned as an
79
  integral value stored in `units` or as a sequence of digits possibly
80
  preceded by a minus sign (as produced by `ct.widen(c)` where `c` is
81
  `’-’` or in the range from `’0’` through `’9’`, inclusive) stored in
82
+ `digits`.
83
+
84
+ [*Example 1*: The sequence `$1,056.23` in a common United States locale
85
+ would yield, for `units`, `105623`, or, for `digits`,
86
+ `"105623"`. — *end example*]
87
+
88
+ If `mp.grouping()` indicates that no thousands separators are permitted,
89
  any such characters are not read, and parsing is terminated at the point
90
  where they first appear. Otherwise, thousands separators are optional;
91
  if present, they are checked for correct placement only after all format
92
  components have been read.
93
 
 
103
 
104
  If the first character (if any) in the string `pos` returned by
105
  `mp.positive_sign()` or the string `neg` returned by
106
  `mp.negative_sign()` is recognized in the position indicated by `sign`
107
  in the format pattern, it is consumed and any remaining characters in
108
+ the string are required after all the other format components.
109
+
110
+ [*Example 2*: If `showbase` is off, then for a `neg` value of `"()"`
111
+ and a currency symbol of `"L"`, in `"(100 L)"` the `"L"` is consumed;
112
+ but if `neg` is `"-"`, the `"L"` in `"-100 L"` is not
113
+ consumed. *end example*]
114
+
115
+ If `pos` or `neg` is empty, the sign component is optional, and if no
116
+ sign is detected, the result is given the sign that corresponds to the
117
+ source of the empty string. Otherwise, the character in the indicated
118
+ position must match the first character of `pos` or `neg`, and the
119
+ result is given the corresponding sign. If the first character of `pos`
120
+ is equal to the first character of `neg`, or if both strings are empty,
121
+ the result is given a positive sign.
122
 
123
  Digits in the numeric monetary component are extracted and placed in
124
  `digits`, or into a character buffer `buf1` for conversion to produce a
125
  value for `units`, in the order in which they appear, preceded by a
126
  minus sign if and only if the result is negative. The value `units` is
127
+ produced as if by[^20]
128
 
129
  ``` cpp
130
  for (int i = 0; i < n; ++i)
131
  buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
132
  buf2[n] = 0;
 
147
 
148
  #### Class template `money_put` <a id="locale.money.put">[[locale.money.put]]</a>
149
 
150
  ``` cpp
151
  namespace std {
152
+ template <class charT, class OutputIterator = ostreambuf_iterator<charT>>
 
153
  class money_put : public locale::facet {
154
  public:
155
+ using char_type = charT;
156
+ using iter_type = OutputIterator;
157
+ using string_type = basic_string<charT>;
158
 
159
  explicit money_put(size_t refs = 0);
160
 
161
  iter_type put(iter_type s, bool intl, ios_base& f,
162
  char_type fill, long double units) const;
 
182
  long double quant) const;
183
  iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
184
  const string_type& quant) const;
185
  ```
186
 
187
+ *Returns:* `do_put(s, intl, f, loc, quant)`.
188
 
189
  ##### `money_put` virtual functions <a id="locale.money.put.virtuals">[[locale.money.put.virtuals]]</a>
190
 
191
  ``` cpp
192
  iter_type do_put(iter_type s, bool intl, ios_base& str,
 
221
  `(str.flags() & str.showbase)` is nonzero. If the number of characters
222
  generated for the specified format is less than the value returned by
223
  `str.width()` on entry to the function, then copies of `fill` are
224
  inserted as necessary to pad to the specified width. For the value `af`
225
  equal to `(str.flags() & str.adjustfield)`, if `(af == str.internal)` is
226
+ `true`, the fill characters are placed where `none` or `space` appears
227
+ in the formatting pattern; otherwise if `(af == str.left)` is `true`,
228
+ they are placed after the other characters; otherwise, they are placed
229
+ before the other characters.
230
+
231
+ [*Note 1*: It is possible, with some combinations of format patterns
232
+ and flag values, to produce output that cannot be parsed using
233
+ `num_get<>::get`. — *end note*]
234
 
235
  *Returns:* An iterator pointing immediately after the last character
236
  produced.
237
 
238
  #### Class template `moneypunct` <a id="locale.moneypunct">[[locale.moneypunct]]</a>
 
246
  };
247
 
248
  template <class charT, bool International = false>
249
  class moneypunct : public locale::facet, public money_base {
250
  public:
251
+ using char_type = charT;
252
+ using string_type = basic_string<charT>;
253
 
254
  explicit moneypunct(size_t refs = 0);
255
 
256
  charT decimal_point() const;
257
  charT thousands_sep() const;
 
283
 
284
  The `moneypunct<>` facet defines monetary formatting parameters used by
285
  `money_get<>` and `money_put<>`. A monetary format is a sequence of four
286
  components, specified by a `pattern` value `p`, such that the `part`
287
  value `static_cast<part>(p.field[i])` determines the `i`th component of
288
+ the format[^21] In the `field` member of a `pattern` object, each value
289
  `symbol`, `sign`, `value`, and either `space` or `none` appears exactly
290
  once. The value `none`, if present, is not first; the value `space`, if
291
  present, is neither first nor last.
292
 
293
  Where `none` or `space` appears, white space is permitted in the format,
 
350
  pattern pos_format() const;
351
  pattern neg_format() const;
352
  ```
353
 
354
  Each of these functions `F` returns the result of calling the
355
+ corresponding virtual member function `do_F()`.
356
 
357
  ##### `moneypunct` virtual functions <a id="locale.moneypunct.virtuals">[[locale.moneypunct.virtuals]]</a>
358
 
359
  ``` cpp
360
  charT do_decimal_point() const;
361
  ```
362
 
363
  *Returns:* The radix separator to use in case `do_frac_digits()` is
364
+ greater than zero.[^22]
365
 
366
  ``` cpp
367
  charT do_thousands_sep() const;
368
  ```
369
 
370
  *Returns:* The digit group separator to use in case `do_grouping()`
371
+ specifies a digit grouping pattern.[^23]
372
 
373
  ``` cpp
374
  string do_grouping() const;
375
  ```
376
 
377
  *Returns:* A pattern defined identically as, but not necessarily equal
378
+ to, the result of `numpunct<charT>::do_grouping()`.[^24]
379
 
380
  ``` cpp
381
  string_type do_curr_symbol() const;
382
  ```
383
 
384
+ *Returns:* A string to use as the currency identifier symbol.[^25]
385
 
386
  ``` cpp
387
  string_type do_positive_sign() const;
388
  string_type do_negative_sign() const;
389
  ```
390
 
391
  *Returns:* `do_positive_sign()` returns the string to use to indicate a
392
+ positive monetary value;[^26] `do_negative_sign()` returns the string to
393
  use to indicate a negative value.
394
 
395
  ``` cpp
396
  int do_frac_digits() const;
397
  ```
398
 
399
  *Returns:* The number of digits after the decimal radix separator, if
400
+ any.[^27]
401
 
402
  ``` cpp
403
  pattern do_pos_format() const;
404
  pattern do_neg_format() const;
405
  ```
 
407
  *Returns:* The specializations required in
408
  Table  [[tab:localization.required.specializations]] ([[locale.category]]),
409
  namely `moneypunct<char>`, `moneypunct<wchar_t>`,
410
  `moneypunct<char, true>`, and `moneypunct<wchar_t, true>`, return an
411
  object of type `pattern` initialized to
412
+ `{ symbol, sign, none, value }`.[^28]
413
 
414
  #### Class template `moneypunct_byname` <a id="locale.moneypunct.byname">[[locale.moneypunct.byname]]</a>
415
 
416
  ``` cpp
417
  namespace std {
418
  template <class charT, bool Intl = false>
419
  class moneypunct_byname : public moneypunct<charT, Intl> {
420
  public:
421
+ using pattern = money_base::pattern;
422
+ using string_type = basic_string<charT>;
423
 
424
  explicit moneypunct_byname(const char*, size_t refs = 0);
425
  explicit moneypunct_byname(const string&, size_t refs = 0);
426
  protected:
427
  ~moneypunct_byname();