xref: /aosp_15_r20/external/libcxx/include/iomanip (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*-
2*58b9f456SAndroid Build Coastguard Worker//===--------------------------- iomanip ----------------------------------===//
3*58b9f456SAndroid Build Coastguard Worker//
4*58b9f456SAndroid Build Coastguard Worker//                     The LLVM Compiler Infrastructure
5*58b9f456SAndroid Build Coastguard Worker//
6*58b9f456SAndroid Build Coastguard Worker// This file is dual licensed under the MIT and the University of Illinois Open
7*58b9f456SAndroid Build Coastguard Worker// Source Licenses. See LICENSE.TXT for details.
8*58b9f456SAndroid Build Coastguard Worker//
9*58b9f456SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
10*58b9f456SAndroid Build Coastguard Worker
11*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_IOMANIP
12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_IOMANIP
13*58b9f456SAndroid Build Coastguard Worker
14*58b9f456SAndroid Build Coastguard Worker/*
15*58b9f456SAndroid Build Coastguard Worker    iomanip synopsis
16*58b9f456SAndroid Build Coastguard Worker
17*58b9f456SAndroid Build Coastguard Workernamespace std {
18*58b9f456SAndroid Build Coastguard Worker
19*58b9f456SAndroid Build Coastguard Worker// types T1, T2, ... are unspecified implementation types
20*58b9f456SAndroid Build Coastguard WorkerT1 resetiosflags(ios_base::fmtflags mask);
21*58b9f456SAndroid Build Coastguard WorkerT2 setiosflags (ios_base::fmtflags mask);
22*58b9f456SAndroid Build Coastguard WorkerT3 setbase(int base);
23*58b9f456SAndroid Build Coastguard Workertemplate<charT> T4 setfill(charT c);
24*58b9f456SAndroid Build Coastguard WorkerT5 setprecision(int n);
25*58b9f456SAndroid Build Coastguard WorkerT6 setw(int n);
26*58b9f456SAndroid Build Coastguard Workertemplate <class moneyT> T7 get_money(moneyT& mon, bool intl = false);
27*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl = false);
28*58b9f456SAndroid Build Coastguard Workertemplate <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
29*58b9f456SAndroid Build Coastguard Workertemplate <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
30*58b9f456SAndroid Build Coastguard Worker
31*58b9f456SAndroid Build Coastguard Workertemplate <class charT>
32*58b9f456SAndroid Build Coastguard Worker  T11 quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\')); // C++14
33*58b9f456SAndroid Build Coastguard Worker
34*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits, class Allocator>
35*58b9f456SAndroid Build Coastguard Worker  T12 quoted(const basic_string<charT, traits, Allocator>& s,
36*58b9f456SAndroid Build Coastguard Worker             charT delim=charT('"'), charT escape=charT('\\')); // C++14
37*58b9f456SAndroid Build Coastguard Worker
38*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits, class Allocator>
39*58b9f456SAndroid Build Coastguard Worker  T13 quoted(basic_string<charT, traits, Allocator>& s,
40*58b9f456SAndroid Build Coastguard Worker             charT delim=charT('"'), charT escape=charT('\\')); // C++14
41*58b9f456SAndroid Build Coastguard Worker
42*58b9f456SAndroid Build Coastguard Worker}  // std
43*58b9f456SAndroid Build Coastguard Worker
44*58b9f456SAndroid Build Coastguard Worker*/
45*58b9f456SAndroid Build Coastguard Worker
46*58b9f456SAndroid Build Coastguard Worker#include <__config>
47*58b9f456SAndroid Build Coastguard Worker#include <__string>
48*58b9f456SAndroid Build Coastguard Worker#include <istream>
49*58b9f456SAndroid Build Coastguard Worker#include <version>
50*58b9f456SAndroid Build Coastguard Worker
51*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
52*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header
53*58b9f456SAndroid Build Coastguard Worker#endif
54*58b9f456SAndroid Build Coastguard Worker
55*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD
56*58b9f456SAndroid Build Coastguard Worker
57*58b9f456SAndroid Build Coastguard Worker// resetiosflags
58*58b9f456SAndroid Build Coastguard Worker
59*58b9f456SAndroid Build Coastguard Workerclass __iom_t1
60*58b9f456SAndroid Build Coastguard Worker{
61*58b9f456SAndroid Build Coastguard Worker    ios_base::fmtflags __mask_;
62*58b9f456SAndroid Build Coastguard Workerpublic:
63*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
64*58b9f456SAndroid Build Coastguard Worker    explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
65*58b9f456SAndroid Build Coastguard Worker
66*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
67*58b9f456SAndroid Build Coastguard Worker    friend
68*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
69*58b9f456SAndroid Build Coastguard Worker    basic_istream<_CharT, _Traits>&
70*58b9f456SAndroid Build Coastguard Worker    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
71*58b9f456SAndroid Build Coastguard Worker    {
72*58b9f456SAndroid Build Coastguard Worker        __is.unsetf(__x.__mask_);
73*58b9f456SAndroid Build Coastguard Worker        return __is;
74*58b9f456SAndroid Build Coastguard Worker    }
75*58b9f456SAndroid Build Coastguard Worker
76*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
77*58b9f456SAndroid Build Coastguard Worker    friend
78*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
79*58b9f456SAndroid Build Coastguard Worker    basic_ostream<_CharT, _Traits>&
80*58b9f456SAndroid Build Coastguard Worker    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
81*58b9f456SAndroid Build Coastguard Worker    {
82*58b9f456SAndroid Build Coastguard Worker        __os.unsetf(__x.__mask_);
83*58b9f456SAndroid Build Coastguard Worker        return __os;
84*58b9f456SAndroid Build Coastguard Worker    }
85*58b9f456SAndroid Build Coastguard Worker};
86*58b9f456SAndroid Build Coastguard Worker
87*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
88*58b9f456SAndroid Build Coastguard Worker__iom_t1
89*58b9f456SAndroid Build Coastguard Workerresetiosflags(ios_base::fmtflags __mask)
90*58b9f456SAndroid Build Coastguard Worker{
91*58b9f456SAndroid Build Coastguard Worker    return __iom_t1(__mask);
92*58b9f456SAndroid Build Coastguard Worker}
93*58b9f456SAndroid Build Coastguard Worker
94*58b9f456SAndroid Build Coastguard Worker// setiosflags
95*58b9f456SAndroid Build Coastguard Worker
96*58b9f456SAndroid Build Coastguard Workerclass __iom_t2
97*58b9f456SAndroid Build Coastguard Worker{
98*58b9f456SAndroid Build Coastguard Worker    ios_base::fmtflags __mask_;
99*58b9f456SAndroid Build Coastguard Workerpublic:
100*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
101*58b9f456SAndroid Build Coastguard Worker    explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
102*58b9f456SAndroid Build Coastguard Worker
103*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
104*58b9f456SAndroid Build Coastguard Worker    friend
105*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
106*58b9f456SAndroid Build Coastguard Worker    basic_istream<_CharT, _Traits>&
107*58b9f456SAndroid Build Coastguard Worker    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
108*58b9f456SAndroid Build Coastguard Worker    {
109*58b9f456SAndroid Build Coastguard Worker        __is.setf(__x.__mask_);
110*58b9f456SAndroid Build Coastguard Worker        return __is;
111*58b9f456SAndroid Build Coastguard Worker    }
112*58b9f456SAndroid Build Coastguard Worker
113*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
114*58b9f456SAndroid Build Coastguard Worker    friend
115*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
116*58b9f456SAndroid Build Coastguard Worker    basic_ostream<_CharT, _Traits>&
117*58b9f456SAndroid Build Coastguard Worker    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
118*58b9f456SAndroid Build Coastguard Worker    {
119*58b9f456SAndroid Build Coastguard Worker        __os.setf(__x.__mask_);
120*58b9f456SAndroid Build Coastguard Worker        return __os;
121*58b9f456SAndroid Build Coastguard Worker    }
122*58b9f456SAndroid Build Coastguard Worker};
123*58b9f456SAndroid Build Coastguard Worker
124*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
125*58b9f456SAndroid Build Coastguard Worker__iom_t2
126*58b9f456SAndroid Build Coastguard Workersetiosflags(ios_base::fmtflags __mask)
127*58b9f456SAndroid Build Coastguard Worker{
128*58b9f456SAndroid Build Coastguard Worker    return __iom_t2(__mask);
129*58b9f456SAndroid Build Coastguard Worker}
130*58b9f456SAndroid Build Coastguard Worker
131*58b9f456SAndroid Build Coastguard Worker// setbase
132*58b9f456SAndroid Build Coastguard Worker
133*58b9f456SAndroid Build Coastguard Workerclass __iom_t3
134*58b9f456SAndroid Build Coastguard Worker{
135*58b9f456SAndroid Build Coastguard Worker    int __base_;
136*58b9f456SAndroid Build Coastguard Workerpublic:
137*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
138*58b9f456SAndroid Build Coastguard Worker    explicit __iom_t3(int __b) : __base_(__b) {}
139*58b9f456SAndroid Build Coastguard Worker
140*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
141*58b9f456SAndroid Build Coastguard Worker    friend
142*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
143*58b9f456SAndroid Build Coastguard Worker    basic_istream<_CharT, _Traits>&
144*58b9f456SAndroid Build Coastguard Worker    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
145*58b9f456SAndroid Build Coastguard Worker    {
146*58b9f456SAndroid Build Coastguard Worker        __is.setf(__x.__base_ == 8  ? ios_base::oct :
147*58b9f456SAndroid Build Coastguard Worker                  __x.__base_ == 10 ? ios_base::dec :
148*58b9f456SAndroid Build Coastguard Worker                  __x.__base_ == 16 ? ios_base::hex :
149*58b9f456SAndroid Build Coastguard Worker                  ios_base::fmtflags(0), ios_base::basefield);
150*58b9f456SAndroid Build Coastguard Worker        return __is;
151*58b9f456SAndroid Build Coastguard Worker    }
152*58b9f456SAndroid Build Coastguard Worker
153*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
154*58b9f456SAndroid Build Coastguard Worker    friend
155*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
156*58b9f456SAndroid Build Coastguard Worker    basic_ostream<_CharT, _Traits>&
157*58b9f456SAndroid Build Coastguard Worker    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
158*58b9f456SAndroid Build Coastguard Worker    {
159*58b9f456SAndroid Build Coastguard Worker        __os.setf(__x.__base_ == 8  ? ios_base::oct :
160*58b9f456SAndroid Build Coastguard Worker                  __x.__base_ == 10 ? ios_base::dec :
161*58b9f456SAndroid Build Coastguard Worker                  __x.__base_ == 16 ? ios_base::hex :
162*58b9f456SAndroid Build Coastguard Worker                  ios_base::fmtflags(0), ios_base::basefield);
163*58b9f456SAndroid Build Coastguard Worker        return __os;
164*58b9f456SAndroid Build Coastguard Worker    }
165*58b9f456SAndroid Build Coastguard Worker};
166*58b9f456SAndroid Build Coastguard Worker
167*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
168*58b9f456SAndroid Build Coastguard Worker__iom_t3
169*58b9f456SAndroid Build Coastguard Workersetbase(int __base)
170*58b9f456SAndroid Build Coastguard Worker{
171*58b9f456SAndroid Build Coastguard Worker    return __iom_t3(__base);
172*58b9f456SAndroid Build Coastguard Worker}
173*58b9f456SAndroid Build Coastguard Worker
174*58b9f456SAndroid Build Coastguard Worker// setfill
175*58b9f456SAndroid Build Coastguard Worker
176*58b9f456SAndroid Build Coastguard Workertemplate<class _CharT>
177*58b9f456SAndroid Build Coastguard Workerclass __iom_t4
178*58b9f456SAndroid Build Coastguard Worker{
179*58b9f456SAndroid Build Coastguard Worker    _CharT __fill_;
180*58b9f456SAndroid Build Coastguard Workerpublic:
181*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
182*58b9f456SAndroid Build Coastguard Worker    explicit __iom_t4(_CharT __c) : __fill_(__c) {}
183*58b9f456SAndroid Build Coastguard Worker
184*58b9f456SAndroid Build Coastguard Worker    template <class _Traits>
185*58b9f456SAndroid Build Coastguard Worker    friend
186*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
187*58b9f456SAndroid Build Coastguard Worker    basic_ostream<_CharT, _Traits>&
188*58b9f456SAndroid Build Coastguard Worker    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
189*58b9f456SAndroid Build Coastguard Worker    {
190*58b9f456SAndroid Build Coastguard Worker        __os.fill(__x.__fill_);
191*58b9f456SAndroid Build Coastguard Worker        return __os;
192*58b9f456SAndroid Build Coastguard Worker    }
193*58b9f456SAndroid Build Coastguard Worker};
194*58b9f456SAndroid Build Coastguard Worker
195*58b9f456SAndroid Build Coastguard Workertemplate<class _CharT>
196*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
197*58b9f456SAndroid Build Coastguard Worker__iom_t4<_CharT>
198*58b9f456SAndroid Build Coastguard Workersetfill(_CharT __c)
199*58b9f456SAndroid Build Coastguard Worker{
200*58b9f456SAndroid Build Coastguard Worker    return __iom_t4<_CharT>(__c);
201*58b9f456SAndroid Build Coastguard Worker}
202*58b9f456SAndroid Build Coastguard Worker
203*58b9f456SAndroid Build Coastguard Worker// setprecision
204*58b9f456SAndroid Build Coastguard Worker
205*58b9f456SAndroid Build Coastguard Workerclass __iom_t5
206*58b9f456SAndroid Build Coastguard Worker{
207*58b9f456SAndroid Build Coastguard Worker    int __n_;
208*58b9f456SAndroid Build Coastguard Workerpublic:
209*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
210*58b9f456SAndroid Build Coastguard Worker    explicit __iom_t5(int __n) : __n_(__n) {}
211*58b9f456SAndroid Build Coastguard Worker
212*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
213*58b9f456SAndroid Build Coastguard Worker    friend
214*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
215*58b9f456SAndroid Build Coastguard Worker    basic_istream<_CharT, _Traits>&
216*58b9f456SAndroid Build Coastguard Worker    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
217*58b9f456SAndroid Build Coastguard Worker    {
218*58b9f456SAndroid Build Coastguard Worker        __is.precision(__x.__n_);
219*58b9f456SAndroid Build Coastguard Worker        return __is;
220*58b9f456SAndroid Build Coastguard Worker    }
221*58b9f456SAndroid Build Coastguard Worker
222*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
223*58b9f456SAndroid Build Coastguard Worker    friend
224*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
225*58b9f456SAndroid Build Coastguard Worker    basic_ostream<_CharT, _Traits>&
226*58b9f456SAndroid Build Coastguard Worker    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
227*58b9f456SAndroid Build Coastguard Worker    {
228*58b9f456SAndroid Build Coastguard Worker        __os.precision(__x.__n_);
229*58b9f456SAndroid Build Coastguard Worker        return __os;
230*58b9f456SAndroid Build Coastguard Worker    }
231*58b9f456SAndroid Build Coastguard Worker};
232*58b9f456SAndroid Build Coastguard Worker
233*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
234*58b9f456SAndroid Build Coastguard Worker__iom_t5
235*58b9f456SAndroid Build Coastguard Workersetprecision(int __n)
236*58b9f456SAndroid Build Coastguard Worker{
237*58b9f456SAndroid Build Coastguard Worker    return __iom_t5(__n);
238*58b9f456SAndroid Build Coastguard Worker}
239*58b9f456SAndroid Build Coastguard Worker
240*58b9f456SAndroid Build Coastguard Worker// setw
241*58b9f456SAndroid Build Coastguard Worker
242*58b9f456SAndroid Build Coastguard Workerclass __iom_t6
243*58b9f456SAndroid Build Coastguard Worker{
244*58b9f456SAndroid Build Coastguard Worker    int __n_;
245*58b9f456SAndroid Build Coastguard Workerpublic:
246*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
247*58b9f456SAndroid Build Coastguard Worker    explicit __iom_t6(int __n) : __n_(__n) {}
248*58b9f456SAndroid Build Coastguard Worker
249*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
250*58b9f456SAndroid Build Coastguard Worker    friend
251*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
252*58b9f456SAndroid Build Coastguard Worker    basic_istream<_CharT, _Traits>&
253*58b9f456SAndroid Build Coastguard Worker    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
254*58b9f456SAndroid Build Coastguard Worker    {
255*58b9f456SAndroid Build Coastguard Worker        __is.width(__x.__n_);
256*58b9f456SAndroid Build Coastguard Worker        return __is;
257*58b9f456SAndroid Build Coastguard Worker    }
258*58b9f456SAndroid Build Coastguard Worker
259*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits>
260*58b9f456SAndroid Build Coastguard Worker    friend
261*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
262*58b9f456SAndroid Build Coastguard Worker    basic_ostream<_CharT, _Traits>&
263*58b9f456SAndroid Build Coastguard Worker    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
264*58b9f456SAndroid Build Coastguard Worker    {
265*58b9f456SAndroid Build Coastguard Worker        __os.width(__x.__n_);
266*58b9f456SAndroid Build Coastguard Worker        return __os;
267*58b9f456SAndroid Build Coastguard Worker    }
268*58b9f456SAndroid Build Coastguard Worker};
269*58b9f456SAndroid Build Coastguard Worker
270*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
271*58b9f456SAndroid Build Coastguard Worker__iom_t6
272*58b9f456SAndroid Build Coastguard Workersetw(int __n)
273*58b9f456SAndroid Build Coastguard Worker{
274*58b9f456SAndroid Build Coastguard Worker    return __iom_t6(__n);
275*58b9f456SAndroid Build Coastguard Worker}
276*58b9f456SAndroid Build Coastguard Worker
277*58b9f456SAndroid Build Coastguard Worker// get_money
278*58b9f456SAndroid Build Coastguard Worker
279*58b9f456SAndroid Build Coastguard Workertemplate <class _MoneyT> class __iom_t7;
280*58b9f456SAndroid Build Coastguard Worker
281*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _MoneyT>
282*58b9f456SAndroid Build Coastguard Workerbasic_istream<_CharT, _Traits>&
283*58b9f456SAndroid Build Coastguard Workeroperator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x);
284*58b9f456SAndroid Build Coastguard Worker
285*58b9f456SAndroid Build Coastguard Workertemplate <class _MoneyT>
286*58b9f456SAndroid Build Coastguard Workerclass __iom_t7
287*58b9f456SAndroid Build Coastguard Worker{
288*58b9f456SAndroid Build Coastguard Worker    _MoneyT& __mon_;
289*58b9f456SAndroid Build Coastguard Worker    bool __intl_;
290*58b9f456SAndroid Build Coastguard Workerpublic:
291*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
292*58b9f456SAndroid Build Coastguard Worker    __iom_t7(_MoneyT& __mon, bool __intl)
293*58b9f456SAndroid Build Coastguard Worker        : __mon_(__mon), __intl_(__intl) {}
294*58b9f456SAndroid Build Coastguard Worker
295*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits, class _Mp>
296*58b9f456SAndroid Build Coastguard Worker    friend
297*58b9f456SAndroid Build Coastguard Worker    basic_istream<_CharT, _Traits>&
298*58b9f456SAndroid Build Coastguard Worker    operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
299*58b9f456SAndroid Build Coastguard Worker};
300*58b9f456SAndroid Build Coastguard Worker
301*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _MoneyT>
302*58b9f456SAndroid Build Coastguard Workerbasic_istream<_CharT, _Traits>&
303*58b9f456SAndroid Build Coastguard Workeroperator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
304*58b9f456SAndroid Build Coastguard Worker{
305*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
306*58b9f456SAndroid Build Coastguard Worker    try
307*58b9f456SAndroid Build Coastguard Worker    {
308*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
309*58b9f456SAndroid Build Coastguard Worker        typename basic_istream<_CharT, _Traits>::sentry __s(__is);
310*58b9f456SAndroid Build Coastguard Worker        if (__s)
311*58b9f456SAndroid Build Coastguard Worker        {
312*58b9f456SAndroid Build Coastguard Worker            typedef istreambuf_iterator<_CharT, _Traits> _Ip;
313*58b9f456SAndroid Build Coastguard Worker            typedef money_get<_CharT, _Ip> _Fp;
314*58b9f456SAndroid Build Coastguard Worker            ios_base::iostate __err = ios_base::goodbit;
315*58b9f456SAndroid Build Coastguard Worker            const _Fp& __mf = use_facet<_Fp>(__is.getloc());
316*58b9f456SAndroid Build Coastguard Worker            __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
317*58b9f456SAndroid Build Coastguard Worker            __is.setstate(__err);
318*58b9f456SAndroid Build Coastguard Worker        }
319*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
320*58b9f456SAndroid Build Coastguard Worker    }
321*58b9f456SAndroid Build Coastguard Worker    catch (...)
322*58b9f456SAndroid Build Coastguard Worker    {
323*58b9f456SAndroid Build Coastguard Worker        __is.__set_badbit_and_consider_rethrow();
324*58b9f456SAndroid Build Coastguard Worker    }
325*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
326*58b9f456SAndroid Build Coastguard Worker    return __is;
327*58b9f456SAndroid Build Coastguard Worker}
328*58b9f456SAndroid Build Coastguard Worker
329*58b9f456SAndroid Build Coastguard Workertemplate <class _MoneyT>
330*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
331*58b9f456SAndroid Build Coastguard Worker__iom_t7<_MoneyT>
332*58b9f456SAndroid Build Coastguard Workerget_money(_MoneyT& __mon, bool __intl = false)
333*58b9f456SAndroid Build Coastguard Worker{
334*58b9f456SAndroid Build Coastguard Worker    return __iom_t7<_MoneyT>(__mon, __intl);
335*58b9f456SAndroid Build Coastguard Worker}
336*58b9f456SAndroid Build Coastguard Worker
337*58b9f456SAndroid Build Coastguard Worker// put_money
338*58b9f456SAndroid Build Coastguard Worker
339*58b9f456SAndroid Build Coastguard Workertemplate <class _MoneyT> class __iom_t8;
340*58b9f456SAndroid Build Coastguard Worker
341*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _MoneyT>
342*58b9f456SAndroid Build Coastguard Workerbasic_ostream<_CharT, _Traits>&
343*58b9f456SAndroid Build Coastguard Workeroperator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x);
344*58b9f456SAndroid Build Coastguard Worker
345*58b9f456SAndroid Build Coastguard Workertemplate <class _MoneyT>
346*58b9f456SAndroid Build Coastguard Workerclass __iom_t8
347*58b9f456SAndroid Build Coastguard Worker{
348*58b9f456SAndroid Build Coastguard Worker    const _MoneyT& __mon_;
349*58b9f456SAndroid Build Coastguard Worker    bool __intl_;
350*58b9f456SAndroid Build Coastguard Workerpublic:
351*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
352*58b9f456SAndroid Build Coastguard Worker    __iom_t8(const _MoneyT& __mon, bool __intl)
353*58b9f456SAndroid Build Coastguard Worker        : __mon_(__mon), __intl_(__intl) {}
354*58b9f456SAndroid Build Coastguard Worker
355*58b9f456SAndroid Build Coastguard Worker    template <class _CharT, class _Traits, class _Mp>
356*58b9f456SAndroid Build Coastguard Worker    friend
357*58b9f456SAndroid Build Coastguard Worker    basic_ostream<_CharT, _Traits>&
358*58b9f456SAndroid Build Coastguard Worker    operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
359*58b9f456SAndroid Build Coastguard Worker};
360*58b9f456SAndroid Build Coastguard Worker
361*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _MoneyT>
362*58b9f456SAndroid Build Coastguard Workerbasic_ostream<_CharT, _Traits>&
363*58b9f456SAndroid Build Coastguard Workeroperator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
364*58b9f456SAndroid Build Coastguard Worker{
365*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
366*58b9f456SAndroid Build Coastguard Worker    try
367*58b9f456SAndroid Build Coastguard Worker    {
368*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
369*58b9f456SAndroid Build Coastguard Worker        typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
370*58b9f456SAndroid Build Coastguard Worker        if (__s)
371*58b9f456SAndroid Build Coastguard Worker        {
372*58b9f456SAndroid Build Coastguard Worker            typedef ostreambuf_iterator<_CharT, _Traits> _Op;
373*58b9f456SAndroid Build Coastguard Worker            typedef money_put<_CharT, _Op> _Fp;
374*58b9f456SAndroid Build Coastguard Worker            const _Fp& __mf = use_facet<_Fp>(__os.getloc());
375*58b9f456SAndroid Build Coastguard Worker            if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
376*58b9f456SAndroid Build Coastguard Worker                __os.setstate(ios_base::badbit);
377*58b9f456SAndroid Build Coastguard Worker        }
378*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
379*58b9f456SAndroid Build Coastguard Worker    }
380*58b9f456SAndroid Build Coastguard Worker    catch (...)
381*58b9f456SAndroid Build Coastguard Worker    {
382*58b9f456SAndroid Build Coastguard Worker        __os.__set_badbit_and_consider_rethrow();
383*58b9f456SAndroid Build Coastguard Worker    }
384*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
385*58b9f456SAndroid Build Coastguard Worker    return __os;
386*58b9f456SAndroid Build Coastguard Worker}
387*58b9f456SAndroid Build Coastguard Worker
388*58b9f456SAndroid Build Coastguard Workertemplate <class _MoneyT>
389*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
390*58b9f456SAndroid Build Coastguard Worker__iom_t8<_MoneyT>
391*58b9f456SAndroid Build Coastguard Workerput_money(const _MoneyT& __mon, bool __intl = false)
392*58b9f456SAndroid Build Coastguard Worker{
393*58b9f456SAndroid Build Coastguard Worker    return __iom_t8<_MoneyT>(__mon, __intl);
394*58b9f456SAndroid Build Coastguard Worker}
395*58b9f456SAndroid Build Coastguard Worker
396*58b9f456SAndroid Build Coastguard Worker// get_time
397*58b9f456SAndroid Build Coastguard Worker
398*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT> class __iom_t9;
399*58b9f456SAndroid Build Coastguard Worker
400*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits>
401*58b9f456SAndroid Build Coastguard Workerbasic_istream<_CharT, _Traits>&
402*58b9f456SAndroid Build Coastguard Workeroperator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x);
403*58b9f456SAndroid Build Coastguard Worker
404*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT>
405*58b9f456SAndroid Build Coastguard Workerclass __iom_t9
406*58b9f456SAndroid Build Coastguard Worker{
407*58b9f456SAndroid Build Coastguard Worker    tm* __tm_;
408*58b9f456SAndroid Build Coastguard Worker    const _CharT* __fmt_;
409*58b9f456SAndroid Build Coastguard Workerpublic:
410*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
411*58b9f456SAndroid Build Coastguard Worker    __iom_t9(tm* __tm, const _CharT* __fmt)
412*58b9f456SAndroid Build Coastguard Worker        : __tm_(__tm), __fmt_(__fmt) {}
413*58b9f456SAndroid Build Coastguard Worker
414*58b9f456SAndroid Build Coastguard Worker    template <class _Cp, class _Traits>
415*58b9f456SAndroid Build Coastguard Worker    friend
416*58b9f456SAndroid Build Coastguard Worker    basic_istream<_Cp, _Traits>&
417*58b9f456SAndroid Build Coastguard Worker    operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
418*58b9f456SAndroid Build Coastguard Worker};
419*58b9f456SAndroid Build Coastguard Worker
420*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits>
421*58b9f456SAndroid Build Coastguard Workerbasic_istream<_CharT, _Traits>&
422*58b9f456SAndroid Build Coastguard Workeroperator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
423*58b9f456SAndroid Build Coastguard Worker{
424*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
425*58b9f456SAndroid Build Coastguard Worker    try
426*58b9f456SAndroid Build Coastguard Worker    {
427*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
428*58b9f456SAndroid Build Coastguard Worker        typename basic_istream<_CharT, _Traits>::sentry __s(__is);
429*58b9f456SAndroid Build Coastguard Worker        if (__s)
430*58b9f456SAndroid Build Coastguard Worker        {
431*58b9f456SAndroid Build Coastguard Worker            typedef istreambuf_iterator<_CharT, _Traits> _Ip;
432*58b9f456SAndroid Build Coastguard Worker            typedef time_get<_CharT, _Ip> _Fp;
433*58b9f456SAndroid Build Coastguard Worker            ios_base::iostate __err = ios_base::goodbit;
434*58b9f456SAndroid Build Coastguard Worker            const _Fp& __tf = use_facet<_Fp>(__is.getloc());
435*58b9f456SAndroid Build Coastguard Worker            __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
436*58b9f456SAndroid Build Coastguard Worker                     __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
437*58b9f456SAndroid Build Coastguard Worker            __is.setstate(__err);
438*58b9f456SAndroid Build Coastguard Worker        }
439*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
440*58b9f456SAndroid Build Coastguard Worker    }
441*58b9f456SAndroid Build Coastguard Worker    catch (...)
442*58b9f456SAndroid Build Coastguard Worker    {
443*58b9f456SAndroid Build Coastguard Worker        __is.__set_badbit_and_consider_rethrow();
444*58b9f456SAndroid Build Coastguard Worker    }
445*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
446*58b9f456SAndroid Build Coastguard Worker    return __is;
447*58b9f456SAndroid Build Coastguard Worker}
448*58b9f456SAndroid Build Coastguard Worker
449*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT>
450*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
451*58b9f456SAndroid Build Coastguard Worker__iom_t9<_CharT>
452*58b9f456SAndroid Build Coastguard Workerget_time(tm* __tm, const _CharT* __fmt)
453*58b9f456SAndroid Build Coastguard Worker{
454*58b9f456SAndroid Build Coastguard Worker    return __iom_t9<_CharT>(__tm, __fmt);
455*58b9f456SAndroid Build Coastguard Worker}
456*58b9f456SAndroid Build Coastguard Worker
457*58b9f456SAndroid Build Coastguard Worker// put_time
458*58b9f456SAndroid Build Coastguard Worker
459*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT> class __iom_t10;
460*58b9f456SAndroid Build Coastguard Worker
461*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits>
462*58b9f456SAndroid Build Coastguard Workerbasic_ostream<_CharT, _Traits>&
463*58b9f456SAndroid Build Coastguard Workeroperator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x);
464*58b9f456SAndroid Build Coastguard Worker
465*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT>
466*58b9f456SAndroid Build Coastguard Workerclass __iom_t10
467*58b9f456SAndroid Build Coastguard Worker{
468*58b9f456SAndroid Build Coastguard Worker    const tm* __tm_;
469*58b9f456SAndroid Build Coastguard Worker    const _CharT* __fmt_;
470*58b9f456SAndroid Build Coastguard Workerpublic:
471*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
472*58b9f456SAndroid Build Coastguard Worker    __iom_t10(const tm* __tm, const _CharT* __fmt)
473*58b9f456SAndroid Build Coastguard Worker        : __tm_(__tm), __fmt_(__fmt) {}
474*58b9f456SAndroid Build Coastguard Worker
475*58b9f456SAndroid Build Coastguard Worker    template <class _Cp, class _Traits>
476*58b9f456SAndroid Build Coastguard Worker    friend
477*58b9f456SAndroid Build Coastguard Worker    basic_ostream<_Cp, _Traits>&
478*58b9f456SAndroid Build Coastguard Worker    operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
479*58b9f456SAndroid Build Coastguard Worker};
480*58b9f456SAndroid Build Coastguard Worker
481*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits>
482*58b9f456SAndroid Build Coastguard Workerbasic_ostream<_CharT, _Traits>&
483*58b9f456SAndroid Build Coastguard Workeroperator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
484*58b9f456SAndroid Build Coastguard Worker{
485*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
486*58b9f456SAndroid Build Coastguard Worker    try
487*58b9f456SAndroid Build Coastguard Worker    {
488*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
489*58b9f456SAndroid Build Coastguard Worker        typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
490*58b9f456SAndroid Build Coastguard Worker        if (__s)
491*58b9f456SAndroid Build Coastguard Worker        {
492*58b9f456SAndroid Build Coastguard Worker            typedef ostreambuf_iterator<_CharT, _Traits> _Op;
493*58b9f456SAndroid Build Coastguard Worker            typedef time_put<_CharT, _Op> _Fp;
494*58b9f456SAndroid Build Coastguard Worker            const _Fp& __tf = use_facet<_Fp>(__os.getloc());
495*58b9f456SAndroid Build Coastguard Worker            if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
496*58b9f456SAndroid Build Coastguard Worker                         __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
497*58b9f456SAndroid Build Coastguard Worker                __os.setstate(ios_base::badbit);
498*58b9f456SAndroid Build Coastguard Worker        }
499*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
500*58b9f456SAndroid Build Coastguard Worker    }
501*58b9f456SAndroid Build Coastguard Worker    catch (...)
502*58b9f456SAndroid Build Coastguard Worker    {
503*58b9f456SAndroid Build Coastguard Worker        __os.__set_badbit_and_consider_rethrow();
504*58b9f456SAndroid Build Coastguard Worker    }
505*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
506*58b9f456SAndroid Build Coastguard Worker    return __os;
507*58b9f456SAndroid Build Coastguard Worker}
508*58b9f456SAndroid Build Coastguard Worker
509*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT>
510*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
511*58b9f456SAndroid Build Coastguard Worker__iom_t10<_CharT>
512*58b9f456SAndroid Build Coastguard Workerput_time(const tm* __tm, const _CharT* __fmt)
513*58b9f456SAndroid Build Coastguard Worker{
514*58b9f456SAndroid Build Coastguard Worker    return __iom_t10<_CharT>(__tm, __fmt);
515*58b9f456SAndroid Build Coastguard Worker}
516*58b9f456SAndroid Build Coastguard Worker
517*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _ForwardIterator>
518*58b9f456SAndroid Build Coastguard Workerstd::basic_ostream<_CharT, _Traits> &
519*58b9f456SAndroid Build Coastguard Worker__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
520*58b9f456SAndroid Build Coastguard Worker        _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
521*58b9f456SAndroid Build Coastguard Worker{
522*58b9f456SAndroid Build Coastguard Worker    _VSTD::basic_string<_CharT, _Traits> __str;
523*58b9f456SAndroid Build Coastguard Worker    __str.push_back(__delim);
524*58b9f456SAndroid Build Coastguard Worker    for ( ; __first != __last; ++ __first )
525*58b9f456SAndroid Build Coastguard Worker    {
526*58b9f456SAndroid Build Coastguard Worker        if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim))
527*58b9f456SAndroid Build Coastguard Worker            __str.push_back(__escape);
528*58b9f456SAndroid Build Coastguard Worker        __str.push_back(*__first);
529*58b9f456SAndroid Build Coastguard Worker    }
530*58b9f456SAndroid Build Coastguard Worker    __str.push_back(__delim);
531*58b9f456SAndroid Build Coastguard Worker    return __put_character_sequence(__os, __str.data(), __str.size());
532*58b9f456SAndroid Build Coastguard Worker}
533*58b9f456SAndroid Build Coastguard Worker
534*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _String>
535*58b9f456SAndroid Build Coastguard Workerbasic_istream<_CharT, _Traits> &
536*58b9f456SAndroid Build Coastguard Worker__quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _CharT __delim, _CharT __escape )
537*58b9f456SAndroid Build Coastguard Worker{
538*58b9f456SAndroid Build Coastguard Worker    __string.clear ();
539*58b9f456SAndroid Build Coastguard Worker    _CharT __c;
540*58b9f456SAndroid Build Coastguard Worker    __is >> __c;
541*58b9f456SAndroid Build Coastguard Worker    if ( __is.fail ())
542*58b9f456SAndroid Build Coastguard Worker        return __is;
543*58b9f456SAndroid Build Coastguard Worker
544*58b9f456SAndroid Build Coastguard Worker    if (!_Traits::eq (__c, __delim))    // no delimiter, read the whole string
545*58b9f456SAndroid Build Coastguard Worker    {
546*58b9f456SAndroid Build Coastguard Worker        __is.unget ();
547*58b9f456SAndroid Build Coastguard Worker        __is >> __string;
548*58b9f456SAndroid Build Coastguard Worker        return __is;
549*58b9f456SAndroid Build Coastguard Worker    }
550*58b9f456SAndroid Build Coastguard Worker
551*58b9f456SAndroid Build Coastguard Worker    __save_flags<_CharT, _Traits> sf(__is);
552*58b9f456SAndroid Build Coastguard Worker    noskipws (__is);
553*58b9f456SAndroid Build Coastguard Worker    while (true)
554*58b9f456SAndroid Build Coastguard Worker        {
555*58b9f456SAndroid Build Coastguard Worker        __is >> __c;
556*58b9f456SAndroid Build Coastguard Worker        if ( __is.fail ())
557*58b9f456SAndroid Build Coastguard Worker            break;
558*58b9f456SAndroid Build Coastguard Worker        if (_Traits::eq (__c, __escape))
559*58b9f456SAndroid Build Coastguard Worker        {
560*58b9f456SAndroid Build Coastguard Worker            __is >> __c;
561*58b9f456SAndroid Build Coastguard Worker            if ( __is.fail ())
562*58b9f456SAndroid Build Coastguard Worker                break;
563*58b9f456SAndroid Build Coastguard Worker        }
564*58b9f456SAndroid Build Coastguard Worker        else if (_Traits::eq (__c, __delim))
565*58b9f456SAndroid Build Coastguard Worker            break;
566*58b9f456SAndroid Build Coastguard Worker        __string.push_back ( __c );
567*58b9f456SAndroid Build Coastguard Worker        }
568*58b9f456SAndroid Build Coastguard Worker    return __is;
569*58b9f456SAndroid Build Coastguard Worker}
570*58b9f456SAndroid Build Coastguard Worker
571*58b9f456SAndroid Build Coastguard Worker
572*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Iter>
573*58b9f456SAndroid Build Coastguard Workerbasic_ostream<_CharT, _Traits>& operator<<(
574*58b9f456SAndroid Build Coastguard Worker         basic_ostream<_CharT, _Traits>& __os,
575*58b9f456SAndroid Build Coastguard Worker         const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
576*58b9f456SAndroid Build Coastguard Worker{
577*58b9f456SAndroid Build Coastguard Worker    return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
578*58b9f456SAndroid Build Coastguard Worker}
579*58b9f456SAndroid Build Coastguard Worker
580*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator>
581*58b9f456SAndroid Build Coastguard Workerstruct __quoted_proxy
582*58b9f456SAndroid Build Coastguard Worker{
583*58b9f456SAndroid Build Coastguard Worker    basic_string<_CharT, _Traits, _Allocator> &__string;
584*58b9f456SAndroid Build Coastguard Worker    _CharT  __delim;
585*58b9f456SAndroid Build Coastguard Worker    _CharT  __escape;
586*58b9f456SAndroid Build Coastguard Worker
587*58b9f456SAndroid Build Coastguard Worker    __quoted_proxy(basic_string<_CharT, _Traits, _Allocator> &__s, _CharT __d, _CharT __e)
588*58b9f456SAndroid Build Coastguard Worker    : __string(__s), __delim(__d), __escape(__e) {}
589*58b9f456SAndroid Build Coastguard Worker};
590*58b9f456SAndroid Build Coastguard Worker
591*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator>
592*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
593*58b9f456SAndroid Build Coastguard Workerbasic_ostream<_CharT, _Traits>& operator<<(
594*58b9f456SAndroid Build Coastguard Worker        basic_ostream<_CharT, _Traits>& __os,
595*58b9f456SAndroid Build Coastguard Worker        const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
596*58b9f456SAndroid Build Coastguard Worker{
597*58b9f456SAndroid Build Coastguard Worker    return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
598*58b9f456SAndroid Build Coastguard Worker}
599*58b9f456SAndroid Build Coastguard Worker
600*58b9f456SAndroid Build Coastguard Worker//  extractor for non-const basic_string& proxies
601*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator>
602*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
603*58b9f456SAndroid Build Coastguard Workerbasic_istream<_CharT, _Traits>& operator>>(
604*58b9f456SAndroid Build Coastguard Worker        basic_istream<_CharT, _Traits>& __is,
605*58b9f456SAndroid Build Coastguard Worker        const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
606*58b9f456SAndroid Build Coastguard Worker{
607*58b9f456SAndroid Build Coastguard Worker    return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
608*58b9f456SAndroid Build Coastguard Worker}
609*58b9f456SAndroid Build Coastguard Worker
610*58b9f456SAndroid Build Coastguard Worker
611*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT>
612*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
613*58b9f456SAndroid Build Coastguard Worker__quoted_output_proxy<_CharT, const _CharT *>
614*58b9f456SAndroid Build Coastguard Workerquoted ( const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape =_CharT('\\'))
615*58b9f456SAndroid Build Coastguard Worker{
616*58b9f456SAndroid Build Coastguard Worker    const _CharT *__end = __s;
617*58b9f456SAndroid Build Coastguard Worker    while ( *__end ) ++__end;
618*58b9f456SAndroid Build Coastguard Worker    return __quoted_output_proxy<_CharT, const _CharT *> ( __s, __end, __delim, __escape );
619*58b9f456SAndroid Build Coastguard Worker}
620*58b9f456SAndroid Build Coastguard Worker
621*58b9f456SAndroid Build Coastguard Worker
622*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator>
623*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
624*58b9f456SAndroid Build Coastguard Worker__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
625*58b9f456SAndroid Build Coastguard Worker__quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
626*58b9f456SAndroid Build Coastguard Worker{
627*58b9f456SAndroid Build Coastguard Worker    return __quoted_output_proxy<_CharT,
628*58b9f456SAndroid Build Coastguard Worker            typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
629*58b9f456SAndroid Build Coastguard Worker                    ( __s.cbegin(), __s.cend (), __delim, __escape );
630*58b9f456SAndroid Build Coastguard Worker}
631*58b9f456SAndroid Build Coastguard Worker
632*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator>
633*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
634*58b9f456SAndroid Build Coastguard Worker__quoted_proxy<_CharT, _Traits, _Allocator>
635*58b9f456SAndroid Build Coastguard Worker__quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
636*58b9f456SAndroid Build Coastguard Worker{
637*58b9f456SAndroid Build Coastguard Worker    return __quoted_proxy<_CharT, _Traits, _Allocator>( __s, __delim, __escape );
638*58b9f456SAndroid Build Coastguard Worker}
639*58b9f456SAndroid Build Coastguard Worker
640*58b9f456SAndroid Build Coastguard Worker
641*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
642*58b9f456SAndroid Build Coastguard Worker
643*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator>
644*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
645*58b9f456SAndroid Build Coastguard Worker__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
646*58b9f456SAndroid Build Coastguard Workerquoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
647*58b9f456SAndroid Build Coastguard Worker{
648*58b9f456SAndroid Build Coastguard Worker    return __quoted(__s, __delim, __escape);
649*58b9f456SAndroid Build Coastguard Worker}
650*58b9f456SAndroid Build Coastguard Worker
651*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator>
652*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
653*58b9f456SAndroid Build Coastguard Worker__quoted_proxy<_CharT, _Traits, _Allocator>
654*58b9f456SAndroid Build Coastguard Workerquoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
655*58b9f456SAndroid Build Coastguard Worker{
656*58b9f456SAndroid Build Coastguard Worker    return __quoted(__s, __delim, __escape);
657*58b9f456SAndroid Build Coastguard Worker}
658*58b9f456SAndroid Build Coastguard Worker
659*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits>
660*58b9f456SAndroid Build Coastguard Worker__quoted_output_proxy<_CharT, const _CharT *, _Traits>
661*58b9f456SAndroid Build Coastguard Workerquoted (basic_string_view <_CharT, _Traits> __sv,
662*58b9f456SAndroid Build Coastguard Worker             _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
663*58b9f456SAndroid Build Coastguard Worker{
664*58b9f456SAndroid Build Coastguard Worker    return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
665*58b9f456SAndroid Build Coastguard Worker         ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
666*58b9f456SAndroid Build Coastguard Worker}
667*58b9f456SAndroid Build Coastguard Worker#endif
668*58b9f456SAndroid Build Coastguard Worker
669*58b9f456SAndroid Build Coastguard Worker_LIBCPP_END_NAMESPACE_STD
670*58b9f456SAndroid Build Coastguard Worker
671*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_IOMANIP
672