Go to the documentation of this file.
35 #define _OSTREAM_TCC 1
37 #ifdef _GLIBCXX_SYSHDR
38 #pragma GCC system_header
40 #pragma GCC diagnostic push
41 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
45 namespace std _GLIBCXX_VISIBILITY(default)
47 _GLIBCXX_BEGIN_NAMESPACE_VERSION
49 template<
typename _CharT,
typename _Traits>
52 : _M_ok(false), _M_os(__os)
55 if (__os.tie() && __os.good())
64 template<
typename _CharT,
typename _Traits>
65 template<
typename _ValueT>
76 #ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
80 = use_facet<__num_put_type>(this->_M_ios_locale);
82 if (__np.
put(*
this, *
this, this->fill(), __v).failed())
88 __throw_exception_again;
93 this->setstate(__err);
98 template<
typename _CharT,
typename _Traits>
99 basic_ostream<_CharT, _Traits>&
107 return _M_insert(
static_cast<long>(
static_cast<unsigned short>(__n)));
109 return _M_insert(
static_cast<long>(__n));
112 template<
typename _CharT,
typename _Traits>
121 return _M_insert(
static_cast<long>(
static_cast<unsigned int>(__n)));
123 return _M_insert(
static_cast<long>(__n));
126 template<
typename _CharT,
typename _Traits>
132 sentry __cerb(*
this);
133 if (__cerb && __sbin)
137 if (!__copy_streambufs(__sbin, this->rdbuf()))
143 __throw_exception_again;
151 this->setstate(__err);
155 template<
typename _CharT,
typename _Traits>
166 sentry __cerb(*
this);
172 const int_type __put = this->rdbuf()->sputc(__c);
173 if (traits_type::eq_int_type(__put, traits_type::eof()))
179 __throw_exception_again;
184 this->setstate(__err);
189 template<
typename _CharT,
typename _Traits>
201 sentry __cerb(*
this);
207 if (this->rdbuf()->sputn(__s, __n) != __n)
213 __throw_exception_again;
223 template<
typename _CharT,
typename _Traits>
235 sentry __cerb(*
this);
241 if (this->rdbuf()->pubsync() == -1)
247 __throw_exception_again;
252 this->setstate(__err);
258 template<
typename _CharT,
typename _Traits>
259 typename basic_ostream<_CharT, _Traits>::pos_type
263 sentry __cerb(*
this);
264 pos_type __ret = pos_type(-1);
270 template<
typename _CharT,
typename _Traits>
275 sentry __cerb(*
this);
280 const pos_type __p = this->rdbuf()->pubseekpos(__pos,
ios_base::out);
283 if (__p == pos_type(off_type(-1)))
289 template<
typename _CharT,
typename _Traits>
292 seekp(off_type __off, ios_base::seekdir __dir)
294 sentry __cerb(*
this);
299 const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,
303 if (__p == pos_type(off_type(-1)))
309 template<
typename _CharT,
typename _Traits>
325 __ptr_guard (_CharT *__ip): __p(__ip) { }
326 ~__ptr_guard() {
delete[] __p; }
327 _CharT* __get() {
return __p; }
328 } __pg (
new _CharT[__clen]);
330 _CharT *__ws = __pg.__get();
331 for (
size_t __i = 0; __i < __clen; ++__i)
332 __ws[__i] = __out.widen(__s[__i]);
333 __ostream_insert(__out, __ws, __clen);
338 __throw_exception_again;
348 #if _GLIBCXX_EXTERN_TEMPLATE
349 extern template class basic_ostream<char>;
360 extern template ostream& ostream::_M_insert(
long);
361 extern template ostream& ostream::_M_insert(
unsigned long);
362 extern template ostream& ostream::_M_insert(
bool);
363 #ifdef _GLIBCXX_USE_LONG_LONG
364 #pragma GCC diagnostic push
365 #pragma GCC diagnostic ignored "-Wlong-long"
366 extern template ostream& ostream::_M_insert(
long long);
367 extern template ostream& ostream::_M_insert(
unsigned long long);
368 #pragma GCC diagnostic pop
370 extern template ostream& ostream::_M_insert(
double);
371 extern template ostream& ostream::_M_insert(
long double);
372 extern template ostream& ostream::_M_insert(
const void*);
374 #ifdef _GLIBCXX_USE_WCHAR_T
375 extern template class basic_ostream<wchar_t>;
384 extern template wostream& wostream::_M_insert(
long);
385 extern template wostream& wostream::_M_insert(
unsigned long);
386 extern template wostream& wostream::_M_insert(
bool);
387 #ifdef _GLIBCXX_USE_LONG_LONG
388 #pragma GCC diagnostic push
389 #pragma GCC diagnostic ignored "-Wlong-long"
390 extern template wostream& wostream::_M_insert(
long long);
391 extern template wostream& wostream::_M_insert(
unsigned long long);
392 #pragma GCC diagnostic pop
394 extern template wostream& wostream::_M_insert(
double);
395 extern template wostream& wostream::_M_insert(
long double);
396 extern template wostream& wostream::_M_insert(
const void*);
400 _GLIBCXX_END_NAMESPACE_VERSION
403 #pragma GCC diagnostic pop
__ostream_type & operator<<(__ostream_type &(*__pf)(__ostream_type &))
Interface for manipulators.
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Write a newline and flush the stream.
sentry(basic_ostream< _CharT, _Traits > &__os)
The constructor performs preparatory work.
basic_ostream< _CharT, _Traits > & ends(basic_ostream< _CharT, _Traits > &__os)
Write a null character into the output sequence.
static const iostate goodbit
Indicates all is well.
__ostream_type & flush()
Synchronizing the stream buffer.
static const fmtflags basefield
A mask of dec|oct|hex. Useful for the 2-arg form of setf.
static const fmtflags oct
Converts integer input or generates integer output in octal base.
ISO C++ entities toplevel namespace is std.
Primary class template num_put.
static const openmode out
Open for output. Default for ofstream and fstream.
The actual work of input and output (interface).
__ostream_type & seekp(pos_type)
Changing the current write position.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
static const seekdir cur
Request a seek relative to the current position within the sequence.
Basis for explicit traits specializations.
basic_ostream< wchar_t > wostream
Base class for wchar_t output streams.
basic_ostream< char > ostream
Base class for char output streams.
static const fmtflags hex
Converts integer input or generates integer output in hexadecimal base.
Template class basic_ostream.
__ostream_type & write(const char_type *__s, streamsize __n)
Character string insertion.
Thrown as part of forced unwinding.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
iter_type put(iter_type __s, ios_base &__io, char_type __fill, bool __v) const
Numeric formatting.
__ostream_type & put(char_type __c)
Simple insertion.
Performs setup work for output streams.
pos_type tellp()
Getting the current write position.