From Jason Turner

[locale.moneypunct.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmplbdltlh4/{from.md → to.md} +117 -0
tmp/tmplbdltlh4/{from.md → to.md} RENAMED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### General <a id="locale.moneypunct.general">[[locale.moneypunct.general]]</a>
2
+
3
+ ``` cpp
4
+ namespace std {
5
+ class money_base {
6
+ public:
7
+ enum part { none, space, symbol, sign, value };
8
+ struct pattern { char field[4]; };
9
+ };
10
+
11
+ template<class charT, bool International = false>
12
+ class moneypunct : public locale::facet, public money_base {
13
+ public:
14
+ using char_type = charT;
15
+ using string_type = basic_string<charT>;
16
+
17
+ explicit moneypunct(size_t refs = 0);
18
+
19
+ charT decimal_point() const;
20
+ charT thousands_sep() const;
21
+ string grouping() const;
22
+ string_type curr_symbol() const;
23
+ string_type positive_sign() const;
24
+ string_type negative_sign() const;
25
+ int frac_digits() const;
26
+ pattern pos_format() const;
27
+ pattern neg_format() const;
28
+
29
+ static locale::id id;
30
+ static const bool intl = International;
31
+
32
+ protected:
33
+ ~moneypunct();
34
+ virtual charT do_decimal_point() const;
35
+ virtual charT do_thousands_sep() const;
36
+ virtual string do_grouping() const;
37
+ virtual string_type do_curr_symbol() const;
38
+ virtual string_type do_positive_sign() const;
39
+ virtual string_type do_negative_sign() const;
40
+ virtual int do_frac_digits() const;
41
+ virtual pattern do_pos_format() const;
42
+ virtual pattern do_neg_format() const;
43
+ };
44
+ }
45
+ ```
46
+
47
+ The `moneypunct<>` facet defines monetary formatting parameters used by
48
+ `money_get<>` and `money_put<>`. A monetary format is a sequence of four
49
+ components, specified by a `pattern` value `p`, such that the `part`
50
+ value `static_cast<part>(p.field[i])` determines the `i`ᵗʰ component of
51
+ the format[^19]
52
+
53
+ In the `field` member of a `pattern` object, each value `symbol`,
54
+ `sign`, `value`, and either `space` or `none` appears exactly once. The
55
+ value `none`, if present, is not first; the value `space`, if present,
56
+ is neither first nor last.
57
+
58
+ Where `none` or `space` appears, whitespace is permitted in the format,
59
+ except where `none` appears at the end, in which case no whitespace is
60
+ permitted. The value `space` indicates that at least one space is
61
+ required at that position. Where `symbol` appears, the sequence of
62
+ characters returned by `curr_symbol()` is permitted, and can be
63
+ required. Where `sign` appears, the first (if any) of the sequence of
64
+ characters returned by `positive_sign()` or `negative_sign()`
65
+ (respectively as the monetary value is non-negative or negative) is
66
+ required. Any remaining characters of the sign sequence are required
67
+ after all other format components. Where `value` appears, the absolute
68
+ numeric monetary value is required.
69
+
70
+ The format of the numeric monetary value is a decimal number:
71
+
72
+ ``` bnf
73
+ value:
74
+ units fractionalₒₚₜ
75
+ decimal-point digits
76
+ ```
77
+
78
+ ``` bnf
79
+ fractional:
80
+ decimal-point digitsₒₚₜ
81
+ ```
82
+
83
+ if `frac_digits()` returns a positive value, or
84
+
85
+ ``` bnf
86
+ value:
87
+ units
88
+ ```
89
+
90
+ otherwise. The symbol indicates the character returned by
91
+ `decimal_point()`. The other symbols are defined as follows:
92
+
93
+ ``` bnf
94
+ units:
95
+ digits
96
+ digits thousands-sep units
97
+ ```
98
+
99
+ ``` bnf
100
+ digits:
101
+ adigit digitsₒₚₜ
102
+ ```
103
+
104
+ In the syntax specification, the symbol is any of the values
105
+ `ct.widen(c)` for `c` in the range `'0'` through `'9'` (inclusive) and
106
+ `ct` is a reference of type `const ctype<charT>&` obtained as described
107
+ in the definitions of `money_get<>` and `money_put<>`. The symbol is the
108
+ character returned by `thousands_sep()`. The space character used is the
109
+ value `ct.widen(' ')`. Whitespace characters are those characters `c`
110
+ for which `ci.is(space, c)` returns `true`. The number of digits
111
+ required after the decimal point (if any) is exactly the value returned
112
+ by `frac_digits()`.
113
+
114
+ The placement of thousands-separator characters (if any) is determined
115
+ by the value returned by `grouping()`, defined identically as the member
116
+ `numpunct<>::do_grouping()`.
117
+