Scroll to navigation

std::basic_stringbuf< _CharT, _Traits, _Alloc >(3cxx) std::basic_stringbuf< _CharT, _Traits, _Alloc >(3cxx)

NAME

std::basic_stringbuf< _CharT, _Traits, _Alloc > - The actual work of input and output (for std::string).

SYNOPSIS

Public Types


typedef __string_type::size_type __size_type
typedef basic_streambuf< char_type, traits_type > __streambuf_type
typedef basic_string< char_type, _Traits, _Alloc > __string_type
typedef _Alloc allocator_type
typedef _CharT char_type
typedef traits_type::int_type int_type
typedef traits_type::off_type off_type
typedef traits_type::pos_type pos_type
typedef _Traits traits_type

Public Member Functions


basic_stringbuf ()
Starts with an empty string buffer. basic_stringbuf (basic_stringbuf &&__rhs)
basic_stringbuf (const __string_type &__str, ios_base::openmode __mode=ios_base::in|ios_base::out)
Starts with an existing string buffer. basic_stringbuf (const basic_stringbuf &)=delete
basic_stringbuf (ios_base::openmode __mode)
Starts with an empty string buffer. basic_stringbuf & operator= (basic_stringbuf &&__rhs)
basic_stringbuf & operator= (const basic_stringbuf &)=delete
__string_type str () const
Copying out the string buffer. void str (const __string_type &__s)
Setting a new buffer. void swap (basic_stringbuf &__rhs)

Protected Member Functions


void _M_pbump (char_type *__pbeg, char_type *__pend, off_type __off)
void _M_stringbuf_init (ios_base::openmode __mode)
void _M_sync (char_type *__base, __size_type __i, __size_type __o)
void _M_update_egptr ()
virtual int_type overflow (int_type __c=traits_type::eof())
virtual int_type pbackfail (int_type __c=traits_type::eof())
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)
virtual __streambuf_type * setbuf (char_type *__s, streamsize __n)
Manipulates the buffer. virtual streamsize showmanyc ()
virtual int_type underflow ()

Protected Attributes


ios_base::openmode _M_mode
Place to stash in || out || in | out settings for current stringbuf. __string_type _M_string

Detailed Description

template<typename _CharT, typename _Traits, typename _Alloc>

class std::basic_stringbuf< _CharT, _Traits, _Alloc >" The actual work of input and output (for std::string).

Template Parameters

_CharT Type of character stream.
_Traits Traits for character type, defaults to char_traits<_CharT>.
_Alloc Allocator type, defaults to allocator<_CharT>.

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 96 of file iosfwd.

Constructor & Destructor Documentation

template<typename _CharT , typename _Traits , typename _Alloc > std::basic_stringbuf< _CharT, _Traits, _Alloc >::basic_stringbuf () [inline]

Starts with an empty string buffer. The default constructor initializes the parent class using its own default ctor.

Definition at line 99 of file sstream.

template<typename _CharT , typename _Traits , typename _Alloc > std::basic_stringbuf< _CharT, _Traits, _Alloc >::basic_stringbuf (ios_base::openmode __mode) [inline], [explicit]

Starts with an empty string buffer.

Parameters

__mode Whether the buffer can read, or write, or both.

The default constructor initializes the parent class using its own default ctor.

Definition at line 111 of file sstream.

template<typename _CharT , typename _Traits , typename _Alloc > 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.

Parameters

__str A string to copy as a starting buffer.
__mode Whether the buffer can read, or write, or both.

This constructor initializes the parent class using its own default ctor.

Definition at line 124 of file sstream.

Member Function Documentation

template<typename _CharT , typename _Traits , typename _Alloc > virtual __streambuf_type* std::basic_stringbuf< _CharT, _Traits, _Alloc >::setbuf (char_type * __s, streamsize __n) [inline], [protected], [virtual]

Manipulates the buffer.

Parameters

__s Pointer to a buffer area.
__n Size of __s.

Returns

this

If no buffer has already been created, and both __s and __n are non-zero, then __s is used as a buffer; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering for more.

Definition at line 255 of file sstream.

template<typename _CharT , typename _Traits , typename _Alloc > __string_type std::basic_stringbuf< _CharT, _Traits, _Alloc >::str () const [inline]

Copying out the string buffer.

Returns

A copy of one of the underlying sequences.

If the buffer is only created in input mode, the underlying character sequence is equal to the input sequence; otherwise, it is equal to the output sequence. [27.7.1.2]/1

Definition at line 178 of file sstream.

template<typename _CharT , typename _Traits , typename _Alloc > void std::basic_stringbuf< _CharT, _Traits, _Alloc >::str (const __string_type & __s) [inline]

Setting a new buffer.

Parameters

__s The string to use as a new sequence.

Deallocates any previous stored sequence, then copies s to use as a new one.

Definition at line 202 of file sstream.

Member Data Documentation

template<typename _CharT , typename _Traits , typename _Alloc > ios_base::openmode std::basic_stringbuf< _CharT, _Traits, _Alloc >::_M_mode [protected]

Place to stash in || out || in | out settings for current stringbuf.

Definition at line 85 of file sstream.

Author

Generated automatically by Doxygen for libstdc++ from the source code.
Mon Jul 13 2020 libstdc++