30 #ifndef _GLIBCXX_QUOTED_STRING_H
31 #define _GLIBCXX_QUOTED_STRING_H 1
33 #pragma GCC system_header
35 #if __cplusplus < 201103L
40 namespace std _GLIBCXX_VISIBILITY(default)
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48 template<
typename _String,
typename _CharT>
53 "String type must be pointer or reference");
56 : _M_string(__str), _M_delim{__del}, _M_escape{__esc}
67 #if __cplusplus >= 201703L
68 template<
typename _CharT,
typename _Traits>
72 _CharT __del, _CharT __esc)
73 : _M_string(__str), _M_delim{__del}, _M_escape{__esc}
77 operator=(_Quoted_string&) =
delete;
91 template<
typename _CharT,
typename _Traits>
94 const _Quoted_string<const _CharT*, _CharT>& __str)
97 __ostr << __str._M_delim;
98 for (
const _CharT* __c = __str._M_string; *__c; ++__c)
100 if (*__c == __str._M_delim || *__c == __str._M_escape)
101 __ostr << __str._M_escape;
104 __ostr << __str._M_delim;
106 return __os << __ostr.
str();
115 template<
typename _CharT,
typename _Traits,
typename _String>
118 const _Quoted_string<_String, _CharT>& __str)
121 __ostr << __str._M_delim;
122 for (
auto __c : __str._M_string)
124 if (__c == __str._M_delim || __c == __str._M_escape)
125 __ostr << __str._M_escape;
128 __ostr << __str._M_delim;
130 return __os << __ostr.
str();
137 template<
typename _CharT,
typename _Traits,
typename _Alloc>
147 if (__c != __str._M_delim)
150 __is >> __str._M_string;
153 __str._M_string.
clear();
154 std::ios_base::fmtflags __flags
161 if (__c == __str._M_escape)
167 else if (__c == __str._M_delim)
169 __str._M_string += __c;
178 _GLIBCXX_END_NAMESPACE_VERSION
ISO C++ entities toplevel namespace is std.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const _Quoted_string< const _CharT *, _CharT > &__str)
Inserter for quoted strings.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, const _Quoted_string< basic_string< _CharT, _Traits, _Alloc > &, _CharT > &__str)
Extractor for delimited strings. The left and right delimiters can be different.
void clear(iostate __state=goodbit)
[Re]sets the error state.
bool good() const
Fast error checking.
Template class basic_istream.
__istream_type & unget()
Unextracting the previous character.
Template class basic_ostream.
Controlling output for std::string.
__string_type str() const
Copying out the string buffer.
A non-owning reference to a string.
Managing sequences of characters and character-like objects.
fmtflags setf(fmtflags __fmtfl)
Setting new format flags.
static const fmtflags skipws
Skips leading white space before certain input operations.
fmtflags flags() const
Access to format flags.
Struct for delimited strings.