tmp/tmp6k9zoo2k/{from.md → to.md}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
### The monetary category <a id="category.monetary">[[category.monetary]]</a>
|
| 2 |
|
| 3 |
-
#### General <a id="category.monetary.general">[[category.monetary.general]]</a>
|
| 4 |
|
| 5 |
These templates handle monetary formats. A template parameter indicates
|
| 6 |
whether local or international monetary formats are to be used.
|
| 7 |
|
| 8 |
All specifications of member functions for `money_put` and `money_get`
|
|
@@ -11,11 +11,13 @@ specializations required in Tables [[tab:locale.category.facets]] and
|
|
| 11 |
[[tab:locale.spec]] [[locale.category]]. Their members use their
|
| 12 |
`ios_base&`, `ios_base::iostate&`, and `fill` arguments as described in
|
| 13 |
[[locale.categories]], and the `moneypunct<>` and `ctype<>` facets, to
|
| 14 |
determine formatting details.
|
| 15 |
|
| 16 |
-
#### Class template `money_get` <a id="locale.money.get">[[locale.money.get]]</a>
|
|
|
|
|
|
|
| 17 |
|
| 18 |
``` cpp
|
| 19 |
namespace std {
|
| 20 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 21 |
class money_get : public locale::facet {
|
|
@@ -43,22 +45,22 @@ namespace std {
|
|
| 43 |
ios_base::iostate& err, string_type& digits) const;
|
| 44 |
};
|
| 45 |
}
|
| 46 |
```
|
| 47 |
|
| 48 |
-
##### Members <a id="locale.money.get.members">[[locale.money.get.members]]</a>
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
| 52 |
ios_base::iostate& err, long double& quant) const;
|
| 53 |
iter_type get(iter_type 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 |
-
##### 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, ios_base& str,
|
| 63 |
ios_base::iostate& err, long double& units) const;
|
| 64 |
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
|
@@ -68,18 +70,18 @@ iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
|
| 68 |
*Effects:* Reads characters from `s` to parse and construct a monetary
|
| 69 |
value according to the format specified by a `moneypunct<charT, Intl>`
|
| 70 |
facet reference `mp` and the character mapping specified by a
|
| 71 |
`ctype<charT>` facet reference `ct` obtained from the locale returned by
|
| 72 |
`str.getloc()`, and `str.flags()`. If a valid sequence is recognized,
|
| 73 |
-
does not change `err`; otherwise, sets `err` to `(err|str.failbit)`,
|
| 74 |
-
`(err|str.failbit|str.eofbit)` if no more characters are
|
| 75 |
-
does not change `units` or `digits`. Uses the pattern
|
| 76 |
-
`mp.neg_format()` to parse all values. The result is
|
| 77 |
-
integral value stored in `units` or as a sequence of
|
| 78 |
-
preceded by a minus sign (as produced by `ct.widen(c)`
|
| 79 |
-
`’-’` or in the range from `’0’` through `’9’` (inclusive))
|
| 80 |
-
`digits`.
|
| 81 |
|
| 82 |
[*Example 1*: The sequence `$1,056.23` in a common United States locale
|
| 83 |
would yield, for `units`, `105623`, or, for `digits`,
|
| 84 |
`"105623"`. — *end example*]
|
| 85 |
|
|
@@ -120,11 +122,11 @@ the result is given a positive sign.
|
|
| 120 |
|
| 121 |
Digits in the numeric monetary component are extracted and placed in
|
| 122 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 123 |
value for `units`, in the order in which they appear, preceded by a
|
| 124 |
minus sign if and only if the result is negative. The value `units` is
|
| 125 |
-
produced as if by[^
|
| 126 |
|
| 127 |
``` cpp
|
| 128 |
for (int i = 0; i < n; ++i)
|
| 129 |
buf2[i] = src[find(atoms, atoms + sizeof(src), buf1[i]) - atoms];
|
| 130 |
buf2[n] = 0;
|
|
@@ -141,11 +143,13 @@ ct.widen(src, src + sizeof(src) - 1, atoms);
|
|
| 141 |
```
|
| 142 |
|
| 143 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 144 |
recognized as part of a valid monetary quantity.
|
| 145 |
|
| 146 |
-
#### Class template `money_put` <a id="locale.money.put">[[locale.money.put]]</a>
|
|
|
|
|
|
|
| 147 |
|
| 148 |
``` cpp
|
| 149 |
namespace std {
|
| 150 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 151 |
class money_put : public locale::facet {
|
|
@@ -171,20 +175,20 @@ namespace std {
|
|
| 171 |
const string_type& digits) const;
|
| 172 |
};
|
| 173 |
}
|
| 174 |
```
|
| 175 |
|
| 176 |
-
##### Members <a id="locale.money.put.members">[[locale.money.put.members]]</a>
|
| 177 |
|
| 178 |
``` cpp
|
| 179 |
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
|
| 180 |
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
|
| 181 |
```
|
| 182 |
|
| 183 |
-
*Returns:* `do_put(s, intl, f,
|
| 184 |
|
| 185 |
-
##### Virtual functions <a id="locale.money.put.virtuals">[[locale.money.put.virtuals]]</a>
|
| 186 |
|
| 187 |
``` cpp
|
| 188 |
iter_type do_put(iter_type s, bool intl, ios_base& str,
|
| 189 |
char_type fill, long double units) const;
|
| 190 |
iter_type do_put(iter_type s, bool intl, ios_base& str,
|
|
@@ -229,13 +233,13 @@ before the other characters.
|
|
| 229 |
|
| 230 |
[*Note 1*: It is possible, with some combinations of format patterns
|
| 231 |
and flag values, to produce output that cannot be parsed using
|
| 232 |
`num_get<>::get`. — *end note*]
|
| 233 |
|
| 234 |
-
#### Class template `moneypunct` <a id="locale.moneypunct">[[locale.moneypunct]]</a>
|
| 235 |
|
| 236 |
-
##### General <a id="locale.moneypunct.general">[[locale.moneypunct.general]]</a>
|
| 237 |
|
| 238 |
``` cpp
|
| 239 |
namespace std {
|
| 240 |
class money_base {
|
| 241 |
public:
|
|
@@ -281,11 +285,11 @@ namespace std {
|
|
| 281 |
|
| 282 |
The `moneypunct<>` facet defines monetary formatting parameters used by
|
| 283 |
`money_get<>` and `money_put<>`. A monetary format is a sequence of four
|
| 284 |
components, specified by a `pattern` value `p`, such that the `part`
|
| 285 |
value `static_cast<part>(p.field[i])` determines the `i`ᵗʰ component of
|
| 286 |
-
the format[^
|
| 287 |
|
| 288 |
In the `field` member of a `pattern` object, each value `symbol`,
|
| 289 |
`sign`, `value`, and either `space` or `none` appears exactly once. The
|
| 290 |
value `none`, if present, is not first; the value `space`, if present,
|
| 291 |
is neither first nor last.
|
|
@@ -348,11 +352,11 @@ by `frac_digits()`.
|
|
| 348 |
|
| 349 |
The placement of thousands-separator characters (if any) is determined
|
| 350 |
by the value returned by `grouping()`, defined identically as the member
|
| 351 |
`numpunct<>::do_grouping()`.
|
| 352 |
|
| 353 |
-
##### Members <a id="locale.moneypunct.members">[[locale.moneypunct.members]]</a>
|
| 354 |
|
| 355 |
``` cpp
|
| 356 |
charT decimal_point() const;
|
| 357 |
charT thousands_sep() const;
|
| 358 |
string grouping() const;
|
|
@@ -365,60 +369,60 @@ pattern neg_format() const;
|
|
| 365 |
```
|
| 366 |
|
| 367 |
Each of these functions `F` returns the result of calling the
|
| 368 |
corresponding virtual member function `do_F()`.
|
| 369 |
|
| 370 |
-
##### Virtual functions <a id="locale.moneypunct.virtuals">[[locale.moneypunct.virtuals]]</a>
|
| 371 |
|
| 372 |
``` cpp
|
| 373 |
charT do_decimal_point() const;
|
| 374 |
```
|
| 375 |
|
| 376 |
*Returns:* The radix separator to use in case `do_frac_digits()` is
|
| 377 |
-
greater than zero.[^
|
| 378 |
|
| 379 |
``` cpp
|
| 380 |
charT do_thousands_sep() const;
|
| 381 |
```
|
| 382 |
|
| 383 |
*Returns:* The digit group separator to use in case `do_grouping()`
|
| 384 |
-
specifies a digit grouping pattern.[^
|
| 385 |
|
| 386 |
``` cpp
|
| 387 |
string do_grouping() const;
|
| 388 |
```
|
| 389 |
|
| 390 |
*Returns:* A pattern defined identically as, but not necessarily equal
|
| 391 |
-
to, the result of `numpunct<charT>::do_grouping()`.[^
|
| 392 |
|
| 393 |
``` cpp
|
| 394 |
string_type do_curr_symbol() const;
|
| 395 |
```
|
| 396 |
|
| 397 |
*Returns:* A string to use as the currency identifier symbol.
|
| 398 |
|
| 399 |
-
[*Note
|
| 400 |
`true`, this is typically four characters long: a three-letter code as
|
| 401 |
specified by ISO 4217 followed by a space. — *end note*]
|
| 402 |
|
| 403 |
``` cpp
|
| 404 |
string_type do_positive_sign() const;
|
| 405 |
string_type do_negative_sign() const;
|
| 406 |
```
|
| 407 |
|
| 408 |
*Returns:* `do_positive_sign()` returns the string to use to indicate a
|
| 409 |
-
positive monetary value;[^
|
| 410 |
|
| 411 |
`do_negative_sign()` returns the string to use to indicate a negative
|
| 412 |
value.
|
| 413 |
|
| 414 |
``` cpp
|
| 415 |
int do_frac_digits() const;
|
| 416 |
```
|
| 417 |
|
| 418 |
*Returns:* The number of digits after the decimal radix separator, if
|
| 419 |
-
any.[^
|
| 420 |
|
| 421 |
``` cpp
|
| 422 |
pattern do_pos_format() const;
|
| 423 |
pattern do_neg_format() const;
|
| 424 |
```
|
|
@@ -430,13 +434,13 @@ pattern do_neg_format() const;
|
|
| 430 |
- `moneypunct<wchar_t>`,
|
| 431 |
- `moneypunct<char, true>`, and
|
| 432 |
- `moneypunct<wchar_t, true>`,
|
| 433 |
|
| 434 |
return an object of type `pattern` initialized to
|
| 435 |
-
`{ symbol, sign, none, value }`.[^
|
| 436 |
|
| 437 |
-
#### Class template `moneypunct_byname` <a id="locale.moneypunct.byname">[[locale.moneypunct.byname]]</a>
|
| 438 |
|
| 439 |
``` cpp
|
| 440 |
namespace std {
|
| 441 |
template<class charT, bool Intl = false>
|
| 442 |
class moneypunct_byname : public moneypunct<charT, Intl> {
|
|
|
|
| 1 |
+
#### The monetary category <a id="category.monetary">[[category.monetary]]</a>
|
| 2 |
|
| 3 |
+
##### General <a id="category.monetary.general">[[category.monetary.general]]</a>
|
| 4 |
|
| 5 |
These templates handle monetary formats. A template parameter indicates
|
| 6 |
whether local or international monetary formats are to be used.
|
| 7 |
|
| 8 |
All specifications of member functions for `money_put` and `money_get`
|
|
|
|
| 11 |
[[tab:locale.spec]] [[locale.category]]. Their members use their
|
| 12 |
`ios_base&`, `ios_base::iostate&`, and `fill` arguments as described in
|
| 13 |
[[locale.categories]], and the `moneypunct<>` and `ctype<>` facets, to
|
| 14 |
determine formatting details.
|
| 15 |
|
| 16 |
+
##### Class template `money_get` <a id="locale.money.get">[[locale.money.get]]</a>
|
| 17 |
+
|
| 18 |
+
###### General <a id="locale.money.get.general">[[locale.money.get.general]]</a>
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
namespace std {
|
| 22 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 23 |
class money_get : public locale::facet {
|
|
|
|
| 45 |
ios_base::iostate& err, string_type& digits) const;
|
| 46 |
};
|
| 47 |
}
|
| 48 |
```
|
| 49 |
|
| 50 |
+
###### Members <a id="locale.money.get.members">[[locale.money.get.members]]</a>
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
| 54 |
ios_base::iostate& err, long double& quant) const;
|
| 55 |
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
| 56 |
ios_base::iostate& err, string_type& quant) const;
|
| 57 |
```
|
| 58 |
|
| 59 |
*Returns:* `do_get(s, end, intl, f, err, quant)`.
|
| 60 |
|
| 61 |
+
###### Virtual functions <a id="locale.money.get.virtuals">[[locale.money.get.virtuals]]</a>
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
| 65 |
ios_base::iostate& err, long double& units) const;
|
| 66 |
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
|
|
|
| 70 |
*Effects:* Reads characters from `s` to parse and construct a monetary
|
| 71 |
value according to the format specified by a `moneypunct<charT, Intl>`
|
| 72 |
facet reference `mp` and the character mapping specified by a
|
| 73 |
`ctype<charT>` facet reference `ct` obtained from the locale returned by
|
| 74 |
`str.getloc()`, and `str.flags()`. If a valid sequence is recognized,
|
| 75 |
+
does not change `err`; otherwise, sets `err` to `(err | str.failbit)`,
|
| 76 |
+
or `(err | str.failbit | str.eofbit)` if no more characters are
|
| 77 |
+
available, and does not change `units` or `digits`. Uses the pattern
|
| 78 |
+
returned by `mp.neg_format()` to parse all values. The result is
|
| 79 |
+
returned as an integral value stored in `units` or as a sequence of
|
| 80 |
+
digits possibly preceded by a minus sign (as produced by `ct.widen(c)`
|
| 81 |
+
where `c` is `’-’` or in the range from `’0’` through `’9’` (inclusive))
|
| 82 |
+
stored in `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 |
|
|
|
|
| 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[^17]
|
| 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;
|
|
|
|
| 143 |
```
|
| 144 |
|
| 145 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 146 |
recognized as part of a valid monetary quantity.
|
| 147 |
|
| 148 |
+
##### Class template `money_put` <a id="locale.money.put">[[locale.money.put]]</a>
|
| 149 |
+
|
| 150 |
+
###### General <a id="locale.money.put.general">[[locale.money.put.general]]</a>
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
namespace std {
|
| 154 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 155 |
class money_put : public locale::facet {
|
|
|
|
| 175 |
const string_type& digits) const;
|
| 176 |
};
|
| 177 |
}
|
| 178 |
```
|
| 179 |
|
| 180 |
+
###### Members <a id="locale.money.put.members">[[locale.money.put.members]]</a>
|
| 181 |
|
| 182 |
``` cpp
|
| 183 |
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
|
| 184 |
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
|
| 185 |
```
|
| 186 |
|
| 187 |
+
*Returns:* `do_put(s, intl, f, fill, quant)`.
|
| 188 |
|
| 189 |
+
###### 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,
|
| 193 |
char_type fill, long double units) const;
|
| 194 |
iter_type do_put(iter_type s, bool intl, ios_base& str,
|
|
|
|
| 233 |
|
| 234 |
[*Note 1*: It is possible, with some combinations of format patterns
|
| 235 |
and flag values, to produce output that cannot be parsed using
|
| 236 |
`num_get<>::get`. — *end note*]
|
| 237 |
|
| 238 |
+
##### Class template `moneypunct` <a id="locale.moneypunct">[[locale.moneypunct]]</a>
|
| 239 |
|
| 240 |
+
###### General <a id="locale.moneypunct.general">[[locale.moneypunct.general]]</a>
|
| 241 |
|
| 242 |
``` cpp
|
| 243 |
namespace std {
|
| 244 |
class money_base {
|
| 245 |
public:
|
|
|
|
| 285 |
|
| 286 |
The `moneypunct<>` facet defines monetary formatting parameters used by
|
| 287 |
`money_get<>` and `money_put<>`. A monetary format is a sequence of four
|
| 288 |
components, specified by a `pattern` value `p`, such that the `part`
|
| 289 |
value `static_cast<part>(p.field[i])` determines the `i`ᵗʰ component of
|
| 290 |
+
the format.[^18]
|
| 291 |
|
| 292 |
In the `field` member of a `pattern` object, each value `symbol`,
|
| 293 |
`sign`, `value`, and either `space` or `none` appears exactly once. The
|
| 294 |
value `none`, if present, is not first; the value `space`, if present,
|
| 295 |
is neither first nor last.
|
|
|
|
| 352 |
|
| 353 |
The placement of thousands-separator characters (if any) is determined
|
| 354 |
by the value returned by `grouping()`, defined identically as the member
|
| 355 |
`numpunct<>::do_grouping()`.
|
| 356 |
|
| 357 |
+
###### Members <a id="locale.moneypunct.members">[[locale.moneypunct.members]]</a>
|
| 358 |
|
| 359 |
``` cpp
|
| 360 |
charT decimal_point() const;
|
| 361 |
charT thousands_sep() const;
|
| 362 |
string grouping() const;
|
|
|
|
| 369 |
```
|
| 370 |
|
| 371 |
Each of these functions `F` returns the result of calling the
|
| 372 |
corresponding virtual member function `do_F()`.
|
| 373 |
|
| 374 |
+
###### Virtual functions <a id="locale.moneypunct.virtuals">[[locale.moneypunct.virtuals]]</a>
|
| 375 |
|
| 376 |
``` cpp
|
| 377 |
charT do_decimal_point() const;
|
| 378 |
```
|
| 379 |
|
| 380 |
*Returns:* The radix separator to use in case `do_frac_digits()` is
|
| 381 |
+
greater than zero.[^19]
|
| 382 |
|
| 383 |
``` cpp
|
| 384 |
charT do_thousands_sep() const;
|
| 385 |
```
|
| 386 |
|
| 387 |
*Returns:* The digit group separator to use in case `do_grouping()`
|
| 388 |
+
specifies a digit grouping pattern.[^20]
|
| 389 |
|
| 390 |
``` cpp
|
| 391 |
string do_grouping() const;
|
| 392 |
```
|
| 393 |
|
| 394 |
*Returns:* A pattern defined identically as, but not necessarily equal
|
| 395 |
+
to, the result of `numpunct<charT>::do_grouping()`.[^21]
|
| 396 |
|
| 397 |
``` cpp
|
| 398 |
string_type do_curr_symbol() const;
|
| 399 |
```
|
| 400 |
|
| 401 |
*Returns:* A string to use as the currency identifier symbol.
|
| 402 |
|
| 403 |
+
[*Note 2*: For specializations where the second template parameter is
|
| 404 |
`true`, this is typically four characters long: a three-letter code as
|
| 405 |
specified by ISO 4217 followed by a space. — *end note*]
|
| 406 |
|
| 407 |
``` cpp
|
| 408 |
string_type do_positive_sign() const;
|
| 409 |
string_type do_negative_sign() const;
|
| 410 |
```
|
| 411 |
|
| 412 |
*Returns:* `do_positive_sign()` returns the string to use to indicate a
|
| 413 |
+
positive monetary value;[^22]
|
| 414 |
|
| 415 |
`do_negative_sign()` returns the string to use to indicate a negative
|
| 416 |
value.
|
| 417 |
|
| 418 |
``` cpp
|
| 419 |
int do_frac_digits() const;
|
| 420 |
```
|
| 421 |
|
| 422 |
*Returns:* The number of digits after the decimal radix separator, if
|
| 423 |
+
any.[^23]
|
| 424 |
|
| 425 |
``` cpp
|
| 426 |
pattern do_pos_format() const;
|
| 427 |
pattern do_neg_format() const;
|
| 428 |
```
|
|
|
|
| 434 |
- `moneypunct<wchar_t>`,
|
| 435 |
- `moneypunct<char, true>`, and
|
| 436 |
- `moneypunct<wchar_t, true>`,
|
| 437 |
|
| 438 |
return an object of type `pattern` initialized to
|
| 439 |
+
`{ symbol, sign, none, value }`.[^24]
|
| 440 |
|
| 441 |
+
##### Class template `moneypunct_byname` <a id="locale.moneypunct.byname">[[locale.moneypunct.byname]]</a>
|
| 442 |
|
| 443 |
``` cpp
|
| 444 |
namespace std {
|
| 445 |
template<class charT, bool Intl = false>
|
| 446 |
class moneypunct_byname : public moneypunct<charT, Intl> {
|