[#bsl-basic_stringbuf] = xref:bsl.adoc[bsl]::basic_stringbuf :relfileprefix: ../ :mrdocs: Standard stream buffer backed by a character string. == Synopsis Declared in `<bslstl_stringbuf.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class CHAR_TYPE, class CHAR_TRAITS = char_traits<CHAR_TYPE>, class ALLOCATOR = xref:bsl/allocator-0df.adoc[allocator<CHAR_TYPE>]> class basic_stringbuf : public std::basic_streambuf<CHAR_TYPE, CHAR_TRAITS> ---- == Description This class implements a standard stream buffer providing an unformatted character input sequence and an unformatted character output sequence that may be initialized or accessed using a string value. == Base Classes [cols="1,4"] |=== | Name| Description | `std::basic_streambuf<CHAR_TYPE, CHAR_TRAITS>` | The actual work of input and output (interface). |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:bsl/basic_stringbuf/__streambuf_type.adoc[`__streambuf_type`] | @{ This is a non‐standard type. | xref:bsl/basic_stringbuf/allocator_type.adoc[`allocator_type`] | This `typedef` is an alias to the (template parameter) `ALLOCATOR`. | xref:bsl/basic_stringbuf/char_type.adoc[`char_type`] | This `typedef` is an alias to the (template parameter) `CHAR_TYPE`. | xref:bsl/basic_stringbuf/int_type.adoc[`int_type`] | This `typedef` is an alias to `traits_type::int_type`. | xref:bsl/basic_stringbuf/off_type.adoc[`off_type`] | This `typedef` is an alias to `traits_type::off_type`. | xref:bsl/basic_stringbuf/pos_type.adoc[`pos_type`] | This `typedef` is an alias to `traits_type::pos_type`. | xref:bsl/basic_stringbuf/traits_type.adoc[`traits_type`] | This `typedef` is an alias to the (template parameter) `CHAR_TRAITS`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/basic_stringbuf/2constructor-0d2.adoc[`basic_stringbuf`] [.small]#[constructor]# | Constructors | xref:bsl/basic_stringbuf/2destructor.adoc[`~basic_stringbuf`] [.small]#[destructor]# | Destroy this object. | xref:bsl/basic_stringbuf/operator_assign-02.adoc[`operator=`] | Move‐assign from the specified `rhs`. | xref:bsl/basic_stringbuf/get_allocator.adoc[`get_allocator`] | Return the allocator used by the underlying string to supply memory. | xref:bsl/basic_stringbuf/getloc-06.adoc[`getloc`] | Locale access. | xref:bsl/basic_stringbuf/in_avail-07.adoc[`in_avail`] | Looking ahead into the stream. | xref:bsl/basic_stringbuf/pubimbue-00c.adoc[`pubimbue`] | Entry point for imbue(). | xref:bsl/basic_stringbuf/pubseekoff-07.adoc[`pubseekoff`] | Alters the stream position. | xref:bsl/basic_stringbuf/pubseekpos-00.adoc[`pubseekpos`] | Alters the stream position. | xref:bsl/basic_stringbuf/pubsetbuf-09.adoc[`pubsetbuf`] | Entry points for derived buffer functions. | xref:bsl/basic_stringbuf/pubsync-0c.adoc[`pubsync`] | Calls virtual sync function. | xref:bsl/basic_stringbuf/sbumpc-02.adoc[`sbumpc`] | Getting the next character. | xref:bsl/basic_stringbuf/sgetc-02.adoc[`sgetc`] | Getting the next character. | xref:bsl/basic_stringbuf/sgetn-04.adoc[`sgetn`] | Entry point for xsgetn. | xref:bsl/basic_stringbuf/snextc-09.adoc[`snextc`] | Getting the next character. | xref:bsl/basic_stringbuf/sputbackc-06.adoc[`sputbackc`] | Pushing characters back into the input stream. | xref:bsl/basic_stringbuf/sputc-03.adoc[`sputc`] | Entry point for all single‐character output functions. | xref:bsl/basic_stringbuf/sputn-0f.adoc[`sputn`] | Entry point for all single‐character output functions. | xref:bsl/basic_stringbuf/str-0d9.adoc[`str`] | `str` overloads | xref:bsl/basic_stringbuf/sungetc-0d.adoc[`sungetc`] | Moving backwards in the input stream. | xref:bsl/basic_stringbuf/swap-08.adoc[`swap`] | Efficiently exchange the value of this object with `other`. | xref:bsl/basic_stringbuf/view.adoc[`view`] | Return a view of the currently buffered sequence of characters. |=== == Using Declarations [cols="1,4"] |=== | Name| Description | xref:bsl/basic_stringbuf/getloc-04.adoc[`getloc`] | Return the currently imbued locale (inherited). | xref:bsl/basic_stringbuf/in_avail-0a.adoc[`in_avail`] | Return how many characters are available in the get area (inherited). | xref:bsl/basic_stringbuf/pubimbue-004.adoc[`pubimbue`] | Imbue this buffer with a locale and return the previous locale (inherited). | xref:bsl/basic_stringbuf/pubseekoff-0f.adoc[`pubseekoff`] | Seek to a relative position in the controlled sequences (inherited). | xref:bsl/basic_stringbuf/pubseekpos-06.adoc[`pubseekpos`] | Seek to an absolute position in the controlled sequences (inherited). | xref:bsl/basic_stringbuf/pubsetbuf-0f.adoc[`pubsetbuf`] | Offer a character array as the controlled sequence (inherited). | xref:bsl/basic_stringbuf/pubsync-01.adoc[`pubsync`] | Synchronize the put and/or get area with the underlying sequence (inherited). | xref:bsl/basic_stringbuf/sbumpc-0b.adoc[`sbumpc`] | Return the current get character and advance the get pointer (inherited). | xref:bsl/basic_stringbuf/sgetc-0f.adoc[`sgetc`] | Return the current get character without advancing (inherited). | xref:bsl/basic_stringbuf/sgetn-09.adoc[`sgetn`] | Read characters into a buffer (inherited). | xref:bsl/basic_stringbuf/snextc-05.adoc[`snextc`] | Advance the get pointer and return the next character (inherited). | xref:bsl/basic_stringbuf/sputbackc-0a.adoc[`sputbackc`] | Put a character back into the input sequence (inherited). | xref:bsl/basic_stringbuf/sputc-0c.adoc[`sputc`] | Append a character to the output sequence (inherited). | xref:bsl/basic_stringbuf/sputn-06.adoc[`sputn`] | Append characters to the output sequence (inherited). | xref:bsl/basic_stringbuf/sungetc-08.adoc[`sungetc`] | Move the get pointer back by one character (inherited). |=== == Protected Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/basic_stringbuf/operator_assign-0b.adoc[`operator=`] | | xref:bsl/basic_stringbuf/__safe_gbump.adoc[`__safe_gbump`] | | xref:bsl/basic_stringbuf/__safe_pbump.adoc[`__safe_pbump`] | | xref:bsl/basic_stringbuf/eback-0a.adoc[`eback`] | Access to the get area. | xref:bsl/basic_stringbuf/egptr-02.adoc[`egptr`] | | xref:bsl/basic_stringbuf/epptr-0c.adoc[`epptr`] | | xref:bsl/basic_stringbuf/gbump-00e.adoc[`gbump`] | Moving the read position. | xref:bsl/basic_stringbuf/gptr-05.adoc[`gptr`] | | xref:bsl/basic_stringbuf/imbue-0f.adoc[`imbue`] [.small]#[virtual]# | Changes translations. | xref:bsl/basic_stringbuf/overflow-090.adoc[`overflow`] | `overflow` overloads | xref:bsl/basic_stringbuf/pbackfail-07.adoc[`pbackfail`] | `pbackfail` overloads | xref:bsl/basic_stringbuf/pbase-0f.adoc[`pbase`] | Access to the put area. | xref:bsl/basic_stringbuf/pbump-0e.adoc[`pbump`] | Moving the write position. | xref:bsl/basic_stringbuf/pptr-06.adoc[`pptr`] | | xref:bsl/basic_stringbuf/seekoff-00.adoc[`seekoff`] | `seekoff` overloads | xref:bsl/basic_stringbuf/seekpos-05.adoc[`seekpos`] | `seekpos` overloads | xref:bsl/basic_stringbuf/setbuf-0bf.adoc[`setbuf`] [.small]#[virtual]# | Manipulates the buffer. | xref:bsl/basic_stringbuf/setg-07.adoc[`setg`] | Setting the three read area pointers. | xref:bsl/basic_stringbuf/setp-05.adoc[`setp`] | Setting the three write area pointers. | xref:bsl/basic_stringbuf/showmanyc-0a.adoc[`showmanyc`] [.small]#[virtual]# | Investigating the data available. | xref:bsl/basic_stringbuf/swap-00.adoc[`swap`] | | xref:bsl/basic_stringbuf/sync-01.adoc[`sync`] [.small]#[virtual]# | Synchronizes the buffer arrays with the controlled sequences. | xref:bsl/basic_stringbuf/uflow.adoc[`uflow`] [.small]#[virtual]# | Return the character at the current get position and advance past it. | xref:bsl/basic_stringbuf/underflow.adoc[`underflow`] [.small]#[virtual]# | Return the character at the current get position, if any. | xref:bsl/basic_stringbuf/xsgetn-09.adoc[`xsgetn`] | `xsgetn` overloads | xref:bsl/basic_stringbuf/xsputn-06.adoc[`xsputn`] | `xsputn` overloads |=== == Protected Data Members [cols="1,4"] |=== | Name| Description | xref:bsl/basic_stringbuf/_M_buf_locale.adoc[`_M_buf_locale`] | Current locale setting. | xref:bsl/basic_stringbuf/_M_in_beg.adoc[`_M_in_beg`] | Start of get area. | xref:bsl/basic_stringbuf/_M_in_cur.adoc[`_M_in_cur`] | Current read area. | xref:bsl/basic_stringbuf/_M_in_end.adoc[`_M_in_end`] | End of get area. | xref:bsl/basic_stringbuf/_M_out_beg.adoc[`_M_out_beg`] | Start of put area. | xref:bsl/basic_stringbuf/_M_out_cur.adoc[`_M_out_cur`] | Current put area. | xref:bsl/basic_stringbuf/_M_out_end.adoc[`_M_out_end`] | End of put area. |=== == Protected Using Declarations [cols="1,4"] |=== | Name| Description | xref:bsl/basic_stringbuf/eback-03.adoc[`eback`] | Return the start of the get area (inherited). | xref:bsl/basic_stringbuf/egptr-0e.adoc[`egptr`] | Return the end of the get area (inherited). | xref:bsl/basic_stringbuf/epptr-00.adoc[`epptr`] | Return the end of the put area (inherited). | xref:bsl/basic_stringbuf/gbump-007.adoc[`gbump`] | Advance the get pointer by the specified number of characters (inherited). | xref:bsl/basic_stringbuf/gptr-0e.adoc[`gptr`] | Return the current get pointer (inherited). | xref:bsl/basic_stringbuf/imbue-0d.adoc[`imbue`] | Imbue this stream buffer with a locale (inherited). | xref:bsl/basic_stringbuf/operator=.adoc[`operator=`] | Assign the get/put pointers and locale from a base stream buffer (inherited). | xref:bsl/basic_stringbuf/pbase-06.adoc[`pbase`] | Return the start of the put area (inherited). | xref:bsl/basic_stringbuf/pbump-0c.adoc[`pbump`] | Advance the put pointer by the specified number of characters (inherited). | xref:bsl/basic_stringbuf/pptr-03.adoc[`pptr`] | Return the current put pointer (inherited). | xref:bsl/basic_stringbuf/setbuf-0b8.adoc[`setbuf`] | Offer a character array as the controlled sequence (inherited). | xref:bsl/basic_stringbuf/setg-09.adoc[`setg`] | Set the beginning, next, and end pointers of the get area (inherited). | xref:bsl/basic_stringbuf/setp-0e.adoc[`setp`] | Set the beginning and end pointers of the put area (inherited). | xref:bsl/basic_stringbuf/showmanyc-09.adoc[`showmanyc`] | Estimate how many characters can be extracted (inherited). | xref:bsl/basic_stringbuf/swap-0d.adoc[`swap`] | Exchange get/put pointers and locale with another stream buffer (inherited). | xref:bsl/basic_stringbuf/sync-02.adoc[`sync`] | Synchronize the controlled sequences with the character sequence (inherited). |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/swap-06f.adoc[`swap`] | Efficiently exchange the values of the specified `a` and `b` objects. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#