[#bsl-basic_stringbuf]
= xref:bsl.adoc[bsl]::basic&lowbar;stringbuf
:relfileprefix: ../
:mrdocs:

Standard stream buffer backed by a character string&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;stringbuf&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class CHAR&lowbar;TYPE,
    class CHAR&lowbar;TRAITS = char&lowbar;traits&lt;CHAR&lowbar;TYPE&gt;,
    class ALLOCATOR = xref:bsl/allocator-0df.adoc[allocator&lt;CHAR&lowbar;TYPE&gt;]&gt;
class basic&lowbar;stringbuf
    : public std::basic&lowbar;streambuf&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS&gt;
----

== 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&period;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `std::basic&lowbar;streambuf&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS&gt;`
| The actual work of input and output (interface)&period;
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:bsl/basic_stringbuf/__streambuf_type.adoc[`&lowbar;&lowbar;streambuf&lowbar;type`] 
| @&lcub; This is a non&hyphen;standard type&period;
| xref:bsl/basic_stringbuf/allocator_type.adoc[`allocator&lowbar;type`] 
| This `typedef` is an alias to the (template parameter) `ALLOCATOR`&period;
| xref:bsl/basic_stringbuf/char_type.adoc[`char&lowbar;type`] 
| This `typedef` is an alias to the (template parameter) `CHAR&lowbar;TYPE`&period;
| xref:bsl/basic_stringbuf/int_type.adoc[`int&lowbar;type`] 
| This `typedef` is an alias to `traits&lowbar;type&colon;&colon;int&lowbar;type`&period;
| xref:bsl/basic_stringbuf/off_type.adoc[`off&lowbar;type`] 
| This `typedef` is an alias to `traits&lowbar;type&colon;&colon;off&lowbar;type`&period;
| xref:bsl/basic_stringbuf/pos_type.adoc[`pos&lowbar;type`] 
| This `typedef` is an alias to `traits&lowbar;type&colon;&colon;pos&lowbar;type`&period;
| xref:bsl/basic_stringbuf/traits_type.adoc[`traits&lowbar;type`] 
| This `typedef` is an alias to the (template parameter) `CHAR&lowbar;TRAITS`&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/basic_stringbuf/2constructor-0d2.adoc[`basic&lowbar;stringbuf`]         [.small]#[constructor]#
| Constructors
| xref:bsl/basic_stringbuf/2destructor.adoc[`&#126;basic&lowbar;stringbuf`] [.small]#[destructor]#
| Destroy this object&period;
| xref:bsl/basic_stringbuf/operator_assign-02.adoc[`operator&equals;`] 
| Move&hyphen;assign from the specified `rhs`&period;
| xref:bsl/basic_stringbuf/get_allocator.adoc[`get&lowbar;allocator`] 
| Return the allocator used by the underlying string to supply memory&period;
| xref:bsl/basic_stringbuf/getloc-06.adoc[`getloc`] 
| Locale access&period;
| xref:bsl/basic_stringbuf/in_avail-07.adoc[`in&lowbar;avail`] 
| Looking ahead into the stream&period;
| xref:bsl/basic_stringbuf/pubimbue-00c.adoc[`pubimbue`] 
| Entry point for imbue()&period;
| xref:bsl/basic_stringbuf/pubseekoff-07.adoc[`pubseekoff`] 
| Alters the stream position&period;
| xref:bsl/basic_stringbuf/pubseekpos-00.adoc[`pubseekpos`] 
| Alters the stream position&period;
| xref:bsl/basic_stringbuf/pubsetbuf-09.adoc[`pubsetbuf`] 
| Entry points for derived buffer functions&period;
| xref:bsl/basic_stringbuf/pubsync-0c.adoc[`pubsync`] 
| Calls virtual sync function&period;
| xref:bsl/basic_stringbuf/sbumpc-02.adoc[`sbumpc`] 
| Getting the next character&period;
| xref:bsl/basic_stringbuf/sgetc-02.adoc[`sgetc`] 
| Getting the next character&period;
| xref:bsl/basic_stringbuf/sgetn-04.adoc[`sgetn`] 
| Entry point for xsgetn&period;
| xref:bsl/basic_stringbuf/snextc-09.adoc[`snextc`] 
| Getting the next character&period;
| xref:bsl/basic_stringbuf/sputbackc-06.adoc[`sputbackc`] 
| Pushing characters back into the input stream&period;
| xref:bsl/basic_stringbuf/sputc-03.adoc[`sputc`] 
| Entry point for all single&hyphen;character output functions&period;
| xref:bsl/basic_stringbuf/sputn-0f.adoc[`sputn`] 
| Entry point for all single&hyphen;character output functions&period;
| xref:bsl/basic_stringbuf/str-0d9.adoc[`str`] 
| `str` overloads
| xref:bsl/basic_stringbuf/sungetc-0d.adoc[`sungetc`] 
| Moving backwards in the input stream&period;
| xref:bsl/basic_stringbuf/swap-08.adoc[`swap`] 
| Efficiently exchange the value of this object with `other`&period;
| xref:bsl/basic_stringbuf/view.adoc[`view`] 
| Return a view of the currently buffered sequence of characters&period;
|===


== Using Declarations

[cols="1,4"]
|===
| Name| Description
| xref:bsl/basic_stringbuf/getloc-04.adoc[`getloc`] 
| Return the currently imbued locale (inherited)&period;
| xref:bsl/basic_stringbuf/in_avail-0a.adoc[`in&lowbar;avail`] 
| Return how many characters are available in the get area (inherited)&period;
| xref:bsl/basic_stringbuf/pubimbue-004.adoc[`pubimbue`] 
| Imbue this buffer with a locale and return the previous locale (inherited)&period;
| xref:bsl/basic_stringbuf/pubseekoff-0f.adoc[`pubseekoff`] 
| Seek to a relative position in the controlled sequences (inherited)&period;
| xref:bsl/basic_stringbuf/pubseekpos-06.adoc[`pubseekpos`] 
| Seek to an absolute position in the controlled sequences (inherited)&period;
| xref:bsl/basic_stringbuf/pubsetbuf-0f.adoc[`pubsetbuf`] 
| Offer a character array as the controlled sequence (inherited)&period;
| xref:bsl/basic_stringbuf/pubsync-01.adoc[`pubsync`] 
| Synchronize the put and&sol;or get area with the underlying sequence (inherited)&period;
| xref:bsl/basic_stringbuf/sbumpc-0b.adoc[`sbumpc`] 
| Return the current get character and advance the get pointer (inherited)&period;
| xref:bsl/basic_stringbuf/sgetc-0f.adoc[`sgetc`] 
| Return the current get character without advancing (inherited)&period;
| xref:bsl/basic_stringbuf/sgetn-09.adoc[`sgetn`] 
| Read characters into a buffer (inherited)&period;
| xref:bsl/basic_stringbuf/snextc-05.adoc[`snextc`] 
| Advance the get pointer and return the next character (inherited)&period;
| xref:bsl/basic_stringbuf/sputbackc-0a.adoc[`sputbackc`] 
| Put a character back into the input sequence (inherited)&period;
| xref:bsl/basic_stringbuf/sputc-0c.adoc[`sputc`] 
| Append a character to the output sequence (inherited)&period;
| xref:bsl/basic_stringbuf/sputn-06.adoc[`sputn`] 
| Append characters to the output sequence (inherited)&period;
| xref:bsl/basic_stringbuf/sungetc-08.adoc[`sungetc`] 
| Move the get pointer back by one character (inherited)&period;
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/basic_stringbuf/operator_assign-0b.adoc[`operator&equals;`] 
| 
| xref:bsl/basic_stringbuf/__safe_gbump.adoc[`&lowbar;&lowbar;safe&lowbar;gbump`] 
| 
| xref:bsl/basic_stringbuf/__safe_pbump.adoc[`&lowbar;&lowbar;safe&lowbar;pbump`] 
| 
| xref:bsl/basic_stringbuf/eback-0a.adoc[`eback`] 
| Access to the get area&period;
| 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&period;
| xref:bsl/basic_stringbuf/gptr-05.adoc[`gptr`] 
| 
| xref:bsl/basic_stringbuf/imbue-0f.adoc[`imbue`]  [.small]#[virtual]#
| Changes translations&period;
| 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&period;
| xref:bsl/basic_stringbuf/pbump-0e.adoc[`pbump`] 
| Moving the write position&period;
| 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&period;
| xref:bsl/basic_stringbuf/setg-07.adoc[`setg`] 
| Setting the three read area pointers&period;
| xref:bsl/basic_stringbuf/setp-05.adoc[`setp`] 
| Setting the three write area pointers&period;
| xref:bsl/basic_stringbuf/showmanyc-0a.adoc[`showmanyc`]  [.small]#[virtual]#
| Investigating the data available&period;
| 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&period;
| xref:bsl/basic_stringbuf/uflow.adoc[`uflow`]  [.small]#[virtual]#
| Return the character at the current get position and advance past it&period;
| xref:bsl/basic_stringbuf/underflow.adoc[`underflow`]  [.small]#[virtual]#
| Return the character at the current get position, if any&period;
| 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[`&lowbar;M&lowbar;buf&lowbar;locale`] 
| Current locale setting&period;
| xref:bsl/basic_stringbuf/_M_in_beg.adoc[`&lowbar;M&lowbar;in&lowbar;beg`] 
| Start of get area&period;
| xref:bsl/basic_stringbuf/_M_in_cur.adoc[`&lowbar;M&lowbar;in&lowbar;cur`] 
| Current read area&period;
| xref:bsl/basic_stringbuf/_M_in_end.adoc[`&lowbar;M&lowbar;in&lowbar;end`] 
| End of get area&period;
| xref:bsl/basic_stringbuf/_M_out_beg.adoc[`&lowbar;M&lowbar;out&lowbar;beg`] 
| Start of put area&period;
| xref:bsl/basic_stringbuf/_M_out_cur.adoc[`&lowbar;M&lowbar;out&lowbar;cur`] 
| Current put area&period;
| xref:bsl/basic_stringbuf/_M_out_end.adoc[`&lowbar;M&lowbar;out&lowbar;end`] 
| End of put area&period;
|===


== Protected Using Declarations

[cols="1,4"]
|===
| Name| Description
| xref:bsl/basic_stringbuf/eback-03.adoc[`eback`] 
| Return the start of the get area (inherited)&period;
| xref:bsl/basic_stringbuf/egptr-0e.adoc[`egptr`] 
| Return the end of the get area (inherited)&period;
| xref:bsl/basic_stringbuf/epptr-00.adoc[`epptr`] 
| Return the end of the put area (inherited)&period;
| xref:bsl/basic_stringbuf/gbump-007.adoc[`gbump`] 
| Advance the get pointer by the specified number of characters (inherited)&period;
| xref:bsl/basic_stringbuf/gptr-0e.adoc[`gptr`] 
| Return the current get pointer (inherited)&period;
| xref:bsl/basic_stringbuf/imbue-0d.adoc[`imbue`] 
| Imbue this stream buffer with a locale (inherited)&period;
| xref:bsl/basic_stringbuf/operator=.adoc[`operator&equals;`] 
| Assign the get&sol;put pointers and locale from a base stream buffer (inherited)&period;
| xref:bsl/basic_stringbuf/pbase-06.adoc[`pbase`] 
| Return the start of the put area (inherited)&period;
| xref:bsl/basic_stringbuf/pbump-0c.adoc[`pbump`] 
| Advance the put pointer by the specified number of characters (inherited)&period;
| xref:bsl/basic_stringbuf/pptr-03.adoc[`pptr`] 
| Return the current put pointer (inherited)&period;
| xref:bsl/basic_stringbuf/setbuf-0b8.adoc[`setbuf`] 
| Offer a character array as the controlled sequence (inherited)&period;
| xref:bsl/basic_stringbuf/setg-09.adoc[`setg`] 
| Set the beginning, next, and end pointers of the get area (inherited)&period;
| xref:bsl/basic_stringbuf/setp-0e.adoc[`setp`] 
| Set the beginning and end pointers of the put area (inherited)&period;
| xref:bsl/basic_stringbuf/showmanyc-09.adoc[`showmanyc`] 
| Estimate how many characters can be extracted (inherited)&period;
| xref:bsl/basic_stringbuf/swap-0d.adoc[`swap`] 
| Exchange get&sol;put pointers and locale with another stream buffer (inherited)&period;
| xref:bsl/basic_stringbuf/sync-02.adoc[`sync`] 
| Synchronize the controlled sequences with the character sequence (inherited)&period;
|===


== 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&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
