std::basic_streambuf
cppreference.com
[] |
Google. . , . , . |
<metanoindex/>
<tbody> </tbody> template< class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT> > class basic_streambuf; |
||
basic_streambuf . () , , (, / , TCP ..). :
The class
basic_streambuf controls input and output to a character sequence. It includes and provides access to the controlled character sequence (the buffer) and, optionally, the associated character sequence (file, I/O stream, TCP socket, etc). :
- ( , std::codecvt):the character representation and encoding in the controlled sequence may be different from the character representations in the associated sequence (a std::codecvt locale facet may be necessary to perform the conversion)
- , , .:the controlled sequence may impose arbitrary limitations on reading, writing, seeking, or ungetting characters.
()
CharT , , "" . ::
The controlled character sequence (the buffer) is an array of
CharT which, at all times, represents a subsequence, or a "window" into the associated character sequence. Its state is described by three pointers:1)
,
2)
' , ,
:
The next pointer, points at the element that is the next candidate for reading or writing
3)
, .
, , ' . .
:
If the next pointer is less than the end pointer in an output sequence, a write position is available. The next pointer can be dereferenced and assigned to.
, , . .
:
If the next pointer is less than the end pointer in an input sequence, a read position is available. The next pointer can be dereferenced and read from.
, , ' Putback , , , , .
:
If the next pointer is greater than the beginning pointer in an input sequence, a putback position is available, and the next pointer may be decremented, dereferenced, and assigned to, in order to put a character back into the input sequence.
basic_streambuf ( , , ' ), (' ), / . , , .:
A
basic_streambuf object may support an input sequence (in which case the buffer described by the beginning, next, and end pointers is called get area), an output sequence (put area), or an input/output sequence. In latter case, six pointers are tracked, which may all point to elements of the same character array or two individual arrays.std::basic_streambuf CharT* std::locale . , std::basic_filebuf std::basic_stringbuf.:
Typical implementation of the
std::basic_streambuf base class holds only these six CharT* pointers and a copy of std::locale as data members. The buffers themselves are implemented by the derived classes such as std::basic_filebuf or std::basic_stringbuf.| : Consistent terminology across the pages. Probably input/output sequence, get/put area, etc. |
<streambuf> | |
| Definition | |
streambuf
|
basic_streambuf<char>
|
wstreambuf
|
basic_streambuf<wchar_t>
|
I / O std::basic_istream, std::basic_ostream , std::basic_streambuf.
:
The I/O stream objects std::basic_istream, std::basic_ostream, and derived, are implemented entirely in terms of std::basic_streambuf.
-
char_type
|
CharT
|
traits_type
|
Traits
|
int_type
|
Traits::int_type
|
pos_type
|
Traits::pos_type
|
off_type
|
Traits::off_type
|
-
[virtual] |
basic_streambuf (virtual public -) |
imbue()(public -) | |
(public -) | |
setbuf()(public -) | |
seekoff()(public -) | |
seekpos()(public -) | |
sync()(public -) | |
Get (public -) | |
, (public -) | |
(public -) | |
stossc () |
, sbumpc() (public -) |
(public -) | |
xsgetn() (public -) | |
, (public -) | |
xsputn()(public -) | |
| |
(public -) | |
(public -) | |
| |
basic_streambuf (protected -) | |
(C++11) |
basic_streambuf (protected -) |
(C++11) |
basic_streambuf (protected -) |
[virtual] |
(virtual protected -) |
[virtual] |
, (virtual protected -) |
[virtual] |
, , : repositions the next pointer in the input sequence, output sequence, or both, using relative addressing (virtual protected -) |
[virtual] |
, , : repositions the next pointer in the input sequence, output sequence, or both using absolute addressing (virtual protected -) |
[virtual] |
(virtual protected -) |
[virtual] |
, , : obtains the number of characters available for input in the associated input sequence, if known (virtual protected -) |
[virtual] |
Get (virtual protected -) |
[virtual] |
Get : reads characters from the associated input sequence to the get area and advances the next pointer (virtual protected -) |
[virtual] |
(virtual protected -) |
Get (protected -) | |
(protected -) | |
, , (protected -) | |
[virtual] |
writes multiple characters to the output sequence (virtual protected -) |
[virtual] |
(virtual protected -) |
(protected -) | |
(protected -) | |
, , (protected -) | |
| |
[virtual] |
, (virtual protected -) |