libstdc++
|
Public Types | |
typedef ctype< _CharT > | __ctype_type |
typedef basic_filebuf< char_type, traits_type > | __filebuf_type |
typedef basic_ios< _CharT, _Traits > | __ios_type |
typedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > | __num_put_type |
typedef basic_ostream< char_type, traits_type > | __ostream_type |
typedef basic_streambuf< _CharT, _Traits > | __streambuf_type |
typedef _CharT | char_type |
typedef traits_type::int_type | int_type |
typedef traits_type::off_type | off_type |
typedef traits_type::pos_type | pos_type |
typedef _Traits | traits_type |
Public Member Functions | |
basic_ofstream () | |
basic_ofstream (basic_ofstream &&__rhs) | |
basic_ofstream (const basic_ofstream &)=delete | |
basic_ofstream (const char *__s, ios_base::openmode __mode=ios_base::out) | |
basic_ofstream (const std::string &__s, ios_base::openmode __mode=ios_base::out) | |
~basic_ofstream () | |
template<typename _ValueT > | |
basic_ostream< _CharT, _Traits > & | _M_insert (_ValueT __v) |
void | close () |
bool | is_open () |
bool | is_open () const |
void | open (const char *__s, ios_base::openmode __mode=ios_base::out) |
void | open (const std::string &__s, ios_base::openmode __mode=ios_base::out) |
__ostream_type & | operator<< (__ios_type &(*__pf)(__ios_type &)) |
__ostream_type & | operator<< (__ostream_type &(*__pf)(__ostream_type &)) |
__ostream_type & | operator<< (ios_base &(*__pf)(ios_base &)) |
basic_ofstream & | operator= (basic_ofstream &&__rhs) |
basic_ofstream & | operator= (const basic_ofstream &)=delete |
__filebuf_type * | rdbuf () const |
void | swap (basic_ofstream &__rhs) |
Inserters | |
All the 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) |
__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<< (long long __n) |
__ostream_type & | operator<< (unsigned long long __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) |
Inserters | |
All the 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) |
__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<< (long long __n) |
__ostream_type & | operator<< (unsigned long long __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) |
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) |
void | _M_write (const char_type *__s, streamsize __n) |
__ostream_type & | write (const char_type *__s, streamsize __n) |
__ostream_type & | flush () |
pos_type | tellp () |
__ostream_type & | seekp (pos_type) |
__ostream_type & | seekp (off_type, ios_base::seekdir) |
void | swap (basic_ostream &__rhs) |
template<typename _ValueT > | |
__ostream_type & | _M_insert (_ValueT __v) |
Controlling output for files.
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
This class supports reading from named files, using the inherited functions from std::basic_ostream. To control the associated sequence, an instance of std::basic_filebuf is used, which this page refers to as sb
.
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
|
protectedinherited |
Simple insertion.
__c | The character to insert. |
Tries to insert __c
.
Referenced by std::basic_ostream< char >::operator<<().
|
inlineinherited |
|
inline |
|
inherited |
Synchronizing the stream buffer.
If rdbuf()
is a null pointer, changes nothing.
Otherwise, calls rdbuf()->pubsync()
, and if that returns -1, sets badbit.
Definition at line 211 of file ostream.tcc.
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry().
|
inline |
|
inline |
|
inline |
|
inlineinherited |
|
inherited |
Extracting from another streambuf.
__sb | A pointer to a streambuf |
This function behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.
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:
__sb
, which sets failbit in the error stateIf the function inserts no characters, failbit is set.
Definition at line 120 of file ostream.tcc.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Integer arithmetic inserters.
__n | A variable of builtin integral type. |
*this
if successfulThese functions use the stream's current locale (specifically, the num_get
facet) to perform numeric formatting.
Definition at line 106 of file ostream.tcc.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Integer arithmetic inserters.
__n | A variable of builtin integral type. |
*this
if successfulThese functions use the stream's current locale (specifically, the num_get
facet) to perform numeric formatting.
Definition at line 92 of file ostream.tcc.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Simple insertion.
__c | The character to insert. |
Tries to insert __c
.
Definition at line 149 of file ostream.tcc.
|
inline |
|
inherited |
Changing the current write position.
__off | A file offset object. |
__dir | The direction in which to seek. |
If fail()
is not true, calls rdbuf()->pubseekoff(off,dir)
. If that function fails, sets failbit.
Definition at line 290 of file ostream.tcc.
|
inherited |
Changing the current write position.
__pos | A file position object. |
If fail()
is not true, calls rdbuf()->pubseekpos(pos)
. If that function fails, sets failbit.
Definition at line 258 of file ostream.tcc.
|
inlineprotectedinherited |
|
inherited |
Getting the current write position.
If fail()
is not false, returns pos_type
(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,out)
.
Definition at line 237 of file ostream.tcc.
|
inherited |
Character string insertion.
__s | The array to insert. |
__n | Maximum number of characters to insert. |
Characters are copied from __s
and inserted into the stream until one of the following happens:
__n
characters are insertedDefinition at line 183 of file ostream.tcc.