C++ Library - <basic_stringbuf>
Introduction
It is a stream buffer to read from and write to basic_string objects and objects of this class maintain internally a sequence of characters that they use as their associated input sequence and/or associated output sequence. The internal sequence can be initialized from a basic_string object, or copied to one, using member str.
Definition
Below is definition of std::basic_stringbuf.
template < class charT,
class traits = char_traits<charT>,
class Alloc = allocator<charT>
> class basic_stringbuf;
Parameters
charT − Character type.
traits − Character traits class that defines essential properties of the characters used by stream objects.
int_type − Integer Type.
Alloc − Type of the allocator object used to define the storage allocation model for the basic_string objects. By default, the allocator class template is used, which defines the simplest memory allocation model and is value-independent.
Public member functions inherited from basic_streambuf
| Sr.No. | Locales & Definition |
|---|---|
| 1 |
event
Type to indicate event type |
| 2 |
event_callback
Event callback function type |
Public Member Functions
| Sr.No. | Member types & Definition |
|---|---|
| 1 |
pubimbue
It is an imbue locale |
| 2 |
getloc
It is used to get current locale |
Buffer management and positioning
| Sr.No. | Buffer management and positioning & Definition |
|---|---|
| 1 |
pubsetbuf
It is used to set buffer array |
| 2 |
pubseekoff
It is used to set internal position pointer to relative position |
| 3 |
pubseekpos
It is used to set internal position pointer to absolute position |
| 4 |
pubsync
It is used to synchronize stream buffer |
Input functions
| Sr.No. | Input functions & Definition |
|---|---|
| 1 |
in_avail
It is used to get number of character available to read |
| 2 |
snextc
It is used to advance to next position and get character |
| 3 |
sbumpc
It is used to get current character and advance to next position |
| 4 |
sgetc
It is used to get current character |
| 5 |
sgetn
It is used to get sequence of characters |
| 6 |
sputbackc
It is used to put character back |
| 7 |
sungetc
It is used to decrease current position |
Output functions
| Sr.No. | Output & Definition |
|---|---|
| 1 |
sputc
It is used to put character and advance to next position |
| 2 |
sputn
It is used to put sequence of characters |
Protected virtual function overrides
| Sr.No. | virtual function & Definition |
|---|---|
| 1 |
setbuf
It is used to set buffer |
| 2 |
seekoff
It is used to set position pointer to relative position |
| 3 |
seekpos
It is used to set position pointer to absolute position |
| 4 |
underflow
It is used to get character |
| 5 |
pbackfail
It is used to put character back |
| 6 |
overflow
It is used to put character |
Protected member functions
The following protected member functions provide access to these pointers −
Input sequence
| Sr.No. | Input sequence & Definition |
|---|---|
| 1 |
eback
It is used in pointer to beginning of input sequence |
| 2 |
gptr
It is used in pointer to current position of input sequence |
| 3 |
egptr
It is used in pointer to end of input sequence |
| 4 |
gbump
It is used to get pointer |
| 5 |
setg
It is used to set input sequence pointers |
Output sequence (put)
| Sr.No. | Output sequence & Definition |
|---|---|
| 1 |
pbase
It is used in pointer to beginning of output sequence |
| 2 |
pptr
It is used in pointer to current position of output sequence |
| 3 |
epptr
It is used in pointer to end of output sequence |
| 4 |
pbump
It is used to increase put pointer |
| 5 |
setp
It is used to set output sequence pointers |