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

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;

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

== 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;`] 
| Assign to this object the value of the specified `rhs`, and return a reference providing modifiable access to this object&period; The contents of `rhs` are move&hyphen;assigned to this object&period; `rhs` is left in a valid but unspecified state&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.adoc[`getloc`] 
| Locale access&period;
| xref:bsl/basic_stringbuf/in_avail.adoc[`in&lowbar;avail`] 
| Looking ahead into the stream&period;
| xref:bsl/basic_stringbuf/pubimbue.adoc[`pubimbue`] 
| Entry point for imbue()&period;
| xref:bsl/basic_stringbuf/pubseekoff.adoc[`pubseekoff`] 
| Alters the stream position&period;
| xref:bsl/basic_stringbuf/pubseekpos.adoc[`pubseekpos`] 
| Alters the stream position&period;
| xref:bsl/basic_stringbuf/pubsetbuf.adoc[`pubsetbuf`] 
| Entry points for derived buffer functions&period;
| xref:bsl/basic_stringbuf/pubsync.adoc[`pubsync`] 
| Calls virtual sync function&period;
| xref:bsl/basic_stringbuf/sbumpc.adoc[`sbumpc`] 
| Getting the next character&period;
| xref:bsl/basic_stringbuf/sgetc.adoc[`sgetc`] 
| Getting the next character&period;
| xref:bsl/basic_stringbuf/sgetn.adoc[`sgetn`] 
| Entry point for xsgetn&period;
| xref:bsl/basic_stringbuf/snextc.adoc[`snextc`] 
| Getting the next character&period;
| xref:bsl/basic_stringbuf/sputbackc.adoc[`sputbackc`] 
| Pushing characters back into the input stream&period;
| xref:bsl/basic_stringbuf/sputc.adoc[`sputc`] 
| Entry point for all single&hyphen;character output functions&period;
| xref:bsl/basic_stringbuf/sputn.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.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 the value of the specified `other` object&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee if `&ast;this` and `other` allocators compare equal&period; The behavior is undefined unless either `&ast;this` and `other` allocators compare equal or `propagate&lowbar;on&lowbar;container&lowbar;swap` is `true`&period; Note that this function is only available for C&plus;&plus;11 (and later) language standards because it requires that `swap` be provided on the (platform supplied) base class for this type&period;
| xref:bsl/basic_stringbuf/view.adoc[`view`] 
| Return a `string&lowbar;view` containing the currently buffered sequence of characters&period; If this object was created only in input mode, the resultant `ViewType` contains the character sequence in the range `&lsqb;eback(), egptr())&rsqb;`&period; If `modeBitMask &amp; ios&lowbar;base&colon;&colon;out` specified at construction is nonzero then the resultant `StringType` contains the character sequence in the range `&lsqb;pbase(), high&lowbar;mark)&rsqb;`, where `high&lowbar;mark` represents the position one past the highest initialized character in the buffer&period; Otherwise this object has been created in neither input nor output mode and a zero length `ViewType` is returned&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.adoc[`eback`] 
| Access to the get area&period;
| xref:bsl/basic_stringbuf/egptr.adoc[`egptr`] 
| 
| xref:bsl/basic_stringbuf/epptr.adoc[`epptr`] 
| 
| xref:bsl/basic_stringbuf/gbump.adoc[`gbump`] 
| Moving the read position&period;
| xref:bsl/basic_stringbuf/gptr.adoc[`gptr`] 
| 
| xref:bsl/basic_stringbuf/imbue.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.adoc[`pbase`] 
| Access to the put area&period;
| xref:bsl/basic_stringbuf/pbump.adoc[`pbump`] 
| Moving the write position&period;
| xref:bsl/basic_stringbuf/pptr.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.adoc[`setbuf`]  [.small]#[virtual]#
| Manipulates the buffer&period;
| xref:bsl/basic_stringbuf/setg.adoc[`setg`] 
| Setting the three read area pointers&period;
| xref:bsl/basic_stringbuf/setp.adoc[`setp`] 
| Setting the three write area pointers&period;
| xref:bsl/basic_stringbuf/showmanyc.adoc[`showmanyc`]  [.small]#[virtual]#
| Investigating the data available&period;
| xref:bsl/basic_stringbuf/swap-00.adoc[`swap`] 
| 
| xref:bsl/basic_stringbuf/sync.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 input position and advance the input position by 1&period; If no character is available at the current input position, return `traits&lowbar;type&colon;&colon;eof()`&period; Update the end of the input area, `egptr`, if additional characters are available (as may occur if additional characters have been written to the string buffer)&period; Note that this operation is similar to `underflow`, but advances the current input position&period;
| xref:bsl/basic_stringbuf/underflow.adoc[`underflow`]  [.small]#[virtual]#
| Return the character at the current input position, if a character is available, and `traits&lowbar;type&colon;&colon;eof()` otherwise&period; Update the end of the input area, `egptr`, if additional characters are available (as may occur if additional characters have been written to the string buffer)&period; Note that this operation is similar to `uflow`, but does not advance the current input position&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;
|===


== 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; This method provides the no&hyphen;throw exception&hyphen;safety guarantee if `a` and `b` allocators compare equal&period; Note that this function is only available for C&plus;&plus;11 (and later) language standards&period;
|===


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