33 #ifndef _GLIBCXX_OSTREAM_PRINT_H 34 #define _GLIBCXX_OSTREAM_PRINT_H 1 36 #ifdef _GLIBCXX_SYSHDR 37 #pragma GCC system_header 44 #ifdef __glibcxx_print // C++ >= 23 47 namespace std _GLIBCXX_VISIBILITY(default)
49 _GLIBCXX_BEGIN_NAMESPACE_VERSION
51 #ifdef _GLIBCXX_NO_INLINE_PRINT 52 # define _GLIBCXX_PRINT_INLINE_USED [[__gnu__::__used__]] 54 # define _GLIBCXX_PRINT_INLINE_USED 57 _GLIBCXX_PRINT_INLINE_USED
59 vprint_nonunicode(
ostream& __os, string_view __fmt, format_args __args)
61 ostream::sentry __cerb(__os);
64 __format::_Str_sink<char> __buf;
65 std::vformat_to(__buf.out(), __os.getloc(), __fmt, __args);
66 auto __out = __buf.view();
70 std::__ostream_write(__os, __out.data(), __out.size());
75 __throw_exception_again;
82 _GLIBCXX_PRINT_INLINE_USED
84 vprint_unicode(
ostream& __os, string_view __fmt, format_args __args)
86 #if !defined(_WIN32) || defined(__CYGWIN__) 89 std::vprint_nonunicode(__os, __fmt, __args);
91 ostream::sentry __cerb(__os);
94 __format::_Str_sink<char> __buf;
95 std::vformat_to(__buf.out(), __os.getloc(), __fmt, __args);
96 auto __out = __buf._M_span();
99 error_code __write_to_terminal(
void*, span<char>);
101 if (
auto __term = __open_terminal(__os.rdbuf()))
103 #if !defined(_WIN32) || defined(__CYGWIN__) 110 _Guard(
void* __p) : _M_f((FILE*)__p) { }
111 ~_Guard() { std::fclose(_M_f); }
112 _Guard(_Guard&&) =
delete;
113 _Guard& operator=(_Guard&&) =
delete;
122 if (__os.rdbuf()->pubsync() == -1)
124 else if (
auto __e = __write_to_terminal(__term, __out))
131 __throw_exception_again;
137 __os.setstate(__err);
144 std::__ostream_write(__os, __out.data(), __out.size());
149 __throw_exception_again;
156 #undef _GLIBCXX_PRINT_INLINE_USED 158 _GLIBCXX_END_NAMESPACE_VERSION
160 #endif // __glibcxx_print 161 #endif // _GLIBCXX_OSTREAM_PRINT_H static const iostate goodbit
Indicates all is well.
basic_streambuf< char > streambuf
Base class for char buffers.
_Ios_Iostate iostate
This is a bitmask type.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
Thrown as part of forced unwinding.A magic placeholder class that can be caught by reference to recog...
error_code make_error_code(future_errc __errc) noexcept
Overload of make_error_code for future_errc.
basic_ostream< char > ostream
Base class for char output streams.
ISO C++ entities toplevel namespace is std.