30#ifndef _GLIBCXX_QUOTED_STRING_H
31#define _GLIBCXX_QUOTED_STRING_H 1
34#pragma GCC system_header
37#if __cplusplus < 201103L
42namespace std _GLIBCXX_VISIBILITY(default)
44_GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
typename _String,
typename _CharT>
55 "String type must be pointer or reference");
57 _Quoted_string(_String __str, _CharT __del, _CharT __esc)
58 : _M_string(__str), _M_delim{__del}, _M_escape{__esc}
62 operator=(_Quoted_string&) =
delete;
69#if __cplusplus >= 201703L
70 template<
typename _CharT,
typename _Traits>
74 _CharT __del, _CharT __esc)
75 : _M_string(__str), _M_delim{__del}, _M_escape{__esc}
79 operator=(_Quoted_string&) =
delete;
92 template<
typename _CharT,
typename _Traits>
95 const _Quoted_string<const _CharT*, _CharT>& __str)
100 __ostr << __str._M_delim;
101 for (
const _CharT* __c = __str._M_string; *__c; ++__c)
103 if (*__c == __str._M_delim || *__c == __str._M_escape)
104 __ostr << __str._M_escape;
107 __ostr << __str._M_delim;
109 return __os << __ostr.
str();
117 template<
typename _CharT,
typename _Traits,
typename _String>
118 std::basic_ostream<_CharT, _Traits>&
119 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
124 std::basic_ostringstream<_CharT, _Traits> __ostr;
125 __ostr << __str._M_delim;
126 for (
auto __c : __str._M_string)
128 if (__c == __str._M_delim || __c == __str._M_escape)
129 __ostr << __str._M_escape;
132 __ostr << __str._M_delim;
134 return __os << __ostr.
str();
143 template<
typename _CharT,
typename _Traits,
typename _Alloc>
144 std::basic_istream<_CharT, _Traits>&
153 if (__c != __str._M_delim)
156 __is >> __str._M_string;
159 __str._M_string.
clear();
167 if (__c == __str._M_escape)
173 else if (__c == __str._M_delim)
175 __str._M_string += __c;
184_GLIBCXX_END_NAMESPACE_VERSION
class __attribute((__abi_tag__("cxx11"))) failure typedef _Ios_Fmtflags fmtflags
These are thrown to indicate problems with io.
ISO C++ entities toplevel namespace is std.
Implementation details not part of the namespace std interface.
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.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const _Quoted_string< const _CharT *, _CharT > &__str)
Inserter for quoted strings.
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.