tmp/tmp_58p3a7r/{from.md → to.md}
RENAMED
|
@@ -1,16 +1,15 @@
|
|
| 1 |
#### Class template `money_get` <a id="locale.money.get">[[locale.money.get]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
-
template <class charT,
|
| 6 |
-
class InputIterator = istreambuf_iterator<charT> >
|
| 7 |
class money_get : public locale::facet {
|
| 8 |
public:
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
explicit money_get(size_t refs = 0);
|
| 14 |
|
| 15 |
iter_type get(iter_type s, iter_type end, bool intl,
|
| 16 |
ios_base& f, ios_base::iostate& err,
|
|
@@ -39,11 +38,11 @@ iter_type get(iter_type s, iter_type end, bool intl,
|
|
| 39 |
long double& quant) const;
|
| 40 |
iter_type get(s, iter_type end, bool intl, ios_base&f,
|
| 41 |
ios_base::iostate& err, string_type& quant) const;
|
| 42 |
```
|
| 43 |
|
| 44 |
-
*Returns:* `do_get(s, end, intl, f, err, quant)`
|
| 45 |
|
| 46 |
##### `money_get` virtual functions <a id="locale.money.get.virtuals">[[locale.money.get.virtuals]]</a>
|
| 47 |
|
| 48 |
``` cpp
|
| 49 |
iter_type do_get(iter_type s, iter_type end, bool intl,
|
|
@@ -64,13 +63,17 @@ does not change `err`; otherwise, sets `err` to `(err|str.failbit)`, or
|
|
| 64 |
does not change `units` or `digits`. Uses the pattern returned by
|
| 65 |
`mp.neg_format()` to parse all values. The result is returned as an
|
| 66 |
integral value stored in `units` or as a sequence of digits possibly
|
| 67 |
preceded by a minus sign (as produced by `ct.widen(c)` where `c` is
|
| 68 |
`’-’` or in the range from `’0’` through `’9’`, inclusive) stored in
|
| 69 |
-
`digits`.
|
| 70 |
-
|
| 71 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
any such characters are not read, and parsing is terminated at the point
|
| 73 |
where they first appear. Otherwise, thousands separators are optional;
|
| 74 |
if present, they are checked for correct placement only after all format
|
| 75 |
components have been read.
|
| 76 |
|
|
@@ -86,27 +89,30 @@ format; otherwise, the currency symbol is required.
|
|
| 86 |
|
| 87 |
If the first character (if any) in the string `pos` returned by
|
| 88 |
`mp.positive_sign()` or the string `neg` returned by
|
| 89 |
`mp.negative_sign()` is recognized in the position indicated by `sign`
|
| 90 |
in the format pattern, it is consumed and any remaining characters in
|
| 91 |
-
the string are required after all the other format components.
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
Digits in the numeric monetary component are extracted and placed in
|
| 104 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 105 |
value for `units`, in the order in which they appear, preceded by a
|
| 106 |
minus sign if and only if the result is negative. The value `units` is
|
| 107 |
-
produced as if by[^
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
for (int i = 0; i < n; ++i)
|
| 111 |
buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
|
| 112 |
buf2[n] = 0;
|
|
|
|
| 1 |
#### Class template `money_get` <a id="locale.money.get">[[locale.money.get]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
+
template <class charT, class InputIterator = istreambuf_iterator<charT>>
|
|
|
|
| 6 |
class money_get : public locale::facet {
|
| 7 |
public:
|
| 8 |
+
using char_type = charT;
|
| 9 |
+
using iter_type = InputIterator;
|
| 10 |
+
using string_type = basic_string<charT>;
|
| 11 |
|
| 12 |
explicit money_get(size_t refs = 0);
|
| 13 |
|
| 14 |
iter_type get(iter_type s, iter_type end, bool intl,
|
| 15 |
ios_base& f, ios_base::iostate& err,
|
|
|
|
| 38 |
long double& quant) const;
|
| 39 |
iter_type get(s, iter_type end, bool intl, ios_base&f,
|
| 40 |
ios_base::iostate& err, string_type& quant) const;
|
| 41 |
```
|
| 42 |
|
| 43 |
+
*Returns:* `do_get(s, end, intl, f, err, quant)`.
|
| 44 |
|
| 45 |
##### `money_get` virtual functions <a id="locale.money.get.virtuals">[[locale.money.get.virtuals]]</a>
|
| 46 |
|
| 47 |
``` cpp
|
| 48 |
iter_type do_get(iter_type s, iter_type end, bool intl,
|
|
|
|
| 63 |
does not change `units` or `digits`. Uses the pattern returned by
|
| 64 |
`mp.neg_format()` to parse all values. The result is returned as an
|
| 65 |
integral value stored in `units` or as a sequence of digits possibly
|
| 66 |
preceded by a minus sign (as produced by `ct.widen(c)` where `c` is
|
| 67 |
`’-’` or in the range from `’0’` through `’9’`, inclusive) stored in
|
| 68 |
+
`digits`.
|
| 69 |
+
|
| 70 |
+
[*Example 1*: The sequence `$1,056.23` in a common United States locale
|
| 71 |
+
would yield, for `units`, `105623`, or, for `digits`,
|
| 72 |
+
`"105623"`. — *end example*]
|
| 73 |
+
|
| 74 |
+
If `mp.grouping()` indicates that no thousands separators are permitted,
|
| 75 |
any such characters are not read, and parsing is terminated at the point
|
| 76 |
where they first appear. Otherwise, thousands separators are optional;
|
| 77 |
if present, they are checked for correct placement only after all format
|
| 78 |
components have been read.
|
| 79 |
|
|
|
|
| 89 |
|
| 90 |
If the first character (if any) in the string `pos` returned by
|
| 91 |
`mp.positive_sign()` or the string `neg` returned by
|
| 92 |
`mp.negative_sign()` is recognized in the position indicated by `sign`
|
| 93 |
in the format pattern, it is consumed and any remaining characters in
|
| 94 |
+
the string are required after all the other format components.
|
| 95 |
+
|
| 96 |
+
[*Example 2*: If `showbase` is off, then for a `neg` value of `"()"`
|
| 97 |
+
and a currency symbol of `"L"`, in `"(100 L)"` the `"L"` is consumed;
|
| 98 |
+
but if `neg` is `"-"`, the `"L"` in `"-100 L"` is not
|
| 99 |
+
consumed. — *end example*]
|
| 100 |
+
|
| 101 |
+
If `pos` or `neg` is empty, the sign component is optional, and if no
|
| 102 |
+
sign is detected, the result is given the sign that corresponds to the
|
| 103 |
+
source of the empty string. Otherwise, the character in the indicated
|
| 104 |
+
position must match the first character of `pos` or `neg`, and the
|
| 105 |
+
result is given the corresponding sign. If the first character of `pos`
|
| 106 |
+
is equal to the first character of `neg`, or if both strings are empty,
|
| 107 |
+
the result is given a positive sign.
|
| 108 |
|
| 109 |
Digits in the numeric monetary component are extracted and placed in
|
| 110 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 111 |
value for `units`, in the order in which they appear, preceded by a
|
| 112 |
minus sign if and only if the result is negative. The value `units` is
|
| 113 |
+
produced as if by[^20]
|
| 114 |
|
| 115 |
``` cpp
|
| 116 |
for (int i = 0; i < n; ++i)
|
| 117 |
buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
|
| 118 |
buf2[n] = 0;
|