tmp/tmpwyip4g8s/{from.md → to.md}
RENAMED
|
@@ -1,25 +1,29 @@
|
|
| 1 |
### Quoted manipulators <a id="quoted.manip">[[quoted.manip]]</a>
|
| 2 |
|
| 3 |
-
Quoted manipulators provide string insertion and extraction
|
| 4 |
-
strings (for example, XML and CSV formats). Quoted
|
| 5 |
-
useful in ensuring that the content of a string with
|
| 6 |
-
remains unchanged if inserted and then extracted via
|
|
|
|
| 7 |
|
| 8 |
``` cpp
|
| 9 |
template <class charT>
|
| 10 |
unspecified quoted(const charT* s, charT delim = charT('"'), charT escape = charT('\\'));
|
| 11 |
template <class charT, class traits, class Allocator>
|
| 12 |
unspecified quoted(const basic_string<charT, traits, Allocator>& s,
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
```
|
| 15 |
|
| 16 |
*Returns:* An object of unspecified type such that if `out` is an
|
| 17 |
instance of `basic_ostream` with member type `char_type` the same as
|
| 18 |
-
`charT` and with member type `traits_type`, which in the second
|
| 19 |
-
the same as `traits`, then the expression
|
| 20 |
-
`out <<
|
| 21 |
function ([[ostream.formatted.reqmts]]) of `out`. This forms a
|
| 22 |
character sequence `seq`, initially consisting of the following
|
| 23 |
elements:
|
| 24 |
|
| 25 |
- `delim`.
|
|
@@ -30,45 +34,45 @@ elements:
|
|
| 30 |
|
| 31 |
Let `x` be the number of elements initially in `seq`. Then padding is
|
| 32 |
determined for `seq` as described in [[ostream.formatted.reqmts]],
|
| 33 |
`seq` is inserted as if by calling `out.rdbuf()->sputn(seq, n)`, where
|
| 34 |
`n` is the larger of `out.width()` and `x`, and `out.width(0)` is
|
| 35 |
-
called. The expression `out <<
|
| 36 |
`basic_ostream<charT, traits>&` and value `out`.
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
template <class charT, class traits, class Allocator>
|
| 40 |
unspecified quoted(basic_string<charT, traits, Allocator>& s,
|
| 41 |
-
|
| 42 |
```
|
| 43 |
|
| 44 |
*Returns:* An object of unspecified type such that:
|
| 45 |
|
| 46 |
- If `in` is an instance of `basic_istream` with member types
|
| 47 |
`char_type` and `traits_type` the same as `charT` and `traits`,
|
| 48 |
-
respectively, then the expression `in >>
|
| 49 |
behaves as if it extracts the following characters from `in` using
|
| 50 |
-
`
|
| 51 |
-
`ios_base::failure` ([[ios::failure]]):
|
| 52 |
- If the first character extracted is equal to `delim`, as determined
|
| 53 |
by `traits_type::eq`, then:
|
| 54 |
- Turn off the `skipws` flag.
|
| 55 |
- `s.clear()`
|
| 56 |
- Until an unescaped `delim` character is reached or `!in`, extract
|
| 57 |
characters from `in` and append them to `s`, except that if an
|
| 58 |
`escape` is reached, ignore it and append the next character to
|
| 59 |
`s`.
|
| 60 |
- Discard the final `delim` character.
|
| 61 |
- Restore the `skipws` flag to its original value.
|
| 62 |
-
- Otherwise, `in >>
|
| 63 |
- If `out` is an instance of `basic_ostream` with member types
|
| 64 |
`char_type` and `traits_type` the same as `charT` and `traits`,
|
| 65 |
-
respectively, then the expression `out <<
|
| 66 |
behaves as specified for the
|
| 67 |
`const basic_string<charT, traits, Allocator>&` overload of the
|
| 68 |
`quoted` function.
|
| 69 |
|
| 70 |
-
The expression `in >>
|
| 71 |
`basic_istream<charT, traits>&` and value `in`. The expression
|
| 72 |
-
`out <<
|
| 73 |
`basic_ostream<charT, traits>&` and value `out`.
|
| 74 |
|
|
|
|
| 1 |
### Quoted manipulators <a id="quoted.manip">[[quoted.manip]]</a>
|
| 2 |
|
| 3 |
+
[*Note 1*: Quoted manipulators provide string insertion and extraction
|
| 4 |
+
of quoted strings (for example, XML and CSV formats). Quoted
|
| 5 |
+
manipulators are useful in ensuring that the content of a string with
|
| 6 |
+
embedded spaces remains unchanged if inserted and then extracted via
|
| 7 |
+
stream I/O. — *end note*]
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
template <class charT>
|
| 11 |
unspecified quoted(const charT* s, charT delim = charT('"'), charT escape = charT('\\'));
|
| 12 |
template <class charT, class traits, class Allocator>
|
| 13 |
unspecified quoted(const basic_string<charT, traits, Allocator>& s,
|
| 14 |
+
\itcorr charT delim = charT('"'), charT escape = charT('\\'));
|
| 15 |
+
template <class charT, class traits>
|
| 16 |
+
unspecified quoted(basic_string_view<charT, traits> s,
|
| 17 |
+
\itcorr charT delim = charT('"'), charT escape = charT('\\'));
|
| 18 |
```
|
| 19 |
|
| 20 |
*Returns:* An object of unspecified type such that if `out` is an
|
| 21 |
instance of `basic_ostream` with member type `char_type` the same as
|
| 22 |
+
`charT` and with member type `traits_type`, which in the second and
|
| 23 |
+
third forms is the same as `traits`, then the expression
|
| 24 |
+
`out << quoted(s, delim, escape)` behaves as a formatted output
|
| 25 |
function ([[ostream.formatted.reqmts]]) of `out`. This forms a
|
| 26 |
character sequence `seq`, initially consisting of the following
|
| 27 |
elements:
|
| 28 |
|
| 29 |
- `delim`.
|
|
|
|
| 34 |
|
| 35 |
Let `x` be the number of elements initially in `seq`. Then padding is
|
| 36 |
determined for `seq` as described in [[ostream.formatted.reqmts]],
|
| 37 |
`seq` is inserted as if by calling `out.rdbuf()->sputn(seq, n)`, where
|
| 38 |
`n` is the larger of `out.width()` and `x`, and `out.width(0)` is
|
| 39 |
+
called. The expression `out << quoted(s, delim, escape)` shall have type
|
| 40 |
`basic_ostream<charT, traits>&` and value `out`.
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
template <class charT, class traits, class Allocator>
|
| 44 |
unspecified quoted(basic_string<charT, traits, Allocator>& s,
|
| 45 |
+
\itcorr charT delim = charT('"'), charT escape = charT('\\'));
|
| 46 |
```
|
| 47 |
|
| 48 |
*Returns:* An object of unspecified type such that:
|
| 49 |
|
| 50 |
- If `in` is an instance of `basic_istream` with member types
|
| 51 |
`char_type` and `traits_type` the same as `charT` and `traits`,
|
| 52 |
+
respectively, then the expression `in >> quoted(s, delim, escape)`
|
| 53 |
behaves as if it extracts the following characters from `in` using
|
| 54 |
+
`operator>>(basic_istream<charT, traits>&, charT&)` ([[istream.extractors]])
|
| 55 |
+
which may throw `ios_base::failure` ([[ios::failure]]):
|
| 56 |
- If the first character extracted is equal to `delim`, as determined
|
| 57 |
by `traits_type::eq`, then:
|
| 58 |
- Turn off the `skipws` flag.
|
| 59 |
- `s.clear()`
|
| 60 |
- Until an unescaped `delim` character is reached or `!in`, extract
|
| 61 |
characters from `in` and append them to `s`, except that if an
|
| 62 |
`escape` is reached, ignore it and append the next character to
|
| 63 |
`s`.
|
| 64 |
- Discard the final `delim` character.
|
| 65 |
- Restore the `skipws` flag to its original value.
|
| 66 |
+
- Otherwise, `in >> s`.
|
| 67 |
- If `out` is an instance of `basic_ostream` with member types
|
| 68 |
`char_type` and `traits_type` the same as `charT` and `traits`,
|
| 69 |
+
respectively, then the expression `out << quoted(s, delim, escape)`
|
| 70 |
behaves as specified for the
|
| 71 |
`const basic_string<charT, traits, Allocator>&` overload of the
|
| 72 |
`quoted` function.
|
| 73 |
|
| 74 |
+
The expression `in >> quoted(s, delim, escape)` shall have type
|
| 75 |
`basic_istream<charT, traits>&` and value `in`. The expression
|
| 76 |
+
`out << quoted(s, delim, escape)` shall have type
|
| 77 |
`basic_ostream<charT, traits>&` and value `out`.
|
| 78 |
|