Inheritance diagram for std::basic_stringbuf< _CharT, _Traits, _Alloc >:
Public Types | |
typedef _CharT | char_type |
typedef _Traits | traits_type |
typedef _Alloc | allocator_type |
typedef traits_type::int_type | int_type |
typedef traits_type::pos_type | pos_type |
typedef traits_type::off_type | off_type |
typedef basic_streambuf< char_type, traits_type > | __streambuf_type |
typedef basic_string< char_type, _Traits, _Alloc > | __string_type |
typedef __string_type::size_type | __size_type |
Public Member Functions | |
basic_stringbuf (ios_base::openmode __mode=ios_base::in|ios_base::out) | |
Starts with an empty string buffer. | |
basic_stringbuf (const __string_type &__str, ios_base::openmode __mode=ios_base::in|ios_base::out) | |
Starts with an existing string buffer. | |
__string_type | str () const |
Copying out the string buffer. | |
void | str (const __string_type &__s) |
Setting a new buffer. | |
Protected Member Functions | |
void | _M_stringbuf_init (ios_base::openmode __mode) |
virtual streamsize | showmanyc () |
Investigating the data available. | |
virtual int_type | underflow () |
Fetches more data from the controlled sequence. | |
virtual int_type | pbackfail (int_type __c=traits_type::eof()) |
Tries to back up the input sequence. | |
virtual int_type | overflow (int_type __c=traits_type::eof()) |
Consumes data from the buffer; writes to the controlled sequence. | |
virtual __streambuf_type * | setbuf (char_type *__s, streamsize __n) |
Manipulates the buffer. | |
virtual pos_type | seekoff (off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out) |
virtual pos_type | seekpos (pos_type __sp, ios_base::openmode __mode=ios_base::in|ios_base::out) |
void | _M_sync (char_type *__base, __size_type __i, __size_type __o) |
void | _M_update_egptr () |
Protected Attributes | |
ios_base::openmode | _M_mode |
__string_type | _M_string |
This class associates either or both of its input and output sequences with a sequence of characters, which can be initialized from, or made available as, a std::basic_string
. (Paraphrased from [27.7.1]/1.)
For this class, open modes (of type ios_base::openmode
) have in
set if the input sequence can be read, and out
set if the output sequence can be written.
Definition at line 62 of file sstream.
typedef __string_type::size_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::__size_type |
typedef basic_streambuf<char_type, traits_type> std::basic_stringbuf< _CharT, _Traits, _Alloc >::__streambuf_type |
typedef basic_string<char_type, _Traits, _Alloc> std::basic_stringbuf< _CharT, _Traits, _Alloc >::__string_type |
typedef _Alloc std::basic_stringbuf< _CharT, _Traits, _Alloc >::allocator_type |
typedef _CharT std::basic_stringbuf< _CharT, _Traits, _Alloc >::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_streambuf< _CharT, _Traits >.
typedef traits_type::int_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::int_type |
typedef traits_type::off_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::off_type |
typedef traits_type::pos_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::pos_type |
typedef _Traits std::basic_stringbuf< _CharT, _Traits, _Alloc >::traits_type |
std::basic_stringbuf< _CharT, _Traits, _Alloc >::basic_stringbuf | ( | ios_base::openmode | __mode = ios_base::in | ios_base::out |
) | [inline, explicit] |
std::basic_stringbuf< _CharT, _Traits, _Alloc >::basic_stringbuf | ( | const __string_type & | __str, | |
ios_base::openmode | __mode = ios_base::in | ios_base::out | |||
) | [inline, explicit] |
Starts with an existing string buffer.
str | A string to copy as a starting buffer. | |
mode | Whether the buffer can read, or write, or both. |
Definition at line 113 of file sstream.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_stringbuf_init().
void std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_stringbuf_init | ( | ios_base::openmode | __mode | ) | [inline, protected] |
Definition at line 162 of file sstream.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_string, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_sync(), std::ios_base::app, std::ios_base::ate, std::basic_string< _CharT, _Traits, _Alloc >::data(), and std::basic_string< _CharT, _Traits, _Alloc >::size().
Referenced by std::basic_stringbuf< _CharT, _Traits, _Alloc >::basic_stringbuf(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::str().
void std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_sync | ( | char_type * | __base, | |
__size_type | __i, | |||
__size_type | __o | |||
) | [protected] |
Definition at line 223 of file sstream.tcc.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_string, std::basic_string< _CharT, _Traits, _Alloc >::capacity(), std::basic_string< _CharT, _Traits, _Alloc >::data(), std::ios_base::in, std::ios_base::out, std::basic_streambuf< _CharT, _Traits >::pbump(), std::basic_streambuf< _CharT, _Traits >::setg(), std::basic_streambuf< _CharT, _Traits >::setp(), and std::basic_string< _CharT, _Traits, _Alloc >::size().
Referenced by std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_stringbuf_init(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::setbuf().
void std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_update_egptr | ( | ) | [inline, protected] |
Definition at line 239 of file sstream.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gptr(), std::ios_base::in, std::basic_streambuf< _CharT, _Traits >::pptr(), and std::basic_streambuf< _CharT, _Traits >::setg().
Referenced by std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::showmanyc(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow().
basic_stringbuf< _CharT, _Traits, _Alloc >::int_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow | ( | int_type | __c = traits_type::eof() |
) | [protected, virtual] |
Consumes data from the buffer; writes to the controlled sequence.
c | An additional character to consume. |
eof()
.For a formal definiton of this function, see a good text such as Langer & Kreft, or [27.5.2.4.5]/3-7.
A functioning output streambuf can be created by overriding only this function (no buffer area will be used).
Reimplemented from std::basic_streambuf< _CharT, _Traits >.
Definition at line 86 of file sstream.tcc.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_string, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_sync(), std::basic_string< _CharT, _Traits, _Alloc >::assign(), std::basic_string< _CharT, _Traits, _Alloc >::capacity(), std::basic_string< _CharT, _Traits, _Alloc >::data(), std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::epptr(), std::max(), std::basic_string< _CharT, _Traits, _Alloc >::max_size(), std::min(), std::ios_base::out, std::basic_streambuf< _CharT, _Traits >::pbase(), std::basic_streambuf< _CharT, _Traits >::pptr(), std::basic_string< _CharT, _Traits, _Alloc >::reserve(), std::basic_streambuf< _CharT, _Traits >::sputc(), and std::basic_string< _CharT, _Traits, _Alloc >::swap().
basic_stringbuf< _CharT, _Traits, _Alloc >::int_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail | ( | int_type | __c = traits_type::eof() |
) | [protected, virtual] |
Tries to back up the input sequence.
c | The character to be inserted back into the sequence. |
gptr()
, eback()
, and pptr()
are the same as for underflow()
.Reimplemented from std::basic_streambuf< _CharT, _Traits >.
Definition at line 52 of file sstream.tcc.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_streambuf< _CharT, _Traits >::gbump(), std::basic_streambuf< _CharT, _Traits >::gptr(), and std::ios_base::out.
basic_stringbuf< _CharT, _Traits, _Alloc >::pos_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff | ( | off_type | __off, | |
ios_base::seekdir | __way, | |||
ios_base::openmode | __mode = ios_base::in|ios_base::out | |||
) | [protected, virtual] |
Definition at line 147 of file sstream.tcc.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_update_egptr(), std::ios_base::cur, std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::egptr(), std::ios_base::end, std::basic_streambuf< _CharT, _Traits >::gptr(), std::ios_base::in, std::ios_base::out, std::basic_streambuf< _CharT, _Traits >::pbase(), and std::basic_streambuf< _CharT, _Traits >::pptr().
basic_stringbuf< _CharT, _Traits, _Alloc >::pos_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos | ( | pos_type | __sp, | |
ios_base::openmode | __mode = ios_base::in|ios_base::out | |||
) | [protected, virtual] |
Definition at line 194 of file sstream.tcc.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_update_egptr(), std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gbump(), std::ios_base::in, std::ios_base::out, std::basic_streambuf< _CharT, _Traits >::pbase(), and std::basic_streambuf< _CharT, _Traits >::pbump().
virtual __streambuf_type* std::basic_stringbuf< _CharT, _Traits, _Alloc >::setbuf | ( | char_type * | __s, | |
streamsize | __n | |||
) | [inline, protected, virtual] |
Manipulates the buffer.
s | Pointer to a buffer area. | |
n | Size of s. |
this
s
is used as a buffer; see http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for more.
Reimplemented from std::basic_streambuf< _CharT, _Traits >.
Definition at line 204 of file sstream.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_string, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_sync(), and std::basic_string< _CharT, _Traits, _Alloc >::clear().
virtual streamsize std::basic_stringbuf< _CharT, _Traits, _Alloc >::showmanyc | ( | ) | [inline, protected, virtual] |
Investigating the data available.
underflow()
will not return traits::eof()
until at least that number of characters have been supplied. If showmanyc()
returns -1, then calls to underflow()
or uflow()
will fail." [27.5.2.4.3]/1
The standard adds that "the intention is not only that the calls [to underflow or uflow] will not return eof()
but that they will return "immediately".
The standard adds that "the morphemes of showmanyc
are "es-how-many-see", not "show-manic".
Reimplemented from std::basic_streambuf< _CharT, _Traits >.
Definition at line 172 of file sstream.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_update_egptr(), std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gptr(), and std::ios_base::in.
void std::basic_stringbuf< _CharT, _Traits, _Alloc >::str | ( | const __string_type & | __s | ) | [inline] |
Setting a new buffer.
s | The string to use as a new sequence. |
Definition at line 152 of file sstream.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_string, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_stringbuf_init(), std::basic_string< _CharT, _Traits, _Alloc >::assign(), std::basic_string< _CharT, _Traits, _Alloc >::data(), and std::basic_string< _CharT, _Traits, _Alloc >::size().
__string_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::str | ( | ) | const [inline] |
Copying out the string buffer.
Definition at line 128 of file sstream.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_string, std::basic_streambuf< _CharT, _Traits >::egptr(), and std::basic_streambuf< _CharT, _Traits >::pptr().
Referenced by std::basic_stringstream< _CharT, _Traits, _Alloc >::str(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::str(), and std::basic_istringstream< _CharT, _Traits, _Alloc >::str().
basic_stringbuf< _CharT, _Traits, _Alloc >::int_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow | ( | ) | [protected, virtual] |
Fetches more data from the controlled sequence.
traits::eof()
to indicate a null pending sequence.For a formal definiton of the pending sequence, see a good text such as Langer & Kreft, or [27.5.2.4.3]/7-14.
A functioning input streambuf can be created by overriding only this function (no buffer area will be used). For an example, see http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#6
Reimplemented from std::basic_streambuf< _CharT, _Traits >.
Definition at line 129 of file sstream.tcc.
References std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode, std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_update_egptr(), std::basic_streambuf< _CharT, _Traits >::egptr(), and std::ios_base::in.
ios_base::openmode std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode [protected] |
Definition at line 85 of file sstream.
Referenced by std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_stringbuf_init(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_sync(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_update_egptr(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::showmanyc(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::str(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow().
__string_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_string [protected] |
Definition at line 88 of file sstream.
Referenced by std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_stringbuf_init(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_sync(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::setbuf(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::str().