35 #ifndef _GLIBCXX_OSTREAM
36 #define _GLIBCXX_OSTREAM 1
38 #pragma GCC system_header
43 namespace std _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 template<
typename _CharT,
typename _Traits>
56 class basic_ostream :
virtual public basic_ios<_CharT, _Traits>
60 typedef _CharT char_type;
61 typedef typename _Traits::int_type int_type;
62 typedef typename _Traits::pos_type pos_type;
63 typedef typename _Traits::off_type off_type;
64 typedef _Traits traits_type;
67 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
68 typedef basic_ios<_CharT, _Traits> __ios_type;
69 typedef basic_ostream<_CharT, _Traits> __ostream_type;
70 typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
72 typedef ctype<_CharT> __ctype_type;
165 {
return _M_insert(__n); }
169 {
return _M_insert(__n); }
173 {
return _M_insert(__n); }
183 return _M_insert(static_cast<unsigned long>(__n));
194 return _M_insert(static_cast<unsigned long>(__n));
197 #ifdef _GLIBCXX_USE_LONG_LONG
200 {
return _M_insert(__n); }
204 {
return _M_insert(__n); }
219 {
return _M_insert(__f); }
226 return _M_insert(static_cast<double>(__f));
231 {
return _M_insert(__f); }
244 {
return _M_insert(__p); }
379 seekp(off_type, ios_base::seekdir);
385 template<
typename _ValueT>
387 _M_insert(_ValueT __v);
397 template <
typename _CharT,
typename _Traits>
432 if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
444 #ifdef __GXX_EXPERIMENTAL_CXX0X__
447 operator bool()
const
467 template<
typename _CharT,
typename _Traits>
469 operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
470 {
return __ostream_insert(__out, &__c, 1); }
472 template<
typename _CharT,
typename _Traits>
473 inline basic_ostream<_CharT, _Traits>&
474 operator<<(basic_ostream<_CharT, _Traits>& __out,
char __c)
475 {
return (__out << __out.widen(__c)); }
478 template <
class _Traits>
479 inline basic_ostream<char, _Traits>&
480 operator<<(basic_ostream<char, _Traits>& __out,
char __c)
481 {
return __ostream_insert(__out, &__c, 1); }
484 template<
class _Traits>
485 inline basic_ostream<char, _Traits>&
486 operator<<(basic_ostream<char, _Traits>& __out,
signed char __c)
487 {
return (__out << static_cast<char>(__c)); }
489 template<
class _Traits>
490 inline basic_ostream<char, _Traits>&
491 operator<<(basic_ostream<char, _Traits>& __out,
unsigned char __c)
492 {
return (__out << static_cast<char>(__c)); }
509 template<
typename _CharT,
typename _Traits>
510 inline basic_ostream<_CharT, _Traits>&
511 operator<<(basic_ostream<_CharT, _Traits>& __out,
const _CharT* __s)
516 __ostream_insert(__out, __s,
517 static_cast<streamsize>(_Traits::length(__s)));
521 template<
typename _CharT,
typename _Traits>
522 basic_ostream<_CharT, _Traits> &
523 operator<<(basic_ostream<_CharT, _Traits>& __out,
const char* __s);
526 template<
class _Traits>
527 inline basic_ostream<char, _Traits>&
528 operator<<(basic_ostream<char, _Traits>& __out,
const char* __s)
533 __ostream_insert(__out, __s,
534 static_cast<streamsize>(_Traits::length(__s)));
539 template<
class _Traits>
540 inline basic_ostream<char, _Traits>&
541 operator<<(basic_ostream<char, _Traits>& __out,
const signed char* __s)
542 {
return (__out << reinterpret_cast<const char*>(__s)); }
544 template<
class _Traits>
545 inline basic_ostream<char, _Traits> &
546 operator<<(basic_ostream<char, _Traits>& __out,
const unsigned char* __s)
547 {
return (__out << reinterpret_cast<const char*>(__s)); }
560 template<
typename _CharT,
typename _Traits>
561 inline basic_ostream<_CharT, _Traits>&
563 {
return flush(__os.put(__os.widen(
'\n'))); }
572 template<
typename _CharT,
typename _Traits>
573 inline basic_ostream<_CharT, _Traits>&
575 {
return __os.put(_CharT()); }
582 template<
typename _CharT,
typename _Traits>
583 inline basic_ostream<_CharT, _Traits>&
585 {
return __os.flush(); }
587 #ifdef __GXX_EXPERIMENTAL_CXX0X__
598 template<
typename _CharT,
typename _Traits,
typename _Tp>
599 inline basic_ostream<_CharT, _Traits>&
600 operator<<(basic_ostream<_CharT, _Traits>&& __os,
const _Tp& __x)
601 {
return (__os << __x); }
602 #endif // __GXX_EXPERIMENTAL_CXX0X__
604 _GLIBCXX_END_NAMESPACE_VERSION
bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
__ostream_type & operator<<(__ostream_type &(*__pf)(__ostream_type &))
Interface for manipulators.
static const fmtflags unitbuf
Flushes output after each output operation.
__ostream_type & write(const char_type *__s, streamsize __n)
Character string insertion.
void setstate(iostate __state)
Sets additional flags in the error state.
void _M_write(const char_type *__s, streamsize __n)
Core write functionality, without sentry.
basic_ostream(__streambuf_type *__sb)
Base constructor.
__ostream_type & put(char_type __c)
Simple insertion.
Performs setup work for output streams.
virtual ~basic_ostream()
Base destructor.
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Write a newline and flush the stream.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
~sentry()
Possibly flushes the stream.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
__ostream_type & flush()
Synchronizing the stream buffer.
__ostream_type & seekp(pos_type)
Changing the current write position.
pos_type tellp()
Getting the current write position.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
basic_ostream< _CharT, _Traits > & flush(basic_ostream< _CharT, _Traits > &__os)
Flushes the output stream.
basic_ostream< _CharT, _Traits > & ends(basic_ostream< _CharT, _Traits > &__os)
Write a null character into the output sequence.