/src/llvm-project-16.0.6.build/include/c++/v1/ostream
Line | Count | Source (jump to first uncovered line) |
1 | | // -*- C++ -*- |
2 | | //===----------------------------------------------------------------------===// |
3 | | // |
4 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
5 | | // See https://llvm.org/LICENSE.txt for license information. |
6 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | |
10 | | #ifndef _LIBCPP_OSTREAM |
11 | | #define _LIBCPP_OSTREAM |
12 | | |
13 | | /* |
14 | | ostream synopsis |
15 | | |
16 | | template <class charT, class traits = char_traits<charT> > |
17 | | class basic_ostream |
18 | | : virtual public basic_ios<charT,traits> |
19 | | { |
20 | | public: |
21 | | // types (inherited from basic_ios (27.5.4)): |
22 | | typedef charT char_type; |
23 | | typedef traits traits_type; |
24 | | typedef typename traits_type::int_type int_type; |
25 | | typedef typename traits_type::pos_type pos_type; |
26 | | typedef typename traits_type::off_type off_type; |
27 | | |
28 | | // 27.7.2.2 Constructor/destructor: |
29 | | explicit basic_ostream(basic_streambuf<char_type,traits>* sb); |
30 | | basic_ostream(basic_ostream&& rhs); |
31 | | virtual ~basic_ostream(); |
32 | | |
33 | | // 27.7.2.3 Assign/swap |
34 | | basic_ostream& operator=(const basic_ostream& rhs) = delete; // C++14 |
35 | | basic_ostream& operator=(basic_ostream&& rhs); |
36 | | void swap(basic_ostream& rhs); |
37 | | |
38 | | // 27.7.2.4 Prefix/suffix: |
39 | | class sentry; |
40 | | |
41 | | // 27.7.2.6 Formatted output: |
42 | | basic_ostream& operator<<(basic_ostream& (*pf)(basic_ostream&)); |
43 | | basic_ostream& operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT,traits>&)); |
44 | | basic_ostream& operator<<(ios_base& (*pf)(ios_base&)); |
45 | | basic_ostream& operator<<(bool n); |
46 | | basic_ostream& operator<<(short n); |
47 | | basic_ostream& operator<<(unsigned short n); |
48 | | basic_ostream& operator<<(int n); |
49 | | basic_ostream& operator<<(unsigned int n); |
50 | | basic_ostream& operator<<(long n); |
51 | | basic_ostream& operator<<(unsigned long n); |
52 | | basic_ostream& operator<<(long long n); |
53 | | basic_ostream& operator<<(unsigned long long n); |
54 | | basic_ostream& operator<<(float f); |
55 | | basic_ostream& operator<<(double f); |
56 | | basic_ostream& operator<<(long double f); |
57 | | basic_ostream& operator<<(const void* p); |
58 | | basic_ostream& operator<<(const volatile void* val); // C++23 |
59 | | basic_ostream& operator<<(basic_streambuf<char_type,traits>* sb); |
60 | | basic_ostream& operator<<(nullptr_t); |
61 | | |
62 | | // 27.7.2.7 Unformatted output: |
63 | | basic_ostream& put(char_type c); |
64 | | basic_ostream& write(const char_type* s, streamsize n); |
65 | | basic_ostream& flush(); |
66 | | |
67 | | // 27.7.2.5 seeks: |
68 | | pos_type tellp(); |
69 | | basic_ostream& seekp(pos_type); |
70 | | basic_ostream& seekp(off_type, ios_base::seekdir); |
71 | | protected: |
72 | | basic_ostream(const basic_ostream& rhs) = delete; |
73 | | basic_ostream(basic_ostream&& rhs); |
74 | | // 27.7.3.3 Assign/swap |
75 | | basic_ostream& operator=(basic_ostream& rhs) = delete; |
76 | | basic_ostream& operator=(const basic_ostream&& rhs); |
77 | | void swap(basic_ostream& rhs); |
78 | | }; |
79 | | |
80 | | // 27.7.2.6.4 character inserters |
81 | | |
82 | | template<class charT, class traits> |
83 | | basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, charT); |
84 | | |
85 | | template<class charT, class traits> |
86 | | basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, char); |
87 | | |
88 | | template<class traits> |
89 | | basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, char); |
90 | | |
91 | | // signed and unsigned |
92 | | |
93 | | template<class traits> |
94 | | basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, signed char); |
95 | | |
96 | | template<class traits> |
97 | | basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, unsigned char); |
98 | | |
99 | | // NTBS |
100 | | template<class charT, class traits> |
101 | | basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, const charT*); |
102 | | |
103 | | template<class charT, class traits> |
104 | | basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, const char*); |
105 | | |
106 | | template<class traits> |
107 | | basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const char*); |
108 | | |
109 | | // signed and unsigned |
110 | | template<class traits> |
111 | | basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const signed char*); |
112 | | |
113 | | template<class traits> |
114 | | basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const unsigned char*); |
115 | | |
116 | | // swap: |
117 | | template <class charT, class traits> |
118 | | void swap(basic_ostream<charT, traits>& x, basic_ostream<charT, traits>& y); |
119 | | |
120 | | template <class charT, class traits> |
121 | | basic_ostream<charT,traits>& endl(basic_ostream<charT,traits>& os); |
122 | | |
123 | | template <class charT, class traits> |
124 | | basic_ostream<charT,traits>& ends(basic_ostream<charT,traits>& os); |
125 | | |
126 | | template <class charT, class traits> |
127 | | basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os); |
128 | | |
129 | | // rvalue stream insertion |
130 | | template <class Stream, class T> |
131 | | Stream&& operator<<(Stream&& os, const T& x); |
132 | | |
133 | | template<class traits> |
134 | | basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, wchar_t) = delete; // since C++20 |
135 | | template<class traits> |
136 | | basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char8_t) = delete; // since C++20 |
137 | | template<class traits> |
138 | | basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char16_t) = delete; // since C++20 |
139 | | template<class traits> |
140 | | basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char32_t) = delete; // since C++20 |
141 | | template<class traits> |
142 | | basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, char8_t) = delete; // since C++20 |
143 | | template<class traits> |
144 | | basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, char16_t) = delete; // since C++20 |
145 | | template<class traits> |
146 | | basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, char32_t) = delete; // since C++20 |
147 | | template<class traits> |
148 | | basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const wchar_t*) = delete; // since C++20 |
149 | | template<class traits> |
150 | | basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const char8_t*) = delete; // since C++20 |
151 | | template<class traits> |
152 | | basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const char16_t*) = delete; // since C++20 |
153 | | template<class traits> |
154 | | basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const char32_t*) = delete; // since C++20 |
155 | | template<class traits> |
156 | | basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char8_t*) = delete; // since C++20 |
157 | | template<class traits> |
158 | | basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char16_t*) = delete; // since C++20 |
159 | | template<class traits> |
160 | | basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char32_t*) = delete; // since C++20 |
161 | | |
162 | | } // std |
163 | | |
164 | | */ |
165 | | |
166 | | #include <__assert> // all public C++ headers provide the assertion handler |
167 | | #include <__config> |
168 | | #include <__memory/shared_ptr.h> |
169 | | #include <__memory/unique_ptr.h> |
170 | | #include <bitset> |
171 | | #include <ios> |
172 | | #include <locale> |
173 | | #include <new> |
174 | | #include <streambuf> |
175 | | #include <version> |
176 | | |
177 | | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
178 | | # pragma GCC system_header |
179 | | #endif |
180 | | |
181 | | _LIBCPP_BEGIN_NAMESPACE_STD |
182 | | |
183 | | template <class _CharT, class _Traits> |
184 | | class _LIBCPP_TEMPLATE_VIS basic_ostream |
185 | | : virtual public basic_ios<_CharT, _Traits> |
186 | | { |
187 | | public: |
188 | | // types (inherited from basic_ios (27.5.4)): |
189 | | typedef _CharT char_type; |
190 | | typedef _Traits traits_type; |
191 | | typedef typename traits_type::int_type int_type; |
192 | | typedef typename traits_type::pos_type pos_type; |
193 | | typedef typename traits_type::off_type off_type; |
194 | | |
195 | | // 27.7.2.2 Constructor/destructor: |
196 | | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
197 | | explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) |
198 | 0 | { this->init(__sb); } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::basic_ostream(std::__1::basic_streambuf<char, std::__1::char_traits<char> >*) Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::basic_ostream(std::__1::basic_streambuf<char, std::__1::char_traits<char> >*) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::basic_ostream(std::__1::basic_streambuf<wchar_t, std::__1::char_traits<wchar_t> >*) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::basic_ostream(std::__1::basic_streambuf<wchar_t, std::__1::char_traits<wchar_t> >*) |
199 | | ~basic_ostream() override; |
200 | | protected: |
201 | | inline _LIBCPP_INLINE_VISIBILITY |
202 | | basic_ostream(basic_ostream&& __rhs); |
203 | | |
204 | | // 27.7.2.3 Assign/swap |
205 | | inline _LIBCPP_INLINE_VISIBILITY |
206 | | basic_ostream& operator=(basic_ostream&& __rhs); |
207 | | |
208 | | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
209 | | void swap(basic_ostream& __rhs) |
210 | 0 | { basic_ios<char_type, traits_type>::swap(__rhs); } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::swap(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::swap(std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >&) |
211 | | |
212 | | basic_ostream (const basic_ostream& __rhs) = delete; |
213 | | basic_ostream& operator=(const basic_ostream& __rhs) = delete; |
214 | | |
215 | | public: |
216 | | // 27.7.2.4 Prefix/suffix: |
217 | | class _LIBCPP_TEMPLATE_VIS sentry; |
218 | | |
219 | | // 27.7.2.6 Formatted output: |
220 | | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
221 | | basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)) |
222 | 0 | { return __pf(*this); } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >& (*)(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >& (*)(std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >&)) |
223 | | |
224 | | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
225 | | basic_ostream& operator<<(basic_ios<char_type, traits_type>& |
226 | | (*__pf)(basic_ios<char_type,traits_type>&)) |
227 | 0 | { __pf(*this); return *this; } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::__1::basic_ios<char, std::__1::char_traits<char> >& (*)(std::__1::basic_ios<char, std::__1::char_traits<char> >&)) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >& (*)(std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >&)) |
228 | | |
229 | | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
230 | | basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)) |
231 | 0 | { __pf(*this); return *this; } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::__1::ios_base& (*)(std::__1::ios_base&)) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(std::__1::ios_base& (*)(std::__1::ios_base&)) |
232 | | |
233 | | basic_ostream& operator<<(bool __n); |
234 | | basic_ostream& operator<<(short __n); |
235 | | basic_ostream& operator<<(unsigned short __n); |
236 | | basic_ostream& operator<<(int __n); |
237 | | basic_ostream& operator<<(unsigned int __n); |
238 | | basic_ostream& operator<<(long __n); |
239 | | basic_ostream& operator<<(unsigned long __n); |
240 | | basic_ostream& operator<<(long long __n); |
241 | | basic_ostream& operator<<(unsigned long long __n); |
242 | | basic_ostream& operator<<(float __f); |
243 | | basic_ostream& operator<<(double __f); |
244 | | basic_ostream& operator<<(long double __f); |
245 | | basic_ostream& operator<<(const void* __p); |
246 | | |
247 | | #if _LIBCPP_STD_VER > 20 |
248 | | _LIBCPP_HIDE_FROM_ABI |
249 | | basic_ostream& operator<<(const volatile void* __p) { |
250 | | return operator<<(const_cast<const void*>(__p)); |
251 | | } |
252 | | #endif |
253 | | |
254 | | basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb); |
255 | | |
256 | | #if _LIBCPP_STD_VER > 14 |
257 | | // LWG 2221 - nullptr. This is not backported to older standards modes. |
258 | | // See https://reviews.llvm.org/D127033 for more info on the rationale. |
259 | | _LIBCPP_INLINE_VISIBILITY |
260 | | basic_ostream& operator<<(nullptr_t) |
261 | | { return *this << "nullptr"; } |
262 | | #endif |
263 | | |
264 | | // 27.7.2.7 Unformatted output: |
265 | | basic_ostream& put(char_type __c); |
266 | | basic_ostream& write(const char_type* __s, streamsize __n); |
267 | | basic_ostream& flush(); |
268 | | |
269 | | // 27.7.2.5 seeks: |
270 | | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
271 | | pos_type tellp(); |
272 | | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
273 | | basic_ostream& seekp(pos_type __pos); |
274 | | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
275 | | basic_ostream& seekp(off_type __off, ios_base::seekdir __dir); |
276 | | |
277 | | protected: |
278 | | _LIBCPP_INLINE_VISIBILITY |
279 | 0 | basic_ostream() {} // extension, intentially does not initialize |
280 | | }; |
281 | | |
282 | | template <class _CharT, class _Traits> |
283 | | class _LIBCPP_TEMPLATE_VIS basic_ostream<_CharT, _Traits>::sentry |
284 | | { |
285 | | bool __ok_; |
286 | | basic_ostream<_CharT, _Traits>& __os_; |
287 | | |
288 | | public: |
289 | | explicit sentry(basic_ostream<_CharT, _Traits>& __os); |
290 | | ~sentry(); |
291 | | sentry(const sentry&) = delete; |
292 | | sentry& operator=(const sentry&) = delete; |
293 | | |
294 | | _LIBCPP_INLINE_VISIBILITY |
295 | 9.48k | explicit operator bool() const {return __ok_;} std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::operator bool[abi:v160006]() const Line | Count | Source | 295 | 9.48k | explicit operator bool() const {return __ok_;} |
Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::sentry::operator bool[abi:v160006]() const |
296 | | }; |
297 | | |
298 | | template <class _CharT, class _Traits> |
299 | | basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os) |
300 | | : __ok_(false), |
301 | | __os_(__os) |
302 | 9.48k | { |
303 | 9.48k | if (__os.good()) |
304 | 9.48k | { |
305 | 9.48k | if (__os.tie()) |
306 | 0 | __os.tie()->flush(); |
307 | 9.48k | __ok_ = true; |
308 | 9.48k | } |
309 | 9.48k | } std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) Line | Count | Source | 302 | 9.48k | { | 303 | 9.48k | if (__os.good()) | 304 | 9.48k | { | 305 | 9.48k | if (__os.tie()) | 306 | 0 | __os.tie()->flush(); | 307 | 9.48k | __ok_ = true; | 308 | 9.48k | } | 309 | 9.48k | } |
Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::sentry::sentry(std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >&) |
310 | | |
311 | | template <class _CharT, class _Traits> |
312 | | basic_ostream<_CharT, _Traits>::sentry::~sentry() |
313 | 9.48k | { |
314 | 9.48k | if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) |
315 | 9.48k | && !uncaught_exception()) |
316 | 0 | { |
317 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
318 | 0 | try |
319 | 0 | { |
320 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
321 | 0 | if (__os_.rdbuf()->pubsync() == -1) |
322 | 0 | __os_.setstate(ios_base::badbit); |
323 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
324 | 0 | } |
325 | 0 | catch (...) |
326 | 0 | { |
327 | 0 | } |
328 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
329 | 0 | } |
330 | 9.48k | } std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry() Line | Count | Source | 313 | 9.48k | { | 314 | 9.48k | if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) | 315 | 9.48k | && !uncaught_exception()) | 316 | 0 | { | 317 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS | 318 | 0 | try | 319 | 0 | { | 320 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS | 321 | 0 | if (__os_.rdbuf()->pubsync() == -1) | 322 | 0 | __os_.setstate(ios_base::badbit); | 323 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS | 324 | 0 | } | 325 | 0 | catch (...) | 326 | 0 | { | 327 | 0 | } | 328 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS | 329 | 0 | } | 330 | 9.48k | } |
Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::sentry::~sentry() |
331 | | |
332 | | template <class _CharT, class _Traits> |
333 | | basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) |
334 | | { |
335 | | this->move(__rhs); |
336 | | } |
337 | | |
338 | | template <class _CharT, class _Traits> |
339 | | basic_ostream<_CharT, _Traits>& |
340 | | basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) |
341 | 0 | { |
342 | 0 | swap(__rhs); |
343 | 0 | return *this; |
344 | 0 | } |
345 | | |
346 | | template <class _CharT, class _Traits> |
347 | | basic_ostream<_CharT, _Traits>::~basic_ostream() |
348 | 3.60k | { |
349 | 3.60k | } std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream() Line | Count | Source | 348 | 3.60k | { | 349 | 3.60k | } |
Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::~basic_ostream() |
350 | | |
351 | | template <class _CharT, class _Traits> |
352 | | basic_ostream<_CharT, _Traits>& |
353 | | basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) |
354 | 0 | { |
355 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
356 | 0 | try |
357 | 0 | { |
358 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
359 | 0 | sentry __s(*this); |
360 | 0 | if (__s) |
361 | 0 | { |
362 | 0 | if (__sb) |
363 | 0 | { |
364 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
365 | 0 | try |
366 | 0 | { |
367 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
368 | 0 | typedef istreambuf_iterator<_CharT, _Traits> _Ip; |
369 | 0 | typedef ostreambuf_iterator<_CharT, _Traits> _Op; |
370 | 0 | _Ip __i(__sb); |
371 | 0 | _Ip __eof; |
372 | 0 | _Op __o(*this); |
373 | 0 | size_t __c = 0; |
374 | 0 | for (; __i != __eof; ++__i, ++__o, ++__c) |
375 | 0 | { |
376 | 0 | *__o = *__i; |
377 | 0 | if (__o.failed()) |
378 | 0 | break; |
379 | 0 | } |
380 | 0 | if (__c == 0) |
381 | 0 | this->setstate(ios_base::failbit); |
382 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
383 | 0 | } |
384 | 0 | catch (...) |
385 | 0 | { |
386 | 0 | this->__set_failbit_and_consider_rethrow(); |
387 | 0 | } |
388 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
389 | 0 | } |
390 | 0 | else |
391 | 0 | this->setstate(ios_base::badbit); |
392 | 0 | } |
393 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
394 | 0 | } |
395 | 0 | catch (...) |
396 | 0 | { |
397 | 0 | this->__set_badbit_and_consider_rethrow(); |
398 | 0 | } |
399 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
400 | 0 | return *this; |
401 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::__1::basic_streambuf<char, std::__1::char_traits<char> >*) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(std::__1::basic_streambuf<wchar_t, std::__1::char_traits<wchar_t> >*) |
402 | | |
403 | | template <class _CharT, class _Traits> |
404 | | basic_ostream<_CharT, _Traits>& |
405 | | basic_ostream<_CharT, _Traits>::operator<<(bool __n) |
406 | 0 | { |
407 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
408 | 0 | try |
409 | 0 | { |
410 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
411 | 0 | sentry __s(*this); |
412 | 0 | if (__s) |
413 | 0 | { |
414 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
415 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
416 | 0 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
417 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
418 | 0 | } |
419 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
420 | 0 | } |
421 | 0 | catch (...) |
422 | 0 | { |
423 | 0 | this->__set_badbit_and_consider_rethrow(); |
424 | 0 | } |
425 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
426 | 0 | return *this; |
427 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(bool) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(bool) |
428 | | |
429 | | template <class _CharT, class _Traits> |
430 | | basic_ostream<_CharT, _Traits>& |
431 | | basic_ostream<_CharT, _Traits>::operator<<(short __n) |
432 | 0 | { |
433 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
434 | 0 | try |
435 | 0 | { |
436 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
437 | 0 | sentry __s(*this); |
438 | 0 | if (__s) |
439 | 0 | { |
440 | 0 | ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; |
441 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
442 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
443 | 0 | if (__f.put(*this, *this, this->fill(), |
444 | 0 | __flags == ios_base::oct || __flags == ios_base::hex ? |
445 | 0 | static_cast<long>(static_cast<unsigned short>(__n)) : |
446 | 0 | static_cast<long>(__n)).failed()) |
447 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
448 | 0 | } |
449 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
450 | 0 | } |
451 | 0 | catch (...) |
452 | 0 | { |
453 | 0 | this->__set_badbit_and_consider_rethrow(); |
454 | 0 | } |
455 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
456 | 0 | return *this; |
457 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(short) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(short) |
458 | | |
459 | | template <class _CharT, class _Traits> |
460 | | basic_ostream<_CharT, _Traits>& |
461 | | basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) |
462 | 0 | { |
463 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
464 | 0 | try |
465 | 0 | { |
466 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
467 | 0 | sentry __s(*this); |
468 | 0 | if (__s) |
469 | 0 | { |
470 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
471 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
472 | 0 | if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) |
473 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
474 | 0 | } |
475 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
476 | 0 | } |
477 | 0 | catch (...) |
478 | 0 | { |
479 | 0 | this->__set_badbit_and_consider_rethrow(); |
480 | 0 | } |
481 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
482 | 0 | return *this; |
483 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(unsigned short) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(unsigned short) |
484 | | |
485 | | template <class _CharT, class _Traits> |
486 | | basic_ostream<_CharT, _Traits>& |
487 | | basic_ostream<_CharT, _Traits>::operator<<(int __n) |
488 | 0 | { |
489 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
490 | 0 | try |
491 | 0 | { |
492 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
493 | 0 | sentry __s(*this); |
494 | 0 | if (__s) |
495 | 0 | { |
496 | 0 | ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; |
497 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
498 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
499 | 0 | if (__f.put(*this, *this, this->fill(), |
500 | 0 | __flags == ios_base::oct || __flags == ios_base::hex ? |
501 | 0 | static_cast<long>(static_cast<unsigned int>(__n)) : |
502 | 0 | static_cast<long>(__n)).failed()) |
503 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
504 | 0 | } |
505 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
506 | 0 | } |
507 | 0 | catch (...) |
508 | 0 | { |
509 | 0 | this->__set_badbit_and_consider_rethrow(); |
510 | 0 | } |
511 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
512 | 0 | return *this; |
513 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(int) |
514 | | |
515 | | template <class _CharT, class _Traits> |
516 | | basic_ostream<_CharT, _Traits>& |
517 | | basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) |
518 | 3.74k | { |
519 | 3.74k | #ifndef _LIBCPP_NO_EXCEPTIONS |
520 | 3.74k | try |
521 | 3.74k | { |
522 | 3.74k | #endif // _LIBCPP_NO_EXCEPTIONS |
523 | 3.74k | sentry __s(*this); |
524 | 3.74k | if (__s) |
525 | 3.74k | { |
526 | 3.74k | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
527 | 3.74k | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
528 | 3.74k | if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) |
529 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
530 | 3.74k | } |
531 | 3.74k | #ifndef _LIBCPP_NO_EXCEPTIONS |
532 | 3.74k | } |
533 | 3.74k | catch (...) |
534 | 3.74k | { |
535 | 0 | this->__set_badbit_and_consider_rethrow(); |
536 | 0 | } |
537 | 3.74k | #endif // _LIBCPP_NO_EXCEPTIONS |
538 | 3.74k | return *this; |
539 | 3.74k | } std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(unsigned int) Line | Count | Source | 518 | 3.74k | { | 519 | 3.74k | #ifndef _LIBCPP_NO_EXCEPTIONS | 520 | 3.74k | try | 521 | 3.74k | { | 522 | 3.74k | #endif // _LIBCPP_NO_EXCEPTIONS | 523 | 3.74k | sentry __s(*this); | 524 | 3.74k | if (__s) | 525 | 3.74k | { | 526 | 3.74k | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; | 527 | 3.74k | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); | 528 | 3.74k | if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) | 529 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); | 530 | 3.74k | } | 531 | 3.74k | #ifndef _LIBCPP_NO_EXCEPTIONS | 532 | 3.74k | } | 533 | 3.74k | catch (...) | 534 | 3.74k | { | 535 | 0 | this->__set_badbit_and_consider_rethrow(); | 536 | 0 | } | 537 | 3.74k | #endif // _LIBCPP_NO_EXCEPTIONS | 538 | 3.74k | return *this; | 539 | 3.74k | } |
Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(unsigned int) |
540 | | |
541 | | template <class _CharT, class _Traits> |
542 | | basic_ostream<_CharT, _Traits>& |
543 | | basic_ostream<_CharT, _Traits>::operator<<(long __n) |
544 | 0 | { |
545 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
546 | 0 | try |
547 | 0 | { |
548 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
549 | 0 | sentry __s(*this); |
550 | 0 | if (__s) |
551 | 0 | { |
552 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
553 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
554 | 0 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
555 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
556 | 0 | } |
557 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
558 | 0 | } |
559 | 0 | catch (...) |
560 | 0 | { |
561 | 0 | this->__set_badbit_and_consider_rethrow(); |
562 | 0 | } |
563 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
564 | 0 | return *this; |
565 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(long) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(long) |
566 | | |
567 | | template <class _CharT, class _Traits> |
568 | | basic_ostream<_CharT, _Traits>& |
569 | | basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) |
570 | 0 | { |
571 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
572 | 0 | try |
573 | 0 | { |
574 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
575 | 0 | sentry __s(*this); |
576 | 0 | if (__s) |
577 | 0 | { |
578 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
579 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
580 | 0 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
581 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
582 | 0 | } |
583 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
584 | 0 | } |
585 | 0 | catch (...) |
586 | 0 | { |
587 | 0 | this->__set_badbit_and_consider_rethrow(); |
588 | 0 | } |
589 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
590 | 0 | return *this; |
591 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(unsigned long) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(unsigned long) |
592 | | |
593 | | template <class _CharT, class _Traits> |
594 | | basic_ostream<_CharT, _Traits>& |
595 | | basic_ostream<_CharT, _Traits>::operator<<(long long __n) |
596 | 0 | { |
597 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
598 | 0 | try |
599 | 0 | { |
600 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
601 | 0 | sentry __s(*this); |
602 | 0 | if (__s) |
603 | 0 | { |
604 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
605 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
606 | 0 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
607 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
608 | 0 | } |
609 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
610 | 0 | } |
611 | 0 | catch (...) |
612 | 0 | { |
613 | 0 | this->__set_badbit_and_consider_rethrow(); |
614 | 0 | } |
615 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
616 | 0 | return *this; |
617 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(long long) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(long long) |
618 | | |
619 | | template <class _CharT, class _Traits> |
620 | | basic_ostream<_CharT, _Traits>& |
621 | | basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) |
622 | 0 | { |
623 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
624 | 0 | try |
625 | 0 | { |
626 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
627 | 0 | sentry __s(*this); |
628 | 0 | if (__s) |
629 | 0 | { |
630 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
631 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
632 | 0 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
633 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
634 | 0 | } |
635 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
636 | 0 | } |
637 | 0 | catch (...) |
638 | 0 | { |
639 | 0 | this->__set_badbit_and_consider_rethrow(); |
640 | 0 | } |
641 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
642 | 0 | return *this; |
643 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(unsigned long long) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(unsigned long long) |
644 | | |
645 | | template <class _CharT, class _Traits> |
646 | | basic_ostream<_CharT, _Traits>& |
647 | | basic_ostream<_CharT, _Traits>::operator<<(float __n) |
648 | 0 | { |
649 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
650 | 0 | try |
651 | 0 | { |
652 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
653 | 0 | sentry __s(*this); |
654 | 0 | if (__s) |
655 | 0 | { |
656 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
657 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
658 | 0 | if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) |
659 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
660 | 0 | } |
661 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
662 | 0 | } |
663 | 0 | catch (...) |
664 | 0 | { |
665 | 0 | this->__set_badbit_and_consider_rethrow(); |
666 | 0 | } |
667 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
668 | 0 | return *this; |
669 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(float) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(float) |
670 | | |
671 | | template <class _CharT, class _Traits> |
672 | | basic_ostream<_CharT, _Traits>& |
673 | | basic_ostream<_CharT, _Traits>::operator<<(double __n) |
674 | 0 | { |
675 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
676 | 0 | try |
677 | 0 | { |
678 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
679 | 0 | sentry __s(*this); |
680 | 0 | if (__s) |
681 | 0 | { |
682 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
683 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
684 | 0 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
685 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
686 | 0 | } |
687 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
688 | 0 | } |
689 | 0 | catch (...) |
690 | 0 | { |
691 | 0 | this->__set_badbit_and_consider_rethrow(); |
692 | 0 | } |
693 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
694 | 0 | return *this; |
695 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(double) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(double) |
696 | | |
697 | | template <class _CharT, class _Traits> |
698 | | basic_ostream<_CharT, _Traits>& |
699 | | basic_ostream<_CharT, _Traits>::operator<<(long double __n) |
700 | 0 | { |
701 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
702 | 0 | try |
703 | 0 | { |
704 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
705 | 0 | sentry __s(*this); |
706 | 0 | if (__s) |
707 | 0 | { |
708 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
709 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
710 | 0 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
711 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
712 | 0 | } |
713 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
714 | 0 | } |
715 | 0 | catch (...) |
716 | 0 | { |
717 | 0 | this->__set_badbit_and_consider_rethrow(); |
718 | 0 | } |
719 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
720 | 0 | return *this; |
721 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(long double) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(long double) |
722 | | |
723 | | template <class _CharT, class _Traits> |
724 | | basic_ostream<_CharT, _Traits>& |
725 | | basic_ostream<_CharT, _Traits>::operator<<(const void* __n) |
726 | 0 | { |
727 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
728 | 0 | try |
729 | 0 | { |
730 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
731 | 0 | sentry __s(*this); |
732 | 0 | if (__s) |
733 | 0 | { |
734 | 0 | typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; |
735 | 0 | const _Fp& __f = std::use_facet<_Fp>(this->getloc()); |
736 | 0 | if (__f.put(*this, *this, this->fill(), __n).failed()) |
737 | 0 | this->setstate(ios_base::badbit | ios_base::failbit); |
738 | 0 | } |
739 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
740 | 0 | } |
741 | 0 | catch (...) |
742 | 0 | { |
743 | 0 | this->__set_badbit_and_consider_rethrow(); |
744 | 0 | } |
745 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
746 | 0 | return *this; |
747 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::operator<<(void const*) |
748 | | |
749 | | template<class _CharT, class _Traits> |
750 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& |
751 | | __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, |
752 | | const _CharT* __str, size_t __len) |
753 | | { |
754 | | #ifndef _LIBCPP_NO_EXCEPTIONS |
755 | | try |
756 | | { |
757 | | #endif // _LIBCPP_NO_EXCEPTIONS |
758 | | typename basic_ostream<_CharT, _Traits>::sentry __s(__os); |
759 | | if (__s) |
760 | | { |
761 | | typedef ostreambuf_iterator<_CharT, _Traits> _Ip; |
762 | | if (std::__pad_and_output(_Ip(__os), |
763 | | __str, |
764 | | (__os.flags() & ios_base::adjustfield) == ios_base::left ? |
765 | | __str + __len : |
766 | | __str, |
767 | | __str + __len, |
768 | | __os, |
769 | | __os.fill()).failed()) |
770 | | __os.setstate(ios_base::badbit | ios_base::failbit); |
771 | | } |
772 | | #ifndef _LIBCPP_NO_EXCEPTIONS |
773 | | } |
774 | | catch (...) |
775 | | { |
776 | | __os.__set_badbit_and_consider_rethrow(); |
777 | | } |
778 | | #endif // _LIBCPP_NO_EXCEPTIONS |
779 | | return __os; |
780 | | } |
781 | | |
782 | | |
783 | | template<class _CharT, class _Traits> |
784 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& |
785 | | operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) |
786 | | { |
787 | | return _VSTD::__put_character_sequence(__os, &__c, 1); |
788 | | } |
789 | | |
790 | | template<class _CharT, class _Traits> |
791 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& |
792 | | operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) |
793 | | { |
794 | | #ifndef _LIBCPP_NO_EXCEPTIONS |
795 | | try |
796 | | { |
797 | | #endif // _LIBCPP_NO_EXCEPTIONS |
798 | | typename basic_ostream<_CharT, _Traits>::sentry __s(__os); |
799 | | if (__s) |
800 | | { |
801 | | _CharT __c = __os.widen(__cn); |
802 | | typedef ostreambuf_iterator<_CharT, _Traits> _Ip; |
803 | | if (std::__pad_and_output(_Ip(__os), |
804 | | &__c, |
805 | | (__os.flags() & ios_base::adjustfield) == ios_base::left ? |
806 | | &__c + 1 : |
807 | | &__c, |
808 | | &__c + 1, |
809 | | __os, |
810 | | __os.fill()).failed()) |
811 | | __os.setstate(ios_base::badbit | ios_base::failbit); |
812 | | } |
813 | | #ifndef _LIBCPP_NO_EXCEPTIONS |
814 | | } |
815 | | catch (...) |
816 | | { |
817 | | __os.__set_badbit_and_consider_rethrow(); |
818 | | } |
819 | | #endif // _LIBCPP_NO_EXCEPTIONS |
820 | | return __os; |
821 | | } |
822 | | |
823 | | template<class _Traits> |
824 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& |
825 | | operator<<(basic_ostream<char, _Traits>& __os, char __c) |
826 | | { |
827 | | return _VSTD::__put_character_sequence(__os, &__c, 1); |
828 | | } |
829 | | |
830 | | template<class _Traits> |
831 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& |
832 | | operator<<(basic_ostream<char, _Traits>& __os, signed char __c) |
833 | | { |
834 | | return _VSTD::__put_character_sequence(__os, (char *) &__c, 1); |
835 | | } |
836 | | |
837 | | template<class _Traits> |
838 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& |
839 | | operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) |
840 | | { |
841 | | return _VSTD::__put_character_sequence(__os, (char *) &__c, 1); |
842 | | } |
843 | | |
844 | | template<class _CharT, class _Traits> |
845 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& |
846 | | operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) |
847 | | { |
848 | | return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str)); |
849 | | } |
850 | | |
851 | | template<class _CharT, class _Traits> |
852 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& |
853 | | operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) |
854 | | { |
855 | | #ifndef _LIBCPP_NO_EXCEPTIONS |
856 | | try |
857 | | { |
858 | | #endif // _LIBCPP_NO_EXCEPTIONS |
859 | | typename basic_ostream<_CharT, _Traits>::sentry __s(__os); |
860 | | if (__s) |
861 | | { |
862 | | typedef ostreambuf_iterator<_CharT, _Traits> _Ip; |
863 | | size_t __len = char_traits<char>::length(__strn); |
864 | | const int __bs = 100; |
865 | | _CharT __wbb[__bs]; |
866 | | _CharT* __wb = __wbb; |
867 | | unique_ptr<_CharT, void(*)(void*)> __h(0, free); |
868 | | if (__len > __bs) |
869 | | { |
870 | | __wb = (_CharT*)malloc(__len*sizeof(_CharT)); |
871 | | if (__wb == 0) |
872 | | __throw_bad_alloc(); |
873 | | __h.reset(__wb); |
874 | | } |
875 | | for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) |
876 | | *__p = __os.widen(*__strn); |
877 | | if (std::__pad_and_output(_Ip(__os), |
878 | | __wb, |
879 | | (__os.flags() & ios_base::adjustfield) == ios_base::left ? |
880 | | __wb + __len : |
881 | | __wb, |
882 | | __wb + __len, |
883 | | __os, |
884 | | __os.fill()).failed()) |
885 | | __os.setstate(ios_base::badbit | ios_base::failbit); |
886 | | } |
887 | | #ifndef _LIBCPP_NO_EXCEPTIONS |
888 | | } |
889 | | catch (...) |
890 | | { |
891 | | __os.__set_badbit_and_consider_rethrow(); |
892 | | } |
893 | | #endif // _LIBCPP_NO_EXCEPTIONS |
894 | | return __os; |
895 | | } |
896 | | |
897 | | template<class _Traits> |
898 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& |
899 | | operator<<(basic_ostream<char, _Traits>& __os, const char* __str) |
900 | | { |
901 | | return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str)); |
902 | | } |
903 | | |
904 | | template<class _Traits> |
905 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& |
906 | | operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str) |
907 | | { |
908 | | const char *__s = (const char *) __str; |
909 | | return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s)); |
910 | | } |
911 | | |
912 | | template<class _Traits> |
913 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& |
914 | | operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) |
915 | | { |
916 | | const char *__s = (const char *) __str; |
917 | | return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s)); |
918 | | } |
919 | | |
920 | | template <class _CharT, class _Traits> |
921 | | basic_ostream<_CharT, _Traits>& |
922 | | basic_ostream<_CharT, _Traits>::put(char_type __c) |
923 | 0 | { |
924 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
925 | 0 | try |
926 | 0 | { |
927 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
928 | 0 | sentry __s(*this); |
929 | 0 | if (__s) |
930 | 0 | { |
931 | 0 | typedef ostreambuf_iterator<_CharT, _Traits> _Op; |
932 | 0 | _Op __o(*this); |
933 | 0 | *__o = __c; |
934 | 0 | if (__o.failed()) |
935 | 0 | this->setstate(ios_base::badbit); |
936 | 0 | } |
937 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
938 | 0 | } |
939 | 0 | catch (...) |
940 | 0 | { |
941 | 0 | this->__set_badbit_and_consider_rethrow(); |
942 | 0 | } |
943 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
944 | 0 | return *this; |
945 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::put(wchar_t) |
946 | | |
947 | | template <class _CharT, class _Traits> |
948 | | basic_ostream<_CharT, _Traits>& |
949 | | basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) |
950 | 0 | { |
951 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
952 | 0 | try |
953 | 0 | { |
954 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
955 | 0 | sentry __sen(*this); |
956 | 0 | if (__sen && __n) |
957 | 0 | { |
958 | 0 | if (this->rdbuf()->sputn(__s, __n) != __n) |
959 | 0 | this->setstate(ios_base::badbit); |
960 | 0 | } |
961 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
962 | 0 | } |
963 | 0 | catch (...) |
964 | 0 | { |
965 | 0 | this->__set_badbit_and_consider_rethrow(); |
966 | 0 | } |
967 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
968 | 0 | return *this; |
969 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::write(char const*, long) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::write(wchar_t const*, long) |
970 | | |
971 | | template <class _CharT, class _Traits> |
972 | | basic_ostream<_CharT, _Traits>& |
973 | | basic_ostream<_CharT, _Traits>::flush() |
974 | 0 | { |
975 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
976 | 0 | try |
977 | 0 | { |
978 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
979 | 0 | if (this->rdbuf()) |
980 | 0 | { |
981 | 0 | sentry __s(*this); |
982 | 0 | if (__s) |
983 | 0 | { |
984 | 0 | if (this->rdbuf()->pubsync() == -1) |
985 | 0 | this->setstate(ios_base::badbit); |
986 | 0 | } |
987 | 0 | } |
988 | 0 | #ifndef _LIBCPP_NO_EXCEPTIONS |
989 | 0 | } |
990 | 0 | catch (...) |
991 | 0 | { |
992 | 0 | this->__set_badbit_and_consider_rethrow(); |
993 | 0 | } |
994 | 0 | #endif // _LIBCPP_NO_EXCEPTIONS |
995 | 0 | return *this; |
996 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush() Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::flush() |
997 | | |
998 | | template <class _CharT, class _Traits> |
999 | | typename basic_ostream<_CharT, _Traits>::pos_type |
1000 | | basic_ostream<_CharT, _Traits>::tellp() |
1001 | 0 | { |
1002 | 0 | if (this->fail()) |
1003 | 0 | return pos_type(-1); |
1004 | 0 | return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); |
1005 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::tellp() Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::tellp() |
1006 | | |
1007 | | template <class _CharT, class _Traits> |
1008 | | basic_ostream<_CharT, _Traits>& |
1009 | | basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) |
1010 | 0 | { |
1011 | 0 | sentry __s(*this); |
1012 | 0 | if (!this->fail()) |
1013 | 0 | { |
1014 | 0 | if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1)) |
1015 | 0 | this->setstate(ios_base::failbit); |
1016 | 0 | } |
1017 | 0 | return *this; |
1018 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::seekp(std::__1::fpos<__mbstate_t>) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::seekp(std::__1::fpos<__mbstate_t>) |
1019 | | |
1020 | | template <class _CharT, class _Traits> |
1021 | | basic_ostream<_CharT, _Traits>& |
1022 | | basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) |
1023 | 0 | { |
1024 | 0 | sentry __s(*this); |
1025 | 0 | if (!this->fail()) |
1026 | 0 | { |
1027 | 0 | if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1)) |
1028 | 0 | this->setstate(ios_base::failbit); |
1029 | 0 | } |
1030 | 0 | return *this; |
1031 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >::seekp(long long, std::__1::ios_base::seekdir) Unexecuted instantiation: std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::seekp(long long, std::__1::ios_base::seekdir) |
1032 | | |
1033 | | template <class _CharT, class _Traits> |
1034 | | _LIBCPP_HIDE_FROM_ABI inline |
1035 | | basic_ostream<_CharT, _Traits>& |
1036 | | endl(basic_ostream<_CharT, _Traits>& __os) |
1037 | | { |
1038 | | __os.put(__os.widen('\n')); |
1039 | | __os.flush(); |
1040 | | return __os; |
1041 | | } |
1042 | | |
1043 | | template <class _CharT, class _Traits> |
1044 | | _LIBCPP_HIDE_FROM_ABI inline |
1045 | | basic_ostream<_CharT, _Traits>& |
1046 | | ends(basic_ostream<_CharT, _Traits>& __os) |
1047 | | { |
1048 | | __os.put(_CharT()); |
1049 | | return __os; |
1050 | | } |
1051 | | |
1052 | | template <class _CharT, class _Traits> |
1053 | | _LIBCPP_HIDE_FROM_ABI inline |
1054 | | basic_ostream<_CharT, _Traits>& |
1055 | | flush(basic_ostream<_CharT, _Traits>& __os) |
1056 | | { |
1057 | | __os.flush(); |
1058 | | return __os; |
1059 | | } |
1060 | | |
1061 | | template <class _Stream, class _Tp, class = void> |
1062 | | struct __is_ostreamable : false_type { }; |
1063 | | |
1064 | | template <class _Stream, class _Tp> |
1065 | | struct __is_ostreamable<_Stream, _Tp, decltype( |
1066 | | std::declval<_Stream>() << std::declval<_Tp>(), void() |
1067 | | )> : true_type { }; |
1068 | | |
1069 | | template <class _Stream, class _Tp, class = typename enable_if< |
1070 | | _And<is_base_of<ios_base, _Stream>, |
1071 | | __is_ostreamable<_Stream&, const _Tp&> >::value |
1072 | | >::type> |
1073 | | _LIBCPP_INLINE_VISIBILITY |
1074 | | _Stream&& operator<<(_Stream&& __os, const _Tp& __x) |
1075 | | { |
1076 | | __os << __x; |
1077 | | return _VSTD::move(__os); |
1078 | | } |
1079 | | |
1080 | | template<class _CharT, class _Traits, class _Allocator> |
1081 | | basic_ostream<_CharT, _Traits>& |
1082 | | operator<<(basic_ostream<_CharT, _Traits>& __os, |
1083 | | const basic_string<_CharT, _Traits, _Allocator>& __str) |
1084 | | { |
1085 | | return _VSTD::__put_character_sequence(__os, __str.data(), __str.size()); |
1086 | | } |
1087 | | |
1088 | | template<class _CharT, class _Traits> |
1089 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& |
1090 | | operator<<(basic_ostream<_CharT, _Traits>& __os, |
1091 | | basic_string_view<_CharT, _Traits> __sv) |
1092 | | { |
1093 | | return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size()); |
1094 | | } |
1095 | | |
1096 | | template <class _CharT, class _Traits> |
1097 | | inline _LIBCPP_INLINE_VISIBILITY |
1098 | | basic_ostream<_CharT, _Traits>& |
1099 | | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec) |
1100 | | { |
1101 | | return __os << __ec.category().name() << ':' << __ec.value(); |
1102 | | } |
1103 | | |
1104 | | template<class _CharT, class _Traits, class _Yp> |
1105 | | inline _LIBCPP_INLINE_VISIBILITY |
1106 | | basic_ostream<_CharT, _Traits>& |
1107 | | operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) |
1108 | | { |
1109 | | return __os << __p.get(); |
1110 | | } |
1111 | | |
1112 | | template<class _CharT, class _Traits, class _Yp, class _Dp> |
1113 | | inline _LIBCPP_INLINE_VISIBILITY |
1114 | | typename enable_if |
1115 | | < |
1116 | | is_same<void, __void_t<decltype((std::declval<basic_ostream<_CharT, _Traits>&>() << std::declval<typename unique_ptr<_Yp, _Dp>::pointer>()))> >::value, |
1117 | | basic_ostream<_CharT, _Traits>& |
1118 | | >::type |
1119 | | operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p) |
1120 | | { |
1121 | | return __os << __p.get(); |
1122 | | } |
1123 | | |
1124 | | template <class _CharT, class _Traits, size_t _Size> |
1125 | | _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& |
1126 | | operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) |
1127 | | { |
1128 | | return __os << __x.template to_string<_CharT, _Traits> |
1129 | | (std::use_facet<ctype<_CharT> >(__os.getloc()).widen('0'), |
1130 | | std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); |
1131 | | } |
1132 | | |
1133 | | #if _LIBCPP_STD_VER > 17 |
1134 | | |
1135 | | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
1136 | | template <class _Traits> |
1137 | | basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete; |
1138 | | |
1139 | | template <class _Traits> |
1140 | | basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const wchar_t*) = delete; |
1141 | | |
1142 | | template <class _Traits> |
1143 | | basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char16_t) = delete; |
1144 | | |
1145 | | template <class _Traits> |
1146 | | basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char32_t) = delete; |
1147 | | |
1148 | | template <class _Traits> |
1149 | | basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char16_t*) = delete; |
1150 | | |
1151 | | template <class _Traits> |
1152 | | basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete; |
1153 | | |
1154 | | #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS |
1155 | | |
1156 | | #ifndef _LIBCPP_HAS_NO_CHAR8_T |
1157 | | template <class _Traits> |
1158 | | basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char8_t) = delete; |
1159 | | |
1160 | | template <class _Traits> |
1161 | | basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char8_t) = delete; |
1162 | | |
1163 | | template <class _Traits> |
1164 | | basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char8_t*) = delete; |
1165 | | |
1166 | | template <class _Traits> |
1167 | | basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char8_t*) = delete; |
1168 | | #endif |
1169 | | |
1170 | | template <class _Traits> |
1171 | | basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char16_t) = delete; |
1172 | | |
1173 | | template <class _Traits> |
1174 | | basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char32_t) = delete; |
1175 | | |
1176 | | template <class _Traits> |
1177 | | basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char16_t*) = delete; |
1178 | | |
1179 | | template <class _Traits> |
1180 | | basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char32_t*) = delete; |
1181 | | |
1182 | | #endif // _LIBCPP_STD_VER > 17 |
1183 | | |
1184 | | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>; |
1185 | | #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
1186 | | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>; |
1187 | | #endif |
1188 | | |
1189 | | _LIBCPP_END_NAMESPACE_STD |
1190 | | |
1191 | | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 |
1192 | | # include <concepts> |
1193 | | # include <iterator> |
1194 | | # include <type_traits> |
1195 | | #endif |
1196 | | |
1197 | | #endif // _LIBCPP_OSTREAM |