.TH "std::basic_streambuf< _CharT, _Traits >" 3cxx "Tue Feb 2 2021" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::basic_streambuf< _CharT, _Traits > \- The actual work of input and output (interface)\&. .SH SYNOPSIS .br .PP .PP Inherited by \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, \fBstd::basic_filebuf< char_type, traits_type >\fP, \fBstd::basic_filebuf< _CharT, _Traits >\fP, and \fBstd::basic_stringbuf< _CharT, _Traits, _Alloc >\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "typedef \fBbasic_streambuf\fP< \fBchar_type\fP, traits_type > \fB__streambuf_type\fP" .br .RI "This is a non-standard type\&. " .ti -1c .RI "typedef _CharT \fBchar_type\fP" .br .ti -1c .RI "typedef traits_type::int_type \fBint_type\fP" .br .ti -1c .RI "typedef traits_type::off_type \fBoff_type\fP" .br .ti -1c .RI "typedef traits_type::pos_type \fBpos_type\fP" .br .ti -1c .RI "typedef _Traits \fBtraits_type\fP" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "virtual \fB~basic_streambuf\fP ()" .br .RI "Destructor deallocates no buffer space\&. " .ti -1c .RI "\fBlocale\fP \fBgetloc\fP () const" .br .RI "Locale access\&. " .ti -1c .RI "\fBstreamsize\fP \fBin_avail\fP ()" .br .RI "Looking ahead into the stream\&. " .ti -1c .RI "\fBlocale\fP \fBpubimbue\fP (const \fBlocale\fP &__loc)" .br .RI "Entry point for imbue()\&. " .ti -1c .RI "pos_type \fBpubseekoff\fP (off_type __off, \fBios_base::seekdir\fP __way, \fBios_base::openmode\fP __mode=\fBios_base::in\fP|\fBios_base::out\fP)" .br .RI "Alters the stream position\&. " .ti -1c .RI "pos_type \fBpubseekpos\fP (pos_type __sp, \fBios_base::openmode\fP __mode=\fBios_base::in\fP|\fBios_base::out\fP)" .br .RI "Alters the stream position\&. " .ti -1c .RI "\fBbasic_streambuf\fP * \fBpubsetbuf\fP (\fBchar_type\fP *__s, \fBstreamsize\fP __n)" .br .RI "Entry points for derived buffer functions\&. " .ti -1c .RI "int \fBpubsync\fP ()" .br .RI "Calls virtual sync function\&. " .ti -1c .RI "int_type \fBsbumpc\fP ()" .br .RI "Getting the next character\&. " .ti -1c .RI "int_type \fBsgetc\fP ()" .br .RI "Getting the next character\&. " .ti -1c .RI "\fBstreamsize\fP \fBsgetn\fP (\fBchar_type\fP *__s, \fBstreamsize\fP __n)" .br .RI "Entry point for xsgetn\&. " .ti -1c .RI "int_type \fBsnextc\fP ()" .br .RI "Getting the next character\&. " .ti -1c .RI "int_type \fBsputbackc\fP (\fBchar_type\fP __c)" .br .RI "Pushing characters back into the input stream\&. " .ti -1c .RI "int_type \fBsputc\fP (\fBchar_type\fP __c)" .br .RI "Entry point for all single-character output functions\&. " .ti -1c .RI "\fBstreamsize\fP \fBsputn\fP (const \fBchar_type\fP *__s, \fBstreamsize\fP __n)" .br .RI "Entry point for all single-character output functions\&. " .ti -1c .RI "int_type \fBsungetc\fP ()" .br .RI "Moving backwards in the input stream\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "\fBbasic_streambuf\fP ()" .br .RI "Base constructor\&. " .ti -1c .RI "\fBbasic_streambuf\fP (const \fBbasic_streambuf\fP &)" .br .ti -1c .RI "void \fB__safe_gbump\fP (\fBstreamsize\fP __n)" .br .ti -1c .RI "void \fB__safe_pbump\fP (\fBstreamsize\fP __n)" .br .ti -1c .RI "\fBchar_type\fP * \fBeback\fP () const" .br .RI "Access to the get area\&. " .ti -1c .RI "\fBchar_type\fP * \fBegptr\fP () const" .br .ti -1c .RI "\fBchar_type\fP * \fBepptr\fP () const" .br .ti -1c .RI "void \fBgbump\fP (int __n)" .br .RI "Moving the read position\&. " .ti -1c .RI "\fBchar_type\fP * \fBgptr\fP () const" .br .ti -1c .RI "virtual void \fBimbue\fP (const \fBlocale\fP &__loc __attribute__((__unused__)))" .br .RI "Changes translations\&. " .ti -1c .RI "\fBbasic_streambuf\fP & \fBoperator=\fP (const \fBbasic_streambuf\fP &)" .br .ti -1c .RI "virtual int_type \fBoverflow\fP (int_type __c __attribute__((__unused__))=traits_type::eof())" .br .RI "Consumes data from the buffer; writes to the controlled sequence\&. " .ti -1c .RI "virtual int_type \fBpbackfail\fP (int_type __c __attribute__((__unused__))=traits_type::eof())" .br .RI "Tries to back up the input sequence\&. " .ti -1c .RI "\fBchar_type\fP * \fBpbase\fP () const" .br .RI "Access to the put area\&. " .ti -1c .RI "void \fBpbump\fP (int __n)" .br .RI "Moving the write position\&. " .ti -1c .RI "\fBchar_type\fP * \fBpptr\fP () const" .br .ti -1c .RI "virtual pos_type \fBseekoff\fP (off_type, \fBios_base::seekdir\fP, \fBios_base::openmode\fP=\fBios_base::in\fP|\fBios_base::out\fP)" .br .RI "Alters the stream positions\&. " .ti -1c .RI "virtual pos_type \fBseekpos\fP (pos_type, \fBios_base::openmode\fP=\fBios_base::in\fP|\fBios_base::out\fP)" .br .RI "Alters the stream positions\&. " .ti -1c .RI "virtual \fBbasic_streambuf\fP< \fBchar_type\fP, _Traits > * \fBsetbuf\fP (\fBchar_type\fP *, \fBstreamsize\fP)" .br .RI "Manipulates the buffer\&. " .ti -1c .RI "void \fBsetg\fP (\fBchar_type\fP *__gbeg, \fBchar_type\fP *__gnext, \fBchar_type\fP *__gend)" .br .RI "Setting the three read area pointers\&. " .ti -1c .RI "void \fBsetp\fP (\fBchar_type\fP *__pbeg, \fBchar_type\fP *__pend)" .br .RI "Setting the three write area pointers\&. " .ti -1c .RI "virtual \fBstreamsize\fP \fBshowmanyc\fP ()" .br .RI "Investigating the data available\&. " .ti -1c .RI "void \fBswap\fP (\fBbasic_streambuf\fP &__sb)" .br .ti -1c .RI "virtual int \fBsync\fP ()" .br .RI "Synchronizes the buffer arrays with the controlled sequences\&. " .ti -1c .RI "virtual int_type \fBuflow\fP ()" .br .RI "Fetches more data from the controlled sequence\&. " .ti -1c .RI "virtual int_type \fBunderflow\fP ()" .br .RI "Fetches more data from the controlled sequence\&. " .ti -1c .RI "virtual \fBstreamsize\fP \fBxsgetn\fP (\fBchar_type\fP *__s, \fBstreamsize\fP __n)" .br .RI "Multiple character extraction\&. " .ti -1c .RI "virtual \fBstreamsize\fP \fBxsputn\fP (const \fBchar_type\fP *__s, \fBstreamsize\fP __n)" .br .RI "Multiple character insertion\&. " .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "\fBlocale\fP \fB_M_buf_locale\fP" .br .RI "Current locale setting\&. " .ti -1c .RI "\fBchar_type\fP * \fB_M_in_beg\fP" .br .RI "Start of get area\&. " .ti -1c .RI "\fBchar_type\fP * \fB_M_in_cur\fP" .br .RI "Current read area\&. " .ti -1c .RI "\fBchar_type\fP * \fB_M_in_end\fP" .br .RI "End of get area\&. " .ti -1c .RI "\fBchar_type\fP * \fB_M_out_beg\fP" .br .RI "Start of put area\&. " .ti -1c .RI "\fBchar_type\fP * \fB_M_out_cur\fP" .br .RI "Current put area\&. " .ti -1c .RI "\fBchar_type\fP * \fB_M_out_end\fP" .br .RI "End of put area\&. " .in -1c .SS "Friends" .in +1c .ti -1c .RI "template __gnu_cxx::__enable_if< __is_char< _CharT2 >::__value, _CharT2 * >::__type \fB__copy_move_a2\fP (\fBistreambuf_iterator\fP< _CharT2 >, \fBistreambuf_iterator\fP< _CharT2 >, _CharT2 *)" .br .ti -1c .RI "\fBstreamsize\fP \fB__copy_streambufs_eof\fP (\fBbasic_streambuf\fP *, \fBbasic_streambuf\fP *, bool &)" .br .ti -1c .RI "template __gnu_cxx::__enable_if< __is_char< _CharT2 >::__value, void >::__type \fBadvance\fP (\fBistreambuf_iterator\fP< _CharT2 > &, _Distance)" .br .ti -1c .RI "class \fBbasic_ios< char_type, traits_type >\fP" .br .ti -1c .RI "class \fBbasic_istream< char_type, traits_type >\fP" .br .ti -1c .RI "class \fBbasic_ostream< char_type, traits_type >\fP" .br .ti -1c .RI "template __gnu_cxx::__enable_if< __is_char< _CharT2 >::__value, \fBistreambuf_iterator\fP< _CharT2 > >::__type \fBfind\fP (\fBistreambuf_iterator\fP< _CharT2 >, \fBistreambuf_iterator\fP< _CharT2 >, const _CharT2 &)" .br .ti -1c .RI "template \fBbasic_istream\fP< _CharT2, _Traits2 > & \fBgetline\fP (\fBbasic_istream\fP< _CharT2, _Traits2 > &, \fBbasic_string\fP< _CharT2, _Traits2, _Alloc > &, _CharT2)" .br .ti -1c .RI "class \fBistreambuf_iterator< char_type, traits_type >\fP" .br .ti -1c .RI "template \fBbasic_istream\fP< _CharT2, _Traits2 > & \fBoperator>>\fP (\fBbasic_istream\fP< _CharT2, _Traits2 > &, _CharT2 *)" .br .ti -1c .RI "template \fBbasic_istream\fP< _CharT2, _Traits2 > & \fBoperator>>\fP (\fBbasic_istream\fP< _CharT2, _Traits2 > &, \fBbasic_string\fP< _CharT2, _Traits2, _Alloc > &)" .br .ti -1c .RI "class \fBostreambuf_iterator< char_type, traits_type >\fP" .br .in -1c .SH "Detailed Description" .PP .SS "template .br class std::basic_streambuf< _CharT, _Traits >" The actual work of input and output (interface)\&. .PP \fBTemplate Parameters\fP .RS 4 \fI_CharT\fP Type of character stream\&. .br \fI_Traits\fP Traits for character type, defaults to char_traits<_CharT>\&. .RE .PP This is a base class\&. Derived stream buffers each control a pair of character sequences: one for input, and one for output\&. .PP Section [27\&.5\&.1] of the standard describes the requirements and behavior of stream buffer classes\&. That section (three paragraphs) is reproduced here, for simplicity and accuracy\&. .PP .IP "1." 4 Stream buffers can impose various constraints on the sequences they control\&. Some constraints are: .IP " \(bu" 4 The controlled input sequence can be not readable\&. .IP " \(bu" 4 The controlled output sequence can be not writable\&. .IP " \(bu" 4 The controlled sequences can be associated with the contents of other representations for character sequences, such as external files\&. .IP " \(bu" 4 The controlled sequences can support operations \fIdirectly\fP to or from associated sequences\&. .IP " \(bu" 4 The controlled sequences can impose limitations on how the program can read characters from a sequence, write characters to a sequence, put characters back into an input sequence, or alter the stream position\&. .PP .PP .IP "1." 4 Each sequence is characterized by three pointers which, if non-null, all point into the same \fCcharT\fP array object\&. The array object represents, at any moment, a (sub)sequence of characters from the sequence\&. Operations performed on a sequence alter the values stored in these pointers, perform reads and writes directly to or from associated sequences, and alter \fIthe stream position\fP and conversion state as needed to maintain this subsequence relationship\&. The three pointers are: .IP " \(bu" 4 the \fIbeginning pointer\fP, or lowest element address in the array (called \fIxbeg\fP here); .IP " \(bu" 4 the \fInext pointer\fP, or next element address that is a current candidate for reading or writing (called \fIxnext\fP here); .IP " \(bu" 4 the \fIend pointer\fP, or first element address beyond the end of the array (called \fIxend\fP here)\&. .PP .PP .IP "1." 4 The following semantic constraints shall always apply for any set of three pointers for a sequence, using the pointer names given immediately above: .IP " \(bu" 4 If \fIxnext\fP is not a null pointer, then \fIxbeg\fP and \fIxend\fP shall also be non-null pointers into the same \fCcharT\fP array, as described above; otherwise, \fIxbeg\fP and \fIxend\fP shall also be null\&. .IP " \(bu" 4 If \fIxnext\fP is not a null pointer and \fIxnext\fP < \fIxend\fP for an output sequence, then a \fIwrite position\fP is available\&. In this case, \fI*xnext\fP shall be assignable as the next element to write (to put, or to store a character value, into the sequence)\&. .IP " \(bu" 4 If \fIxnext\fP is not a null pointer and \fIxbeg\fP < \fIxnext\fP for an input sequence, then a \fIputback position\fP is available\&. In this case, \fIxnext\fP[-1] shall have a defined value and is the next (preceding) element to store a character that is put back into the input sequence\&. .IP " \(bu" 4 If \fIxnext\fP is not a null pointer and \fIxnext<\fP \fIxend\fP for an input sequence, then a \fIread position\fP is available\&. In this case, \fI*xnext\fP shall have a defined value and is the next element to read (to get, or to obtain a character value, from the sequence)\&. .PP .PP .PP Definition at line 122 of file streambuf\&. .SH "Member Typedef Documentation" .PP .SS "template typedef \fBbasic_streambuf\fP<\fBchar_type\fP, traits_type> \fBstd::basic_streambuf\fP< _CharT, _Traits >::\fB__streambuf_type\fP" .PP This is a non-standard type\&. .PP Definition at line 140 of file streambuf\&. .SS "template typedef _CharT \fBstd::basic_streambuf\fP< _CharT, _Traits >::\fBchar_type\fP" These are standard types\&. They permit a standardized way of referring to names of (or names dependent on) the template parameters, which are specific to the implementation\&. .PP Definition at line 131 of file streambuf\&. .SH "Constructor & Destructor Documentation" .PP .SS "template virtual \fBstd::basic_streambuf\fP< _CharT, _Traits >::~\fBbasic_streambuf\fP ()\fC [inline]\fP, \fC [virtual]\fP" .PP Destructor deallocates no buffer space\&. .PP Definition at line 204 of file streambuf\&. .SS "template \fBstd::basic_streambuf\fP< _CharT, _Traits >::\fBbasic_streambuf\fP ()\fC [inline]\fP, \fC [protected]\fP" .PP Base constructor\&. Only called from derived constructors, and sets up all the buffer data to zero, including the pointers described in the basic_streambuf class description\&. Note that, as a result, .IP "\(bu" 2 the class starts with no read nor write positions available, .IP "\(bu" 2 this is not an error .PP .PP Definition at line 470 of file streambuf\&. .SH "Member Function Documentation" .PP .SS "template \fBchar_type\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::eback () const\fC [inline]\fP, \fC [protected]\fP" .PP Access to the get area\&. These functions are only available to other protected functions, including derived classes\&. .PP .IP "\(bu" 2 eback() returns the beginning pointer for the input sequence .IP "\(bu" 2 gptr() returns the next pointer for the input sequence .IP "\(bu" 2 egptr() returns the end pointer for the input sequence .PP .PP Definition at line 489 of file streambuf\&. .SS "template void \fBstd::basic_streambuf\fP< _CharT, _Traits >::gbump (int __n)\fC [inline]\fP, \fC [protected]\fP" .PP Moving the read position\&. .PP \fBParameters\fP .RS 4 \fI__n\fP The delta by which to move\&. .RE .PP This just advances the read position without returning any data\&. .PP Definition at line 505 of file streambuf\&. .SS "template \fBlocale\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::getloc () const\fC [inline]\fP" .PP Locale access\&. .PP \fBReturns\fP .RS 4 The current locale in effect\&. .RE .PP If pubimbue(loc) has been called, then the most recent \fCloc\fP is returned\&. Otherwise the global locale in effect at the time of construction is returned\&. .PP Definition at line 233 of file streambuf\&. .SS "template virtual void \fBstd::basic_streambuf\fP< _CharT, _Traits >::imbue (const \fBlocale\fP &__loc __attribute__(__unused__))\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Changes translations\&. .PP \fBParameters\fP .RS 4 \fI__loc\fP A new locale\&. .RE .PP Translations done during I/O which depend on the current locale are changed by this call\&. The standard adds, \fIBetween invocations of this function a class derived from streambuf can safely cache results of calls to locale functions and to members of facets so obtained\&.\fP .PP \fBNote\fP .RS 4 Base class version does nothing\&. .RE .PP .PP Definition at line 583 of file streambuf\&. .SS "template \fBstreamsize\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::in_avail ()\fC [inline]\fP" .PP Looking ahead into the stream\&. .PP \fBReturns\fP .RS 4 The number of characters available\&. .RE .PP If a read position is available, returns the number of characters available for reading before the buffer must be refilled\&. Otherwise returns the derived \fCshowmanyc()\fP\&. .PP Definition at line 291 of file streambuf\&. .SS "template virtual int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::overflow (int_type __c __attribute__(__unused__) = \fCtraits_type::eof()\fP)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Consumes data from the buffer; writes to the controlled sequence\&. .PP \fBParameters\fP .RS 4 \fI__c\fP An additional character to consume\&. .RE .PP \fBReturns\fP .RS 4 eof() to indicate failure, something else (usually \fI__c\fP, or not_eof()) .RE .PP Informally, this function is called when the output buffer is full (or does not exist, as buffering need not actually be done)\&. If a buffer exists, it is \fIconsumed\fP, with \fIsome effect\fP on the controlled sequence\&. (Typically, the buffer is written out to the sequence verbatim\&.) In either case, the character \fIc\fP is also written out, if \fI__c\fP is not \fCeof()\fP\&. .PP For a formal definition of this function, see a good text such as Langer & Kreft, or [27\&.5\&.2\&.4\&.5]/3-7\&. .PP A functioning output streambuf can be created by overriding only this function (no buffer area will be used)\&. .PP \fBNote\fP .RS 4 Base class version does nothing, returns eof()\&. .RE .PP .PP Definition at line 775 of file streambuf\&. .SS "template virtual int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::pbackfail (int_type __c __attribute__(__unused__) = \fCtraits_type::eof()\fP)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Tries to back up the input sequence\&. .PP \fBParameters\fP .RS 4 \fI__c\fP The character to be inserted back into the sequence\&. .RE .PP \fBReturns\fP .RS 4 eof() on failure, \fIsome other value\fP on success .RE .PP \fBPostcondition\fP .RS 4 The constraints of \fCgptr()\fP, \fCeback()\fP, and \fCpptr()\fP are the same as for \fCunderflow()\fP\&. .RE .PP \fBNote\fP .RS 4 Base class version does nothing, returns eof()\&. .RE .PP .PP Definition at line 731 of file streambuf\&. .SS "template \fBchar_type\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::pbase () const\fC [inline]\fP, \fC [protected]\fP" .PP Access to the put area\&. These functions are only available to other protected functions, including derived classes\&. .PP .IP "\(bu" 2 pbase() returns the beginning pointer for the output sequence .IP "\(bu" 2 pptr() returns the next pointer for the output sequence .IP "\(bu" 2 epptr() returns the end pointer for the output sequence .PP .PP Definition at line 536 of file streambuf\&. .SS "template void \fBstd::basic_streambuf\fP< _CharT, _Traits >::pbump (int __n)\fC [inline]\fP, \fC [protected]\fP" .PP Moving the write position\&. .PP \fBParameters\fP .RS 4 \fI__n\fP The delta by which to move\&. .RE .PP This just advances the write position without returning any data\&. .PP Definition at line 552 of file streambuf\&. .SS "template \fBlocale\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::pubimbue (const \fBlocale\fP & __loc)\fC [inline]\fP" .PP Entry point for imbue()\&. .PP \fBParameters\fP .RS 4 \fI__loc\fP The new locale\&. .RE .PP \fBReturns\fP .RS 4 The previous locale\&. .RE .PP Calls the derived imbue(__loc)\&. .PP Definition at line 216 of file streambuf\&. .SS "template pos_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::pubseekoff (off_type __off, \fBios_base::seekdir\fP __way, \fBios_base::openmode\fP __mode = \fC\fBios_base::in\fP | \fBios_base::out\fP\fP)\fC [inline]\fP" .PP Alters the stream position\&. .PP \fBParameters\fP .RS 4 \fI__off\fP Offset\&. .br \fI__way\fP Value for ios_base::seekdir\&. .br \fI__mode\fP Value for ios_base::openmode\&. .RE .PP Calls virtual seekoff function\&. .PP Definition at line 258 of file streambuf\&. .SS "template pos_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::pubseekpos (pos_type __sp, \fBios_base::openmode\fP __mode = \fC\fBios_base::in\fP | \fBios_base::out\fP\fP)\fC [inline]\fP" .PP Alters the stream position\&. .PP \fBParameters\fP .RS 4 \fI__sp\fP Position .br \fI__mode\fP Value for ios_base::openmode\&. .RE .PP Calls virtual seekpos function\&. .PP Definition at line 270 of file streambuf\&. .SS "template \fBbasic_streambuf\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::pubsetbuf (\fBchar_type\fP * __s, \fBstreamsize\fP __n)\fC [inline]\fP" .PP Entry points for derived buffer functions\&. The public versions of \fCpubfoo\fP dispatch to the protected derived \fCfoo\fP member functions, passing the arguments (if any) and returning the result unchanged\&. .PP Definition at line 246 of file streambuf\&. .SS "template int \fBstd::basic_streambuf\fP< _CharT, _Traits >::pubsync ()\fC [inline]\fP" .PP Calls virtual sync function\&. .PP Definition at line 278 of file streambuf\&. .PP Referenced by std::wbuffer_convert< _Codecvt, _Elem, _Tr >::sync()\&. .SS "template int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::sbumpc ()\fC [inline]\fP" .PP Getting the next character\&. .PP \fBReturns\fP .RS 4 The next character, or eof\&. .RE .PP If the input read position is available, returns that character and increments the read pointer, otherwise calls and returns \fCuflow()\fP\&. .PP Definition at line 323 of file streambuf\&. .PP Referenced by std::basic_istream< char >::getline(), and std::basic_istream< char >::seekg()\&. .SS "template virtual pos_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::seekoff (off_type, \fBios_base::seekdir\fP, \fBios_base::openmode\fP = \fC\fBios_base::in\fP | \fBios_base::out\fP\fP)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Alters the stream positions\&. Each derived class provides its own appropriate behavior\&. .PP \fBNote\fP .RS 4 Base class version does nothing, returns a \fCpos_type\fP that represents an invalid stream position\&. .RE .PP .PP Reimplemented in \fBstd::basic_stringbuf< _CharT, _Traits, _Alloc >\fP, \fBstd::basic_filebuf< _CharT, _Traits >\fP, \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, and \fBstd::basic_filebuf< char_type, traits_type >\fP\&. .PP Definition at line 609 of file streambuf\&. .SS "template virtual pos_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::seekpos (pos_type, \fBios_base::openmode\fP = \fC\fBios_base::in\fP | \fBios_base::out\fP\fP)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Alters the stream positions\&. Each derived class provides its own appropriate behavior\&. .PP \fBNote\fP .RS 4 Base class version does nothing, returns a \fCpos_type\fP that represents an invalid stream position\&. .RE .PP .PP Reimplemented in \fB__gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >\fP, \fBstd::basic_stringbuf< _CharT, _Traits, _Alloc >\fP, \fBstd::basic_filebuf< _CharT, _Traits >\fP, \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, and \fBstd::basic_filebuf< char_type, traits_type >\fP\&. .PP Definition at line 621 of file streambuf\&. .SS "template virtual \fBbasic_streambuf\fP<\fBchar_type\fP,_Traits>* \fBstd::basic_streambuf\fP< _CharT, _Traits >::setbuf (\fBchar_type\fP *, \fBstreamsize\fP)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Manipulates the buffer\&. Each derived class provides its own appropriate behavior\&. See the next-to-last paragraph of https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering for more on this function\&. .PP \fBNote\fP .RS 4 Base class version does nothing, returns \fCthis\fP\&. .RE .PP .PP Reimplemented in \fBstd::basic_stringbuf< _CharT, _Traits, _Alloc >\fP, \fBstd::basic_filebuf< _CharT, _Traits >\fP, \fBstd::basic_filebuf< _CharT, std::char_traits< _CharT > >\fP, \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, and \fBstd::basic_filebuf< char_type, traits_type >\fP\&. .PP Definition at line 598 of file streambuf\&. .SS "template void \fBstd::basic_streambuf\fP< _CharT, _Traits >::setg (\fBchar_type\fP * __gbeg, \fBchar_type\fP * __gnext, \fBchar_type\fP * __gend)\fC [inline]\fP, \fC [protected]\fP" .PP Setting the three read area pointers\&. .PP \fBParameters\fP .RS 4 \fI__gbeg\fP A pointer\&. .br \fI__gnext\fP A pointer\&. .br \fI__gend\fP A pointer\&. .RE .PP \fBPostcondition\fP .RS 4 \fI__gbeg\fP == \fCeback()\fP, \fI__gnext\fP == \fCgptr()\fP, and \fI__gend\fP == \fCegptr()\fP .RE .PP .PP Definition at line 516 of file streambuf\&. .SS "template void \fBstd::basic_streambuf\fP< _CharT, _Traits >::setp (\fBchar_type\fP * __pbeg, \fBchar_type\fP * __pend)\fC [inline]\fP, \fC [protected]\fP" .PP Setting the three write area pointers\&. .PP \fBParameters\fP .RS 4 \fI__pbeg\fP A pointer\&. .br \fI__pend\fP A pointer\&. .RE .PP \fBPostcondition\fP .RS 4 \fI__pbeg\fP == \fCpbase()\fP, \fI__pbeg\fP == \fCpptr()\fP, and \fI__pend\fP == \fCepptr()\fP .RE .PP .PP Definition at line 562 of file streambuf\&. .SS "template int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::sgetc ()\fC [inline]\fP" .PP Getting the next character\&. .PP \fBReturns\fP .RS 4 The next character, or eof\&. .RE .PP If the input read position is available, returns that character, otherwise calls and returns \fCunderflow()\fP\&. Does not move the read position after fetching the character\&. .PP Definition at line 345 of file streambuf\&. .PP Referenced by std::basic_istream< char >::getline(), and std::basic_istream< char >::tellg()\&. .SS "template \fBstreamsize\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::sgetn (\fBchar_type\fP * __s, \fBstreamsize\fP __n)\fC [inline]\fP" .PP Entry point for xsgetn\&. .PP \fBParameters\fP .RS 4 \fI__s\fP A buffer area\&. .br \fI__n\fP A count\&. .RE .PP Returns xsgetn(__s,__n)\&. The effect is to fill \fI__s\fP[0] through \fI__s\fP[__n-1] with characters from the input sequence, if possible\&. .PP Definition at line 364 of file streambuf\&. .SS "template virtual \fBstreamsize\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::showmanyc ()\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Investigating the data available\&. .PP \fBReturns\fP .RS 4 An estimate of the number of characters available in the input sequence, or -1\&. .RE .PP \fIIf it returns a positive value, then successive calls to \fCunderflow()\fP will not return \fCtraits::eof()\fP until at least that number of characters have been supplied\&. If \fCshowmanyc()\fP returns -1, then calls to \fCunderflow()\fP or \fCuflow()\fP will fail\&.\fP [27\&.5\&.2\&.4\&.3]/1 .PP \fBNote\fP .RS 4 Base class version does nothing, returns zero\&. .PP The standard adds that \fIthe intention is not only that the calls [to underflow or uflow] will not return \fCeof()\fP but that they will return immediately\&.\fP .PP The standard adds that \fIthe morphemes of \fCshowmanyc\fP are \fBes-how-many-see\fP, not \fBshow-manic\fP\&.\fP .RE .PP .PP Reimplemented in \fBstd::basic_stringbuf< _CharT, _Traits, _Alloc >\fP, \fBstd::basic_filebuf< _CharT, _Traits >\fP, \fBstd::basic_filebuf< _CharT, std::char_traits< _CharT > >\fP, \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, and \fBstd::basic_filebuf< char_type, traits_type >\fP\&. .PP Definition at line 656 of file streambuf\&. .SS "template int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::snextc ()\fC [inline]\fP" .PP Getting the next character\&. .PP \fBReturns\fP .RS 4 The next character, or eof\&. .RE .PP Calls \fCsbumpc()\fP, and if that function returns \fCtraits::eof()\fP, so does this function\&. Otherwise, \fCsgetc()\fP\&. .PP Definition at line 305 of file streambuf\&. .PP Referenced by std::basic_istream< char >::getline(), std::basic_istream< char >::putback(), and std::basic_istream< char >::tellg()\&. .SS "template int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::sputbackc (\fBchar_type\fP __c)\fC [inline]\fP" .PP Pushing characters back into the input stream\&. .PP \fBParameters\fP .RS 4 \fI__c\fP The character to push back\&. .RE .PP \fBReturns\fP .RS 4 The previous character, if possible\&. .RE .PP Similar to sungetc(), but \fI__c\fP is pushed onto the stream instead of \fIthe previous character\&.\fP If successful, the next character fetched from the input stream will be \fI__c\fP\&. .PP Definition at line 379 of file streambuf\&. .SS "template int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::sputc (\fBchar_type\fP __c)\fC [inline]\fP" .PP Entry point for all single-character output functions\&. .PP \fBParameters\fP .RS 4 \fI__c\fP A character to output\&. .RE .PP \fBReturns\fP .RS 4 \fI__c\fP, if possible\&. .RE .PP One of two public output functions\&. .PP If a write position is available for the output sequence (i\&.e\&., the buffer is not full), stores \fI__c\fP in that position, increments the position, and returns \fCtraits::to_int_type(__c)\fP\&. If a write position is not available, returns \fCoverflow(__c)\fP\&. .PP Definition at line 431 of file streambuf\&. .PP Referenced by std::ostreambuf_iterator< _CharT, _Traits >::operator=()\&. .SS "template \fBstreamsize\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::sputn (const \fBchar_type\fP * __s, \fBstreamsize\fP __n)\fC [inline]\fP" .PP Entry point for all single-character output functions\&. .PP \fBParameters\fP .RS 4 \fI__s\fP A buffer read area\&. .br \fI__n\fP A count\&. .RE .PP One of two public output functions\&. .PP Returns xsputn(__s,__n)\&. The effect is to write \fI__s\fP[0] through \fI__s\fP[__n-1] to the output sequence, if possible\&. .PP Definition at line 457 of file streambuf\&. .SS "template int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::sungetc ()\fC [inline]\fP" .PP Moving backwards in the input stream\&. .PP \fBReturns\fP .RS 4 The previous character, if possible\&. .RE .PP If a putback position is available, this function decrements the input pointer and returns that character\&. Otherwise, calls and returns pbackfail()\&. The effect is to \fIunget\fP the last character \fIgotten\fP\&. .PP Definition at line 404 of file streambuf\&. .SS "template virtual int \fBstd::basic_streambuf\fP< _CharT, _Traits >::sync (void)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Synchronizes the buffer arrays with the controlled sequences\&. .PP \fBReturns\fP .RS 4 -1 on failure\&. .RE .PP Each derived class provides its own appropriate behavior, including the definition of \fIfailure\fP\&. .PP \fBNote\fP .RS 4 Base class version does nothing, returns zero\&. .RE .PP .PP Reimplemented in \fBstd::basic_filebuf< _CharT, _Traits >\fP, \fBstd::basic_filebuf< _CharT, std::char_traits< _CharT > >\fP, \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, \fBstd::basic_filebuf< char_type, traits_type >\fP, \fB__gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >\fP, and \fBstd::wbuffer_convert< _Codecvt, _Elem, _Tr >\fP\&. .PP Definition at line 634 of file streambuf\&. .SS "template virtual int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::uflow ()\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Fetches more data from the controlled sequence\&. .PP \fBReturns\fP .RS 4 The first character from the \fIpending sequence\fP\&. .RE .PP Informally, this function does the same thing as \fCunderflow()\fP, and in fact is required to call that function\&. It also returns the new character, like \fCunderflow()\fP does\&. However, this function also moves the read position forward by one\&. .PP Reimplemented in \fB__gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >\fP\&. .PP Definition at line 707 of file streambuf\&. .SS "template virtual int_type \fBstd::basic_streambuf\fP< _CharT, _Traits >::underflow ()\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Fetches more data from the controlled sequence\&. .PP \fBReturns\fP .RS 4 The first character from the \fIpending sequence\fP\&. .RE .PP Informally, this function is called when the input buffer is exhausted (or does not exist, as buffering need not actually be done)\&. If a buffer exists, it is \fIrefilled\fP\&. In either case, the next available character is returned, or \fCtraits::eof()\fP to indicate a null pending sequence\&. .PP For a formal definition of the pending sequence, see a good text such as Langer & Kreft, or [27\&.5\&.2\&.4\&.3]/7-14\&. .PP A functioning input streambuf can be created by overriding only this function (no buffer area will be used)\&. For an example, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html .PP \fBNote\fP .RS 4 Base class version does nothing, returns eof()\&. .RE .PP .PP Reimplemented in \fBstd::basic_stringbuf< _CharT, _Traits, _Alloc >\fP, \fBstd::basic_filebuf< _CharT, _Traits >\fP, \fBstd::basic_filebuf< _CharT, std::char_traits< _CharT > >\fP, \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, \fBstd::basic_filebuf< char_type, traits_type >\fP, \fB__gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >\fP, and \fBstd::wbuffer_convert< _Codecvt, _Elem, _Tr >\fP\&. .PP Definition at line 694 of file streambuf\&. .SS "template \fBstreamsize\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::xsgetn (\fBchar_type\fP * __s, \fBstreamsize\fP __n)\fC [protected]\fP, \fC [virtual]\fP" .PP Multiple character extraction\&. .PP \fBParameters\fP .RS 4 \fI__s\fP A buffer area\&. .br \fI__n\fP Maximum number of characters to assign\&. .RE .PP \fBReturns\fP .RS 4 The number of characters assigned\&. .RE .PP Fills \fI__s\fP[0] through \fI__s\fP[__n-1] with characters from the input sequence, as if by \fCsbumpc()\fP\&. Stops when either \fI__n\fP characters have been copied, or when \fCtraits::eof()\fP would be copied\&. .PP It is expected that derived classes provide a more efficient implementation by overriding this definition\&. .PP Reimplemented in \fBstd::basic_filebuf< _CharT, _Traits >\fP, \fBstd::basic_filebuf< _CharT, std::char_traits< _CharT > >\fP, \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, and \fBstd::basic_filebuf< char_type, traits_type >\fP\&. .PP Definition at line 45 of file streambuf\&.tcc\&. .PP References std::min()\&. .SS "template \fBstreamsize\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::xsputn (const \fBchar_type\fP * __s, \fBstreamsize\fP __n)\fC [protected]\fP, \fC [virtual]\fP" .PP Multiple character insertion\&. .PP \fBParameters\fP .RS 4 \fI__s\fP A buffer area\&. .br \fI__n\fP Maximum number of characters to write\&. .RE .PP \fBReturns\fP .RS 4 The number of characters written\&. .RE .PP Writes \fI__s\fP[0] through \fI__s\fP[__n-1] to the output sequence, as if by \fCsputc()\fP\&. Stops when either \fIn\fP characters have been copied, or when \fCsputc()\fP would return \fCtraits::eof()\fP\&. .PP It is expected that derived classes provide a more efficient implementation by overriding this definition\&. .PP Reimplemented in \fBstd::basic_filebuf< _CharT, _Traits >\fP, \fBstd::basic_filebuf< _CharT, std::char_traits< _CharT > >\fP, \fBstd::basic_filebuf< _CharT, encoding_char_traits< _CharT > >\fP, and \fBstd::basic_filebuf< char_type, traits_type >\fP\&. .PP Definition at line 79 of file streambuf\&.tcc\&. .PP References std::min()\&. .SH "Member Data Documentation" .PP .SS "template \fBlocale\fP \fBstd::basic_streambuf\fP< _CharT, _Traits >::_M_buf_locale\fC [protected]\fP" .PP Current locale setting\&. .PP Definition at line 199 of file streambuf\&. .PP Referenced by std::basic_filebuf< _CharT, _Traits >::basic_filebuf()\&. .SS "template \fBchar_type\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::_M_in_beg\fC [protected]\fP" .PP Start of get area\&. .PP Definition at line 191 of file streambuf\&. .SS "template \fBchar_type\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::_M_in_cur\fC [protected]\fP" .PP Current read area\&. .PP Definition at line 192 of file streambuf\&. .SS "template \fBchar_type\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::_M_in_end\fC [protected]\fP" .PP End of get area\&. .PP Definition at line 193 of file streambuf\&. .SS "template \fBchar_type\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::_M_out_beg\fC [protected]\fP" .PP Start of put area\&. .PP Definition at line 194 of file streambuf\&. .SS "template \fBchar_type\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::_M_out_cur\fC [protected]\fP" .PP Current put area\&. .PP Definition at line 195 of file streambuf\&. .SS "template \fBchar_type\fP* \fBstd::basic_streambuf\fP< _CharT, _Traits >::_M_out_end\fC [protected]\fP" .PP End of put area\&. .PP Definition at line 196 of file streambuf\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.