Inheritance diagram for std::basic_ostream< _CharT, _Traits >:
Public Types | |
typedef _CharT | char_type |
typedef _Traits::int_type | int_type |
typedef _Traits::pos_type | pos_type |
typedef _Traits::off_type | off_type |
typedef _Traits | traits_type |
typedef basic_streambuf< _CharT, _Traits > | __streambuf_type |
typedef basic_ios< _CharT, _Traits > | __ios_type |
typedef basic_ostream< _CharT, _Traits > | __ostream_type |
typedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > | __num_put_type |
typedef ctype< _CharT > | __ctype_type |
Public Member Functions | |
basic_ostream (__streambuf_type *__sb) | |
Base constructor. | |
virtual | ~basic_ostream () |
Base destructor. | |
__ostream_type & | flush () |
Synchronizing the stream buffer. | |
pos_type | tellp () |
Getting the current write position. | |
__ostream_type & | seekp (pos_type) |
Changing the current write position. | |
__ostream_type & | seekp (off_type, ios_base::seekdir) |
Changing the current write position. | |
__ostream_type & | operator<< (__ostream_type &(*__pf)(__ostream_type &)) |
Interface for manipulators. | |
__ostream_type & | operator<< (__ios_type &(*__pf)(__ios_type &)) |
__ostream_type & | operator<< (ios_base &(*__pf)(ios_base &)) |
Arithmetic Inserters | |
All the operator<< functions (aka formatted output functions) have some common behavior. Each starts by constructing a temporary object of type std::basic_ostream::sentry. This can have several effects, concluding with the setting of a status flag; see the sentry documentation for more.If the sentry status is good, the function tries to generate whatever data is appropriate for the type of the argument.
If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state without causing an ios_base::failure to be thrown. The original exception will then be rethrown. | |
__ostream_type & | operator<< (long __n) |
Basic arithmetic inserters. | |
__ostream_type & | operator<< (unsigned long __n) |
__ostream_type & | operator<< (bool __n) |
__ostream_type & | operator<< (short __n) |
__ostream_type & | operator<< (unsigned short __n) |
__ostream_type & | operator<< (int __n) |
__ostream_type & | operator<< (unsigned int __n) |
__ostream_type & | operator<< (double __f) |
__ostream_type & | operator<< (float __f) |
__ostream_type & | operator<< (long double __f) |
__ostream_type & | operator<< (const void *__p) |
__ostream_type & | operator<< (__streambuf_type *__sb) |
Extracting from another streambuf. | |
Unformatted Output Functions | |
All the unformatted output functions have some common behavior. Each starts by constructing a temporary object of type std::basic_ostream::sentry. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more. If the sentry status is good, the function tries to generate whatever data is appropriate for the type of the argument.
If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state. If badbit is on in the stream's exceptions mask, the exception will be rethrown without completing its actions. | |
__ostream_type & | put (char_type __c) |
Simple insertion. | |
void | _M_write (const char_type *__s, streamsize __n) |
__ostream_type & | write (const char_type *__s, streamsize __n) |
Character string insertion. | |
Protected Member Functions | |
basic_ostream () | |
Friends | |
class | sentry |
template<typename _CharT2, typename _Traits2> | |
basic_ostream< _CharT2, _Traits2 > & | operator<< (basic_ostream< _CharT2, _Traits2 > &, _CharT2) |
template<typename _Traits2> | |
basic_ostream< char, _Traits2 > & | operator<< (basic_ostream< char, _Traits2 > &, char) |
template<typename _CharT2, typename _Traits2> | |
basic_ostream< _CharT2, _Traits2 > & | operator<< (basic_ostream< _CharT2, _Traits2 > &, const _CharT2 *) |
template<typename _Traits2> | |
basic_ostream< char, _Traits2 > & | operator<< (basic_ostream< char, _Traits2 > &, const char *) |
template<typename _CharT2, typename _Traits2> | |
basic_ostream< _CharT2, _Traits2 > & | operator<< (basic_ostream< _CharT2, _Traits2 > &, const char *) |
Classes | |
class | sentry |
Performs setup work for output streams. More... |
This is the base class for all output streams. It provides text formatting of all builtin types, and communicates with any class derived from basic_streambuf to do the actual output.
Definition at line 57 of file ostream.
typedef ctype<_CharT> std::basic_ostream< _CharT, _Traits >::__ctype_type |
typedef basic_ios<_CharT, _Traits> std::basic_ostream< _CharT, _Traits >::__ios_type |
typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > std::basic_ostream< _CharT, _Traits >::__num_put_type |
typedef basic_ostream<_CharT, _Traits> std::basic_ostream< _CharT, _Traits >::__ostream_type |
typedef basic_streambuf<_CharT, _Traits> std::basic_ostream< _CharT, _Traits >::__streambuf_type |
typedef _CharT std::basic_ostream< _CharT, _Traits >::char_type |
These are standard types. They permit a standardized way of referring to names of (or names dependant on) the template parameters, which are specific to the implementation.
Reimplemented from std::basic_ios< _CharT, _Traits >.
Reimplemented in std::strstream, std::basic_ofstream< _CharT, _Traits >, std::basic_fstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_ostringstream< _CharT, _Traits, _Alloc >, std::basic_stringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >.
typedef _Traits::int_type std::basic_ostream< _CharT, _Traits >::int_type |
Reimplemented from std::basic_ios< _CharT, _Traits >.
Reimplemented in std::strstream, std::basic_ofstream< _CharT, _Traits >, std::basic_fstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_ostringstream< _CharT, _Traits, _Alloc >, std::basic_stringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >.
typedef _Traits::off_type std::basic_ostream< _CharT, _Traits >::off_type |
Reimplemented from std::basic_ios< _CharT, _Traits >.
Reimplemented in std::strstream, std::basic_ofstream< _CharT, _Traits >, std::basic_fstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_ostringstream< _CharT, _Traits, _Alloc >, std::basic_stringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >.
typedef _Traits::pos_type std::basic_ostream< _CharT, _Traits >::pos_type |
Reimplemented from std::basic_ios< _CharT, _Traits >.
Reimplemented in std::strstream, std::basic_ofstream< _CharT, _Traits >, std::basic_fstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_ostringstream< _CharT, _Traits, _Alloc >, std::basic_stringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >.
typedef _Traits std::basic_ostream< _CharT, _Traits >::traits_type |
Reimplemented from std::basic_ios< _CharT, _Traits >.
Reimplemented in std::basic_ofstream< _CharT, _Traits >, std::basic_fstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_ostringstream< _CharT, _Traits, _Alloc >, std::basic_stringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >.
std::basic_ostream< _CharT, _Traits >::basic_ostream | ( | __streambuf_type * | __sb | ) | [inline, explicit] |
virtual std::basic_ostream< _CharT, _Traits >::~basic_ostream | ( | ) | [inline, virtual] |
std::basic_ostream< _CharT, _Traits >::basic_ostream | ( | ) | [inline, explicit, protected] |
void std::basic_ostream< _CharT, _Traits >::_M_write | ( | const char_type * | __s, | |
streamsize | __n | |||
) | [inline] |
Definition at line 266 of file ostream.
Referenced by std::basic_ostream< _CharT, _Traits >::write().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::flush | ( | ) |
Synchronizing the stream buffer.
rdbuf()
is a null pointer, changes nothing.
Otherwise, calls rdbuf()->pubsync()
, and if that returns -1, sets badbit.
Definition at line 506 of file ostream.tcc.
References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by std::flush().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | __streambuf_type * | __sb | ) |
Extracting from another streambuf.
sb | A pointer to a streambuf |
If sb is NULL, the stream will set failbit in its error state.
Characters are extracted from sb and inserted into *this
until one of the following occurs:
If the function inserts no characters, failbit is set.
Definition at line 430 of file ostream.tcc.
References std::__copy_streambufs(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::failbit, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | const void * | __p | ) |
Definition at line 407 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | long double | __f | ) |
Definition at line 384 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | float | __f | ) |
Definition at line 335 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | double | __f | ) |
Definition at line 361 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | unsigned int | __n | ) |
Definition at line 215 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | int | __n | ) |
Definition at line 183 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::basefield, std::ios_base::flags(), std::ios_base::goodbit, std::ios_base::hex, std::ios_base::oct, and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | unsigned short | __n | ) |
Definition at line 157 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | short | __n | ) |
Definition at line 125 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::basefield, std::ios_base::flags(), std::ios_base::goodbit, std::ios_base::hex, std::ios_base::oct, and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | bool | __n | ) |
Definition at line 102 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | unsigned long | __n | ) |
Definition at line 264 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | long | __n | ) |
Basic arithmetic inserters.
A | variable of builtin type. |
*this
if successfulnum_get
facet) to perform numeric formatting.
Definition at line 241 of file ostream.tcc.
References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | ios_base &(*)(ios_base &) | __pf | ) | [inline] |
Definition at line 90 of file ostream.tcc.
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | __ios_type &(*)(__ios_type &) | __pf | ) | [inline] |
Definition at line 78 of file ostream.tcc.
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< | ( | __ostream_type &(*)(__ostream_type &) | __pf | ) | [inline] |
Interface for manipulators.
Manuipulators such as std::endl
and std::hex
use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header.
Definition at line 67 of file ostream.tcc.
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::put | ( | char_type | __c | ) |
Simple insertion.
c | The character to insert. |
Definition at line 454 of file ostream.tcc.
References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by std::endl(), and std::ends().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp | ( | off_type | , | |
ios_base::seekdir | ||||
) |
Changing the current write position.
off | A file offset object. | |
dir | The direction in which to seek. |
fail()
is not true, calls rdbuf()->pubseekoff(off,dir)
. If that function fails, sets failbit.
Definition at line 570 of file ostream.tcc.
References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::failbit, std::ios_base::goodbit, std::ios_base::out, and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp | ( | pos_type | ) |
Changing the current write position.
pos | A file position object. |
fail()
is not true, calls rdbuf()->pubseekpos(pos)
. If that function fails, sets failbit.
Definition at line 543 of file ostream.tcc.
References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::failbit, std::ios_base::goodbit, std::ios_base::out, and std::basic_ios< _CharT, _Traits >::setstate().
basic_ostream< _CharT, _Traits >::pos_type std::basic_ostream< _CharT, _Traits >::tellp | ( | ) |
Getting the current write position.
fail()
is not false, returns pos_type
(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,out)
.
Definition at line 527 of file ostream.tcc.
References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::badbit, std::ios_base::cur, and std::ios_base::out.
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::write | ( | const char_type * | __s, | |
streamsize | __n | |||
) |
Character string insertion.
s | The array to insert. | |
n | Maximum number of characters to insert. |
Definition at line 483 of file ostream.tcc.
References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::basic_ostream< _CharT, _Traits >::_M_write(), and std::ios_base::badbit.
basic_ostream<_CharT2, _Traits2>& operator<< | ( | basic_ostream< _CharT2, _Traits2 > & | , | |
const char * | ||||
) | [friend] |
basic_ostream<char, _Traits2>& operator<< | ( | basic_ostream< char, _Traits2 > & | , | |
const char * | ||||
) | [friend] |
basic_ostream<_CharT2, _Traits2>& operator<< | ( | basic_ostream< _CharT2, _Traits2 > & | , | |
const _CharT2 * | ||||
) | [friend] |
basic_ostream<char, _Traits2>& operator<< | ( | basic_ostream< char, _Traits2 > & | , | |
char | ||||
) | [friend] |
basic_ostream<_CharT2, _Traits2>& operator<< | ( | basic_ostream< _CharT2, _Traits2 > & | , | |
_CharT2 | ||||
) | [friend] |
friend class sentry [friend] |