bsl::basic_stringbuf

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.

Synopsis

Declared in <bslstl_stringbuf.h>

template<
    class CHAR_TYPE,
    class CHAR_TRAITS = char_traits<CHAR_TYPE>,
    class ALLOCATOR = allocator<CHAR_TYPE>>
class basic_stringbuf
    : public std::basic_streambuf<CHAR_TYPE, CHAR_TRAITS>

Base Classes

NameDescription
std::basic_streambuf<CHAR_TYPE, CHAR_TRAITS>The actual work of input and output (interface).

Type Aliases

NameDescription
__streambuf_type @{ This is a non-standard type.
allocator_type This typedef is an alias to the (template parameter) ALLOCATOR.
char_type This typedef is an alias to the (template parameter) CHAR_TYPE.
int_type This typedef is an alias to traits_type::int_type.
off_type This typedef is an alias to traits_type::off_type.
pos_type This typedef is an alias to traits_type::pos_type.
traits_type This typedef is an alias to the (template parameter) CHAR_TRAITS.

Member Functions

NameDescription
basic_stringbuf [constructor]Constructors
~basic_stringbuf [destructor]Destroy this object.
operator= Assign to this object the value of the specified rhs, and return a reference providing modifiable access to this object. The contents of rhs are move-assigned to this object. rhs is left in a valid but unspecified state.
get_allocator Return the allocator used by the underlying string to supply memory.
getloc Locale access.
in_avail Looking ahead into the stream.
pubimbue Entry point for imbue().
pubseekoff Alters the stream position.
pubseekpos Alters the stream position.
pubsetbuf Entry points for derived buffer functions.
pubsync Calls virtual sync function.
sbumpc Getting the next character.
sgetc Getting the next character.
sgetn Entry point for xsgetn.
snextc Getting the next character.
sputbackc Pushing characters back into the input stream.
sputc Entry point for all single-character output functions.
sputn Entry point for all single-character output functions.
str str overloads
sungetc Moving backwards in the input stream.
swap Efficiently exchange the value of this object with the value of the specified other object. This method provides the no-throw exception-safety guarantee if *this and other allocators compare equal. The behavior is undefined unless either *this and other allocators compare equal or propagate_on_container_swap is true. Note that this function is only available for C++11 (and later) language standards because it requires that swap be provided on the (platform supplied) base class for this type.
view Return a string_view containing the currently buffered sequence of characters. If this object was created only in input mode, the resultant ViewType contains the character sequence in the range [eback(), egptr())]. If modeBitMask & ios_base::out specified at construction is nonzero then the resultant StringType contains the character sequence in the range [pbase(), high_mark)], where high_mark represents the position one past the highest initialized character in the buffer. Otherwise this object has been created in neither input nor output mode and a zero length ViewType is returned.

Protected Member Functions

NameDescription
operator=
__safe_gbump
__safe_pbump
eback Access to the get area.
egptr
epptr
gbump Moving the read position.
gptr
imbue [virtual]Changes translations.
overflow overflow overloads
pbackfail pbackfail overloads
pbase Access to the put area.
pbump Moving the write position.
pptr
seekoff seekoff overloads
seekpos seekpos overloads
setbuf [virtual]Manipulates the buffer.
setg Setting the three read area pointers.
setp Setting the three write area pointers.
showmanyc [virtual]Investigating the data available.
swap
sync [virtual]Synchronizes the buffer arrays with the controlled sequences.
uflow [virtual]Return the character at the current input position and advance the input position by 1. If no character is available at the current input position, return traits_type::eof(). 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). Note that this operation is similar to underflow, but advances the current input position.
underflow [virtual]Return the character at the current input position, if a character is available, and traits_type::eof() otherwise. 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). Note that this operation is similar to uflow, but does not advance the current input position.
xsgetn xsgetn overloads
xsputn xsputn overloads

Protected Data Members

NameDescription
_M_buf_locale Current locale setting.
_M_in_beg Start of get area.
_M_in_cur Current read area.
_M_in_end End of get area.
_M_out_beg Start of put area.
_M_out_cur Current put area.
_M_out_end End of put area.

Non-Member Functions

NameDescription
swapEfficiently exchange the values of the specified a and b objects. This method provides the no-throw exception-safety guarantee if a and b allocators compare equal. Note that this function is only available for C++11 (and later) language standards.