tmp/tmptxcyphy6/{from.md → to.md}
RENAMED
|
@@ -3,110 +3,83 @@
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template <class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 6 |
class num_put : public locale::facet {
|
| 7 |
public:
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
explicit num_put(size_t refs = 0);
|
| 12 |
|
| 13 |
iter_type put(iter_type s, ios_base& f, char_type fill, bool v) const;
|
| 14 |
iter_type put(iter_type s, ios_base& f, char_type fill, long v) const;
|
| 15 |
iter_type put(iter_type s, ios_base& f, char_type fill, long long v) const;
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
double v) const;
|
| 22 |
-
iter_type put(iter_type s, ios_base& f, char_type fill,
|
| 23 |
-
long double v) const;
|
| 24 |
-
iter_type put(iter_type s, ios_base& f, char_type fill,
|
| 25 |
-
const void* v) const;
|
| 26 |
|
| 27 |
static locale::id id;
|
| 28 |
|
| 29 |
protected:
|
| 30 |
~num_put();
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
virtual iter_type do_put(iter_type, ios_base&, char_type fill,
|
| 40 |
-
unsigned long long) const;
|
| 41 |
-
virtual iter_type do_put(iter_type, ios_base&, char_type fill,
|
| 42 |
-
double v) const;
|
| 43 |
-
virtual iter_type do_put(iter_type, ios_base&, char_type fill,
|
| 44 |
-
long double v) const;
|
| 45 |
-
virtual iter_type do_put(iter_type, ios_base&, char_type fill,
|
| 46 |
-
const void* v) const;
|
| 47 |
};
|
| 48 |
}
|
| 49 |
```
|
| 50 |
|
| 51 |
The facet `num_put` is used to format numeric values to a character
|
| 52 |
sequence such as an ostream.
|
| 53 |
|
| 54 |
##### `num_put` members <a id="facet.num.put.members">[[facet.num.put.members]]</a>
|
| 55 |
|
| 56 |
``` cpp
|
| 57 |
-
iter_type put(iter_type out, ios_base& str, char_type fill,
|
| 58 |
-
|
| 59 |
-
iter_type put(iter_type out, ios_base& str, char_type fill,
|
| 60 |
-
|
| 61 |
-
iter_type put(iter_type out, ios_base& str, char_type fill,
|
| 62 |
-
|
| 63 |
-
iter_type put(iter_type out, ios_base& str, char_type fill,
|
| 64 |
-
|
| 65 |
-
iter_type put(iter_type out, ios_base& str, char_type fill,
|
| 66 |
-
unsigned long long val) const;
|
| 67 |
-
iter_type put(iter_type out, ios_base& str, char_type fill,
|
| 68 |
-
double val) const;
|
| 69 |
-
iter_type put(iter_type out, ios_base& str, char_type fill,
|
| 70 |
-
long double val) const;
|
| 71 |
-
iter_type put(iter_type out, ios_base& str, char_type fill,
|
| 72 |
-
const void* val) const;
|
| 73 |
```
|
| 74 |
|
| 75 |
*Returns:* `do_put(out, str, fill, val)`.
|
| 76 |
|
| 77 |
##### `num_put` virtual functions <a id="facet.num.put.virtuals">[[facet.num.put.virtuals]]</a>
|
| 78 |
|
| 79 |
``` cpp
|
| 80 |
-
iter_type do_put(iter_type out, ios_base& str, char_type fill,
|
| 81 |
-
|
| 82 |
-
iter_type do_put(iter_type out, ios_base& str, char_type fill,
|
| 83 |
-
|
| 84 |
-
iter_type do_put(iter_type out, ios_base& str, char_type fill,
|
| 85 |
-
|
| 86 |
-
iter_type do_put(iter_type out, ios_base& str, char_type fill,
|
| 87 |
-
unsigned long long val) const;
|
| 88 |
-
iter_type do_put(iter_type out, ios_base& str, char_type fill,
|
| 89 |
-
double val) const;
|
| 90 |
-
iter_type do_put(iter_type out, ios_base& str, char_type fill,
|
| 91 |
-
long double val) const;
|
| 92 |
-
iter_type do_put(iter_type out, ios_base& str, char_type fill,
|
| 93 |
-
const void* val) const;
|
| 94 |
```
|
| 95 |
|
| 96 |
*Effects:* Writes characters to the sequence `out`, formatting `val` as
|
| 97 |
-
desired. In the following description, a local variable initialized
|
|
|
|
| 98 |
|
| 99 |
``` cpp
|
| 100 |
locale loc = str.getloc();
|
| 101 |
```
|
| 102 |
|
| 103 |
The details of this operation occur in several stages:
|
| 104 |
|
| 105 |
-
- Stage 1: Determine a printf conversion specifier `spec` and
|
| 106 |
-
|
| 107 |
-
|
| 108 |
``` cpp
|
| 109 |
printf(spec, val)
|
| 110 |
```
|
| 111 |
|
| 112 |
assuming that the current locale is the `"C"` locale.
|
|
@@ -131,10 +104,11 @@ fmtflags flags = str.flags() ;
|
|
| 131 |
fmtflags basefield = (flags & (ios_base::basefield));
|
| 132 |
fmtflags uppercase = (flags & (ios_base::uppercase));
|
| 133 |
fmtflags floatfield = (flags & (ios_base::floatfield));
|
| 134 |
fmtflags showpos = (flags & (ios_base::showpos));
|
| 135 |
fmtflags showbase = (flags & (ios_base::showbase));
|
|
|
|
| 136 |
```
|
| 137 |
|
| 138 |
All tables used in describing stage 1 are ordered. That is, the first
|
| 139 |
line whose condition is true applies. A line without a condition is the
|
| 140 |
default behavior when none of the earlier lines apply.
|
|
@@ -192,15 +166,15 @@ qualifiers prepended as indicated in
|
|
| 192 |
Table [[tab:localization.numeric.conversions]].
|
| 193 |
|
| 194 |
**Table: Numeric conversions** <a id="tab:localization.numeric.conversions">[tab:localization.numeric.conversions]</a>
|
| 195 |
|
| 196 |
| Type(s) | State | `stdio` equivalent |
|
| 197 |
-
| --------------------- | -----------
|
| 198 |
-
| an integral type | `
|
| 199 |
-
| | `
|
| 200 |
-
| a floating-point type | `
|
| 201 |
-
| | `
|
| 202 |
|
| 203 |
|
| 204 |
For conversion from a floating-point type, if
|
| 205 |
`floatfield != (ios_base::fixed | ios_base::scientific)`,
|
| 206 |
`str.precision()` is specified as precision in the conversion
|
|
@@ -236,11 +210,11 @@ A local variable is initialized as
|
|
| 236 |
|
| 237 |
``` cpp
|
| 238 |
fmtflags adjustfield = (flags & (ios_base::adjustfield));
|
| 239 |
```
|
| 240 |
|
| 241 |
-
The location of any padding[^
|
| 242 |
Table [[tab:localization.fill.padding]].
|
| 243 |
|
| 244 |
**Table: Fill padding** <a id="tab:localization.fill.padding">[tab:localization.fill.padding]</a>
|
| 245 |
|
| 246 |
| State | Location |
|
|
@@ -266,12 +240,11 @@ The sequence of `charT`’s at the end of stage 3 are output via
|
|
| 266 |
``` cpp
|
| 267 |
*out++ = c
|
| 268 |
```
|
| 269 |
|
| 270 |
``` cpp
|
| 271 |
-
iter_type do_put(iter_type out, ios_base& str, char_type fill,
|
| 272 |
-
bool val) const;
|
| 273 |
```
|
| 274 |
|
| 275 |
*Returns:* If `(str.flags() & ios_base::boolalpha) == 0` returns
|
| 276 |
`do_put(out, str, fill,`
|
| 277 |
`(int)val)`, otherwise obtains a string `s` as if by
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template <class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 6 |
class num_put : public locale::facet {
|
| 7 |
public:
|
| 8 |
+
using char_type = charT;
|
| 9 |
+
using iter_type = OutputIterator;
|
| 10 |
|
| 11 |
explicit num_put(size_t refs = 0);
|
| 12 |
|
| 13 |
iter_type put(iter_type s, ios_base& f, char_type fill, bool v) const;
|
| 14 |
iter_type put(iter_type s, ios_base& f, char_type fill, long v) const;
|
| 15 |
iter_type put(iter_type s, ios_base& f, char_type fill, long long v) const;
|
| 16 |
+
iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long v) const;
|
| 17 |
+
iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long long v) const;
|
| 18 |
+
iter_type put(iter_type s, ios_base& f, char_type fill, double v) const;
|
| 19 |
+
iter_type put(iter_type s, ios_base& f, char_type fill, long double v) const;
|
| 20 |
+
iter_type put(iter_type s, ios_base& f, char_type fill, const void* v) const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
static locale::id id;
|
| 23 |
|
| 24 |
protected:
|
| 25 |
~num_put();
|
| 26 |
+
virtual iter_type do_put(iter_type, ios_base&, char_type fill, bool v) const;
|
| 27 |
+
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long v) const;
|
| 28 |
+
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long long v) const;
|
| 29 |
+
virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long) const;
|
| 30 |
+
virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long long) const;
|
| 31 |
+
virtual iter_type do_put(iter_type, ios_base&, char_type fill, double v) const;
|
| 32 |
+
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long double v) const;
|
| 33 |
+
virtual iter_type do_put(iter_type, ios_base&, char_type fill, const void* v) const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
};
|
| 35 |
}
|
| 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;
|
| 47 |
+
iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
|
| 48 |
+
iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
|
| 49 |
+
iter_type put(iter_type out, ios_base& str, char_type fill, double val) const;
|
| 50 |
+
iter_type put(iter_type out, ios_base& str, char_type fill, long double 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 |
##### `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;
|
| 62 |
+
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
|
| 63 |
+
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.
|
|
|
|
| 104 |
fmtflags basefield = (flags & (ios_base::basefield));
|
| 105 |
fmtflags uppercase = (flags & (ios_base::uppercase));
|
| 106 |
fmtflags floatfield = (flags & (ios_base::floatfield));
|
| 107 |
fmtflags showpos = (flags & (ios_base::showpos));
|
| 108 |
fmtflags showbase = (flags & (ios_base::showbase));
|
| 109 |
+
fmtflags showpoint = (flags & (ios_base::showpoint));
|
| 110 |
```
|
| 111 |
|
| 112 |
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.
|
|
|
|
| 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` | `#` |
|
| 174 |
+
| a floating-point type | `showpos` | `+` |
|
| 175 |
+
| | `showpoint` | `#` |
|
| 176 |
|
| 177 |
|
| 178 |
For conversion from a floating-point type, if
|
| 179 |
`floatfield != (ios_base::fixed | ios_base::scientific)`,
|
| 180 |
`str.precision()` is specified as precision in the conversion
|
|
|
|
| 210 |
|
| 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 |
|
|
|
|
| 240 |
``` cpp
|
| 241 |
*out++ = c
|
| 242 |
```
|
| 243 |
|
| 244 |
``` cpp
|
| 245 |
+
iter_type do_put(iter_type out, ios_base& str, char_type fill, bool val) const;
|
|
|
|
| 246 |
```
|
| 247 |
|
| 248 |
*Returns:* If `(str.flags() & ios_base::boolalpha) == 0` returns
|
| 249 |
`do_put(out, str, fill,`
|
| 250 |
`(int)val)`, otherwise obtains a string `s` as if by
|