__GNU_CXX::STDIO_SYNC_FILEBUF(3cxx)
π NAME π
okay so bestie, welcome to the __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits > page of the (3cxx) manual β and yes it's a mouthful, we love her anyway π
__gnu_cxx::stdio_sync_filebuf< _CharT, _Traits > β Provides a layer of compatibility for C.
like, that's the whole vibe. she's a bridge between your C++ stream world and your C world, no cap π«Ά
β¨ SYNOPSIS β¨
#include <stdio_sync_filebuf.h>
Inherits std::basic_streambuf< _CharT, _Traits >. Family tree: iconic, established, very much main character energy π
πΈ Public Types πΈ
typedef _CharT char_typeβ the character type, literally what you told her to betypedef traits_type::int_type int_typeβ borrowed fromtraits_type, she's not reinventing the wheeltypedef traits_type::off_type off_typeβ also lifted fromtraits_typetypedef traits_type::pos_type pos_typeβ same deal,traits_typesaid it besttypedef _Traits traits_typeβ the traits you handed her, straight up
π Public Member Functions π
stdio_sync_filebuf (std::__c_file *__f)β constructor time, she takes a C file pointerstdio_sync_filebuf (stdio_sync_filebuf &&__fb) noexceptβ move constructor,noexceptand everything, she's β¨efficientβ¨std::__c_file * file ()β hands you back the file pointer (more on her below π)locale getloc () constβ Locale access. the vibe check for your localestreamsize in_avail ()β Looking ahead into the stream. peek-a-boo but make it technical πstdio_sync_filebuf & operator= (stdio_sync_filebuf &&__fb) noexceptβ move assignment, alsonoexcept, also slaylocale pubimbue (const locale &__loc)β Entry point forimbue(). yes bestie, "pub" like public, the door everyone knocks on πͺint_type sbumpc ()β Getting the next character. and then bumping past itint_type sgetc ()β Getting the next character. but just looking, not takingstreamsize sgetn (char_type *__s, streamsize __n)β Entry point forxsgetn. grab__nof themint_type snextc ()β Getting the next character. the next next one, technicallyint_type sputbackc (char_type __c)β Pushing characters back into the input stream. the un-eat π½οΈint_type sputc (char_type __c)β Entry point for all single-character output functions. one char, one jobstreamsize sputn (const char_type *__s, streamsize __n)β Entry point for all single-character output functions. okay the description says "single-character" but she takes__n, that's just what the page says, moving on πint_type sungetc ()β Moving backwards in the input stream. reverse card activatedvoid swap (stdio_sync_filebuf &__fb)β swap her out with__fb, trading places β¨basic_streambuf * pubsetbuf (char_type *__s, streamsize __n)β Entry points for derived buffer functions. this is the public door for setting bufferspos_type pubseekoff (off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out)β Alters the stream position. note the default__modeisios_base::in|ios_base::out, she's generous like thatpos_type pubseekpos (pos_type __sp, ios_base::openmode __mode=ios_base::in|ios_base::out)β Alters the stream position. absolute this time, not relativeint pubsync ()β Calls virtualsyncfunction. the middleman behavior we respect
π¦ Protected Member Functions π¦
void __safe_gbump (streamsize __n)β the "safe" version of the bump, no details given, live your truthvoid __safe_pbump (streamsize __n)β the put-area safe bump, same energyvoid gbump (int __n)β Moving the read position.virtual void imbue (const locale &__loc)β Changes translations.virtual int_type overflow (int_type __c=traits_type::eof())β Consumes data from the buffer; writes to the controlled sequence.virtual int_type pbackfail (int_type __c=traits_type::eof())β Tries to back up the input sequence. emphasis on tries πvoid pbump (int __n)β Moving the write position.virtual pos_type seekoff (off_type, ios_base::seekdir, ios_base::openmode=ios_base::in|ios_base::out)β Alters the stream positions.virtual std::streampos seekoff (std::streamoff __off, std::ios_base::seekdir __dir, std::ios_base::openmode=ios_base::in|ios_base::out)β another seekoff, this one with names on the params π«Άvirtual pos_type seekpos (pos_type, ios_base::openmode=ios_base::in|ios_base::out)β Alters the stream positions.virtual std::streampos seekpos (std::streampos __pos, std::ios_base::openmode __mode=ios_base::in|ios_base::out)β seekpos again, fully labelledvirtual basic_streambuf< char_type, _Traits > * setbuf (char_type *, streamsize)β Manipulates the buffer.void setg (char_type *__gbeg, char_type *__gnext, char_type *__gend)β Setting the three read area pointers. all three, together, as a treatvoid setp (char_type *__pbeg, char_type *__pend)β Setting the three write area pointers. (two pointers listed, the label says three, that's what the page says bestie, i don't make the rules)virtual streamsize showmanyc ()β Investigating the data available.void swap (basic_streambuf &__sb)β swaps with a plainbasic_streambufvirtual int sync ()β Synchronizes the buffer arrays with the controlled sequences.int_type syncgetc ()β the sync-flavored getstdio_sync_filebuf< char >::int_type syncgetc ()β thecharspecialisation of itstdio_sync_filebuf< wchar_t >::int_type syncgetc ()β and thewchar_tone, she's got range πint_type syncputc (int_type __c)β the sync-flavored putstdio_sync_filebuf< char >::int_type syncputc (int_type __c)βchareditionstdio_sync_filebuf< wchar_t >::int_type syncputc (int_type __c)βwchar_teditionint_type syncungetc (int_type __c)β the sync-flavored un-get, putting__cbackstdio_sync_filebuf< char >::int_type syncungetc (int_type __c)βcharedition of the un-getstdio_sync_filebuf< wchar_t >::int_type syncungetc (int_type __c)βwchar_tedition of the un-getvirtual int_type uflow ()β Fetches more data from the controlled sequence.virtual int_type underflow ()β Fetches more data from the controlled sequence. yes same one-liner, she's consistentstd::streamsize xsgetn (char *__s, std::streamsize __n)β thechargrabvirtual std::streamsize xsgetn (char_type *__s, std::streamsize __n)β the virtual onevirtual streamsize xsgetn (char_type *__s, streamsize __n)β Multiple character extraction. grabby hands π€²std::streamsize xsgetn (wchar_t *__s, std::streamsize __n)β the wide-char grabstd::streamsize xsputn (const char *__s, std::streamsize __n)β thecharpushvirtual std::streamsize xsputn (const char_type *__s, std::streamsize __n)β the virtual pushvirtual streamsize xsputn (const char_type *__s, streamsize __n)β Multiple character insertion. here comes the data π€std::streamsize xsputn (const wchar_t *__s, std::streamsize __n)β the wide-char pushchar_type * eback () constβ Access to the get area. beginning pointer, the start of the whole read situationchar_type * gptr () constβ Access to the get area. next pointer, where you're at right nowchar_type * egptr () constβ Access to the get area. end pointer, the finish line πchar_type * pbase () constβ Access to the put area. beginning pointer for outputchar_type * pptr () constβ Access to the put area. next pointer for outputchar_type * epptr () constβ Access to the put area. end pointer for output
π Protected Attributes π
locale _M_buf_localeβ Current locale setting.char_type * _M_in_begβ Start of get area.char_type * _M_in_curβ Current read area.char_type * _M_in_endβ End of get area.char_type * _M_out_begβ Start of put area.char_type * _M_out_curβ Current put area.char_type * _M_out_endβ End of put area.
π« Detailed Description π«
template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
class __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >
Provides a layer of compatibility for C.
This GNU extension provides extensions for working with standard C FILE*'s. It must be instantiated by the user with the type of character used in the file stream, e.g., stdio_filebuf<char>.
so like β you have to pick the character type yourself, bestie, she's not gonna guess. that's the whole assignment π
π Member Function Documentation π
π§ eback() β access to the get area
template<typename _CharT , typename _Traits > char_type *
std::basic_streambuf< _CharT, _Traits >::eback () const [inline], [protected], [inherited]
Access to the get area. These functions are only available to other protected functions, including derived classes. so it's giving inner-circle only π«Ά
eback()returns the beginning pointer for the input sequencegptr()returns the next pointer for the input sequenceegptr()returns the end pointer for the input sequence
References std::basic_streambuf< _CharT, _Traits >::_M_in_beg.
Referenced by std::basic_streambuf< _CharT, _Traits >::sputbackc(), and std::basic_streambuf< _CharT, _Traits >::sungetc().
π§ egptr() β access to the get area, part two
template<typename _CharT , typename _Traits > char_type *
std::basic_streambuf< _CharT, _Traits >::egptr () const [inline], [protected], [inherited]
Access to the get area. These functions are only available to other protected functions, including derived classes.
eback()returns the beginning pointer for the input sequencegptr()returns the next pointer for the input sequenceegptr()returns the end pointer for the input sequence
References std::basic_streambuf< _CharT, _Traits >::_M_in_end.
Referenced by std::basic_streambuf< _CharT, _Traits >::in_avail(), std::basic_streambuf< _CharT, _Traits >::sbumpc(), std::basic_streambuf< _CharT, _Traits >::sgetc(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::showmanyc(), and std::wbuffer_convert< _Codecvt, _Elem, _Tr >::underflow(). look at her, referenced everywhere, she's booked and busy π₯
π§ epptr() β access to the put area
template<typename _CharT , typename _Traits > char_type *
std::basic_streambuf< _CharT, _Traits >::epptr () const [inline], [protected], [inherited]
Access to the put area. These functions are only available to other protected functions, including derived classes.
pbase()returns the beginning pointer for the output sequencepptr()returns the next pointer for the output sequenceepptr()returns the end pointer for the output sequence
References std::basic_streambuf< _CharT, _Traits >::_M_out_end.
Referenced by std::basic_streambuf< _CharT, _Traits >::sputc().
πΎ file() β the one you were waiting for
template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
std::__c_file * __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::file () [inline]
Returns: The underlying FILE*.
This function can be used to access the underlying C file pointer. Note that there is no way for the library to track what you do with the file, so be careful.
β οΈ okay bestie, listen β nobody is watching that pointer after you grab it. no tracking, no safety net, no receipts. be careful fr fr π
πΆ gbump() β moving the read position
template<typename _CharT , typename _Traits > void std::basic_streambuf<
_CharT, _Traits >::gbump (int __n) [inline], [protected], [inherited]
Moving the read position.
Parameters
__nβ The delta by which to move.
This just advances the read position without returning any data. so she moves but gives you nothing back, the audacity π
References std::basic_streambuf< _CharT, _Traits >::_M_in_cur.
Referenced by std::basic_streambuf< _CharT, _Traits >::sbumpc(), std::basic_streambuf< _CharT, _Traits >::sputbackc(), std::basic_streambuf< _CharT, _Traits >::sungetc(), and std::basic_streambuf< _CharT, _Traits >::uflow().
π getloc() β locale access
template<typename _CharT , typename _Traits > locale std::basic_streambuf<
_CharT, _Traits >::getloc () const [inline], [inherited]
Locale access.
Returns: The current locale in effect.
If pubimbue(loc) has been called, then the most recent loc is returned. Otherwise the global locale in effect at the time of construction is returned. so whoever was on duty when she was born, basically πΌ
References std::basic_streambuf< _CharT, _Traits >::_M_buf_locale.
Referenced by std::basic_streambuf< _CharT, _Traits >::pubimbue().
π§ gptr() β access to the get area, part three
template<typename _CharT , typename _Traits > char_type *
std::basic_streambuf< _CharT, _Traits >::gptr () const [inline], [protected], [inherited]
Access to the get area. These functions are only available to other protected functions, including derived classes.
eback()returns the beginning pointer for the input sequencegptr()returns the next pointer for the input sequenceegptr()returns the end pointer for the input sequence
References std::basic_streambuf< _CharT, _Traits >::_M_in_cur.
Referenced by std::basic_streambuf< _CharT, _Traits >::in_avail(), std::basic_streambuf< _CharT, _Traits >::sbumpc(), std::basic_streambuf< _CharT, _Traits >::sgetc(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::showmanyc(), std::basic_streambuf< _CharT, _Traits >::sputbackc(), std::basic_streambuf< _CharT, _Traits >::sungetc(), std::basic_streambuf< _CharT, _Traits >::uflow(), and std::wbuffer_convert< _Codecvt, _Elem, _Tr >::underflow(). she's literally everywhere, iykyk β
π£οΈ imbue() β changes translations
template<typename _CharT , typename _Traits > virtual void
std::basic_streambuf< _CharT, _Traits >::imbue (const locale & __loc)
[inline], [protected], [virtual], [inherited]
Changes translations.
Parameters
__locβ A new locale.
she's virtual, she's protected, she's inherited β a whole triple threat π¦
Translations that happen during I/O and depend on the current locale get switched up by this call. The standard also adds this very specific little note: βBetween 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.β
Note: the base class version does nothing. literally nothing. iconic minimalism.
Reimplemented in: std::basic_filebuf< _CharT, _Traits >, std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >, std::basic_filebuf< _CharT, std::char_traits< _CharT > >, and std::basic_filebuf< char_type, traits_type >.
Referenced by: std::basic_streambuf< _CharT, _Traits >::pubimbue().
π¦ std::basic_streambuf< _CharT, _Traits >::in_avail() π¦
template<typename _CharT , typename _Traits > streamsize
std::basic_streambuf< _CharT, _Traits >::in_avail () [inline],
[inherited]
Looking ahead into the stream. bestie, this is the βhow much can I read rnβ check.
Returns: the number of characters available.
If a read position is available, it returns the number of characters available for reading before the buffer must be refilled. Otherwise it returns the derived showmanyc().
References: std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gptr(), and std::basic_streambuf< _CharT, _Traits >::showmanyc().
π₯ __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::overflow() π₯
template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual int_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits
>::overflow (int_type __c = traits_type::eof()) [inline], [protected],
[virtual]
Consumes data from the buffer; writes to the controlled sequence. this is the output-buffer emergency exit, lowkey.
Parameters:
__cβ an additional character to consume.
Returns: eof() to indicate failure, something else (usually __c, or not_eof()).
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 consumed, with some effect on the controlled sequence. (Typically, the buffer is written out to the sequence verbatim.) In either case, the character c is also written out, if __c is not eof().
For a formal definition of this function, see a good text such as Langer & Kreft, or [27.5.2.4.5]/3-7.
A functioning output streambuf can be created by overriding only this function (no buffer area will be used).
Note: base class version does nothing, returns eof().
Reimplemented from: std::basic_streambuf< _CharT, _Traits >.
π
__gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::pbackfail() π
template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual int_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits
>::pbackfail (int_type __c = traits_type::eof()) [inline], [protected],
[virtual]
Tries to back up the input sequence. yes, weβre putting a character back. no cap, this is the un-read move.
Parameters:
__cβ the character to be inserted back into the sequence.
Returns: eof() on failure, some other value on success.
Postcondition: the constraints of gptr(), eback(), and pptr() are the same as for underflow().
Note: base class version does nothing, returns eof().
Reimplemented from: std::basic_streambuf< _CharT, _Traits >.
π std::basic_streambuf< _CharT, _Traits >::pbase() π
template<typename _CharT , typename _Traits > char_type *
std::basic_streambuf< _CharT, _Traits >::pbase () const [inline],
[protected], [inherited]
Access to the put area. these functions are only available to other protected functions, including derived classes. very βmembers onlyβ energy.
pbase()returns the beginning pointer for the output sequencepptr()returns the next pointer for the output sequenceepptr()returns the end pointer for the output sequence
References: std::basic_streambuf< _CharT, _Traits >::_M_out_beg.
Referenced by: std::basic_stringbuf< _CharT, _Traits, _Alloc >::str().
πΈ std::basic_streambuf< _CharT, _Traits >::pbump() πΈ
template<typename _CharT , typename _Traits > void std::basic_streambuf<
_CharT, _Traits >::pbump (int __n) [inline], [protected], [inherited]
Moving the write position. just scooching the write pointer forward.
Parameters:
__nβ the delta by which to move.
This just advances the write position without returning any data.
References: std::basic_streambuf< _CharT, _Traits >::_M_out_cur.
Referenced by: std::basic_streambuf< _CharT, _Traits >::sputc().
π std::basic_streambuf< _CharT, _Traits >::pptr() π
template<typename _CharT , typename _Traits > char_type *
std::basic_streambuf< _CharT, _Traits >::pptr () const [inline],
[protected], [inherited]
Access to the put area. again: these functions are only available to other protected functions, including derived classes. iykyk.
pbase()returns the beginning pointer for the output sequencepptr()returns the next pointer for the output sequenceepptr()returns the end pointer for the output sequence
References: std::basic_streambuf< _CharT, _Traits >::_M_out_cur.
Referenced by: std::basic_streambuf< _CharT, _Traits >::sputc().
π std::basic_streambuf< _CharT, _Traits >::pubimbue() π
template<typename _CharT , typename _Traits > locale std::basic_streambuf<
_CharT, _Traits >::pubimbue (const locale & __loc) [inline],
[inherited]
Entry point for imbue(). the public-facing bestie that handles the locale glow-up.
Parameters:
__locβ the new locale.
Returns: the previous locale.
Calls the derived imbue(__loc).
References: std::basic_streambuf< _CharT, _Traits >::_M_buf_locale, std::basic_streambuf< _CharT, _Traits >::getloc(), and std::basic_streambuf< _CharT, _Traits >::imbue().
β std::basic_streambuf< _CharT, _Traits >::pubseekoff() β
template<typename _CharT , typename _Traits > pos_type std::basic_streambuf<
_CharT, _Traits >::pubseekoff (off_type __off, ios_base::seekdir __way,
ios_base::openmode __mode = ios_base::in | ios_base::out) [inline],
[inherited]
Alters the stream position. the public βmove the cursorβ call.
Parameters:
__offβ offset.__wayβ value forios_base::seekdir.__modeβ value forios_base::openmode.
Calls virtual seekoff function.
References: std::basic_streambuf< _CharT, _Traits >::seekoff().
π§ std::basic_streambuf< _CharT, _Traits >::pubseekpos() π§
template<typename _CharT , typename _Traits > pos_type std::basic_streambuf<
_CharT, _Traits >::pubseekpos (pos_type __sp, ios_base::openmode __mode
= ios_base::in | ios_base::out) [inline], [inherited]
Alters the stream position. same vibe, but youβre giving an absolute position instead of an offset.
Parameters:
__spβ position.__modeβ value forios_base::openmode.
Calls virtual seekpos function.
References: std::basic_streambuf< _CharT, _Traits >::seekpos().
π«Ά std::basic_streambuf< _CharT, _Traits >::pubsetbuf() π«Ά
template<typename _CharT , typename _Traits > basic_streambuf *
std::basic_streambuf< _CharT, _Traits >::pubsetbuf (char_type * __s,
streamsize __n) [inline], [inherited]
Entry points for derived buffer functions. the public versions of pubfoo dispatch to the protected derived foo member functions, passing the arguments (if any) and returning the result unchanged. very pass-the-aux energy.
References: std::basic_streambuf< _CharT, _Traits >::setbuf().
π₯ std::basic_streambuf< _CharT, _Traits >::pubsync() π₯
template<typename _CharT , typename _Traits > int std::basic_streambuf<
_CharT, _Traits >::pubsync () [inline], [inherited]
Calls virtual sync function. the public βsync it upβ button.
References: std::basic_streambuf< _CharT, _Traits >::sync().
Referenced by: std::basic_istream< _CharT, _Traits >::sync().
π std::basic_streambuf< _CharT, _Traits >::sbumpc() π
template<typename _CharT , typename _Traits > int_type std::basic_streambuf<
_CharT, _Traits >::sbumpc () [inline], [inherited]
Getting the next character. the βgimme the next char and move onβ move.
Returns: the next character, or eof.
If the input read position is available, returns that character and increments the read pointer, otherwise calls and returns uflow().
References: std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gbump(), std::basic_streambuf< _CharT, _Traits >::gptr(), and std::basic_streambuf< _CharT, _Traits >::uflow().
Referenced by: std::basic_istream< char >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_streambuf< _CharT, _Traits >::snextc(), and std::basic_istream< char >::sync().
π std::basic_streambuf< _CharT, _Traits >::seekoff() π
template<typename _CharT , typename _Traits > virtual pos_type
std::basic_streambuf< _CharT, _Traits >::seekoff (off_type,
ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out)
[inline], [protected], [virtual], [inherited]
Alters the stream positions. each derived class provides its own appropriate behavior. no one-size-fits-all here.
Note: base class version does nothing, returns a pos_type that represents an invalid stream position.
Reimplemented in: std::basic_filebuf< _CharT, _Traits >, std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >, std::basic_filebuf< _CharT, std::char_traits< _CharT > >, std::basic_filebuf< char_type, traits_type >, and std::basic_stringbuf< _CharT, _Traits, _Alloc >.
Referenced by: std::basic_streambuf< _CharT, _Traits >::pubseekoff().
π¦ std::basic_streambuf< _CharT, _Traits >::seekpos() π¦
template<typename _CharT , typename _Traits > virtual pos_type
std::basic_streambuf< _CharT, _Traits >::seekpos (pos_type,
ios_base::openmode = ios_base::in | ios_base::out) [inline],
[protected], [virtual], [inherited]
Alters the stream positions. each derived class provides its own appropriate behavior. again: customized, not copied.
Note: base class version does nothing, returns a pos_type that represents an invalid stream position.
Reimplemented in: std::basic_filebuf< _CharT, _Traits >, std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >, std::basic_filebuf< _CharT, std::char_traits< _CharT > >, std::basic_filebuf< char_type, traits_type >, and std::basic_stringbuf< _CharT, _Traits, _Alloc >.
Referenced by: std::basic_streambuf< _CharT, _Traits >::pubseekpos().
π std::basic_streambuf< _CharT, _Traits >::setbuf() π
template<typename _CharT , typename _Traits > virtual basic_streambuf<
char_type, _Traits > * std::basic_streambuf< _CharT, _Traits >::setbuf
(char_type *, streamsize) [inline], [protected], [virtual],
[inherited]
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.
Note: base class version does nothing, returns this.
Reimplemented in: std::basic_filebuf< _CharT, _Traits >, std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >, std::basic_filebuf< _CharT, std::char_traits< _CharT > >, std::basic_filebuf< char_type, traits_type >, and std::basic_stringbuf< _CharT, _Traits, _Alloc >.
Referenced by: std::basic_streambuf< _CharT, _Traits >::pubsetbuf().
π std::basic_streambuf< _CharT, _Traits >::setg() π
template<typename _CharT , typename _Traits > void std::basic_streambuf<
_CharT, _Traits >::setg (char_type * __gbeg, char_type * __gnext,
char_type * __gend) [inline], [protected], [inherited]
Setting the three read area pointers. yes, all three at once. very efficient.
Parameters:
__gbegβ a pointer.__gnextβ a pointer.__gendβ a pointer.
Postcondition: __gbeg == eback(), __gnext == gptr(), and __gend == egptr().
References: std::basic_streambuf< _CharT, _Traits >::_M_in_beg, std::basic_streambuf< _CharT, _Traits >::_M_in_cur, and std::basic_streambuf< _CharT, _Traits >::_M_in_end.
Referenced by: std::wbuffer_convert< _Codecvt, _Elem, _Tr >::wbuffer_convert().
π
std::basic_streambuf< _CharT, _Traits >::setp() π
template<typename _CharT , typename _Traits > void std::basic_streambuf<
_CharT, _Traits >::setp (char_type * __pbeg, char_type * __pend)
[inline], [protected], [inherited]
Setting the three write area pointers. the write-side sibling of setg().
Parameters:
__pbegβ a pointer.__pendβ a pointer.
Postcondition π«Ά β __pbeg == pbase(), __pbeg == pptr(), and __pend == epptr()
References β std::basic_streambuf< _CharT, _Traits >::_M_out_beg, std::basic_streambuf< _CharT, _Traits >::_M_out_cur, and std::basic_streambuf< _CharT, _Traits >::_M_out_end.
Referenced by β std::wbuffer_convert< _Codecvt, _Elem, _Tr >::wbuffer_convert().
πΈ sgetc () β getting the next character
template<typename _CharT , typename _Traits > int_type std::basic_streambuf<
_CharT, _Traits >::sgetc () [inline], [inherited]
Okay bestie, this one is literally βpeek at the next characterβ energy. It returns the next character, or eof. If the input read position is available, it returns that character; otherwise it calls and returns underflow(). And ngl, it does not move the read position after fetching the character. Peek, donβt yeet. π
References β std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gptr(), and std::basic_streambuf< _CharT, _Traits >::underflow().
Referenced by β std::basic_istream< char >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< char >::readsome(), and std::basic_streambuf< _CharT, _Traits >::snextc().
π¦ sgetn (char_type * __s, streamsize __n) β entry point for xsgetn
template<typename _CharT , typename _Traits > streamsize
std::basic_streambuf< _CharT, _Traits >::sgetn (char_type * __s,
streamsize __n) [inline], [inherited]
This is the βgimme a bunch of charactersβ entry point, and itβs honestly giving public-facing shortcut. β¨
__sβ a buffer area.__nβ a count.
It returns xsgetn(__s,__n). The effect is to fill __s[0] through __s[__n-1] with characters from the input sequence, if possible.
References β std::basic_streambuf< _CharT, _Traits >::xsgetn().
π₯ showmanyc () β investigating the data available
template<typename _CharT , typename _Traits > virtual streamsize
std::basic_streambuf< _CharT, _Traits >::showmanyc () [inline],
[protected], [virtual], [inherited]
This one is the βhow many characters are we even working with?β detective moment. π It returns an estimate of the number of characters available in the input sequence, or -1.
If it returns a positive value, then successive calls to underflow() will not return traits::eof() until at least that number of characters have been supplied. If showmanyc() returns -1, then calls to underflow() or uflow() will fail. [27.5.2.4.3]/1
Note β Base class version does nothing, returns zero.
The standard adds that the intention is not only that the calls [tounderfloworuflow] will not returneof()but that they will return immediately.
The standard adds that the morphemes of showmanyc are es-how-many-see, not show-manic.
Reimplemented in β std::basic_filebuf< _CharT, _Traits >, std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >, std::basic_filebuf< _CharT, std::char_traits< _CharT > >, std::basic_filebuf< char_type, traits_type >, and std::basic_stringbuf< _CharT, _Traits, _Alloc >.
Referenced by β std::basic_streambuf< _CharT, _Traits >::in_avail().
π snextc () β getting the next character, but make it move
template<typename _CharT , typename _Traits > int_type std::basic_streambuf<
_CharT, _Traits >::snextc () [inline], [inherited]
Returns the next character, or eof. It calls sbumpc(), and if that function returns traits::eof(), so does this function. Otherwise, it calls sgetc(). So itβs like, bump first, peek after. Main character behavior, honestly. π
References β std::basic_streambuf< _CharT, _Traits >::sbumpc(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
Referenced by β std::basic_istream< char >::get(), std::basic_istream< char >::ignore(), std::basic_istream< char >::operator>>(), and std::basic_istream< char >::putback().
π sputbackc (char_type __c) β pushing characters back into the input stream
template<typename _CharT , typename _Traits > int_type std::basic_streambuf<
_CharT, _Traits >::sputbackc (char_type __c) [inline], [inherited]
__cβ the character to push back.
It returns the previous character, if possible. This is similar to sungetc(), but __c is pushed onto the stream instead of the previous character. If successful, the next character fetched from the input stream will be __c. Itβs giving βno wait, put that back.β π
References β std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::gbump(), std::basic_streambuf< _CharT, _Traits >::gptr(), and std::basic_streambuf< _CharT, _Traits >::pbackfail().
Referenced by β std::basic_istream< _CharT, _Traits >::putback().
π sputc (char_type __c) β entry point for all single-character output functions
template<typename _CharT , typename _Traits > int_type std::basic_streambuf<
_CharT, _Traits >::sputc (char_type __c) [inline], [inherited]
__cβ a character to output.
It returns __c, if possible. This is one of two public output functions. Iconic. β¨
If a write position is available for the output sequence (i.e., the buffer is not full), it stores __c in that position, increments the position, and returns traits::to_int_type(__c). If a write position is not available, it returns overflow(__c).
References β std::basic_streambuf< _CharT, _Traits >::epptr(), std::basic_streambuf< _CharT, _Traits >::overflow(), std::basic_streambuf< _CharT, _Traits >::pbump(), and std::basic_streambuf< _CharT, _Traits >::pptr().
Referenced by β std::wbuffer_convert< _Codecvt, _Elem, _Tr >::overflow().
π sputn (const char_type * __s, streamsize __n) β entry point for all single-character output functions
template<typename _CharT , typename _Traits > streamsize
std::basic_streambuf< _CharT, _Traits >::sputn (const char_type * __s,
streamsize __n) [inline], [inherited]
__sβ a buffer read area.__nβ a count.
This is one of two public output functions. It returns xsputn(__s,__n). The effect is to write __s[0] through __s[__n-1] to the output sequence, if possible. And yes, the description literally says βsingle-character output functionsβ again β I donβt make the rules, bestie. π
References β std::basic_streambuf< _CharT, _Traits >::xsputn().
π« sungetc () β moving backwards in the input stream
template<typename _CharT , typename _Traits > int_type std::basic_streambuf<
_CharT, _Traits >::sungetc () [inline], [inherited]
It returns the previous character, if possible. If a putback position is available, this function decrements the input pointer and returns that character. Otherwise, it calls and returns pbackfail(). The effect is to unget the last character gotten. Rewind era. βͺ
References β std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::gbump(), std::basic_streambuf< _CharT, _Traits >::gptr(), and std::basic_streambuf< _CharT, _Traits >::pbackfail().
π§ __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::sync () β synchronizes the buffer arrays with the controlled sequences
template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual int __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::sync ()
[inline], [protected], [virtual]
It returns -1 on failure. Each derived class provides its own appropriate behavior, including the definition of failure.
Note β Base class version does nothing, returns zero.
Reimplemented from β std::basic_streambuf< _CharT, _Traits >.
π __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::uflow () β fetches more data from the controlled sequence
template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual int_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::uflow
() [inline], [protected], [virtual]
It returns the first character from the pending sequence. Informally, this function does the same thing as underflow(), and in fact is required to call that function. It also returns the new character, like underflow() does. However, this function also moves the read position forward by one. So itβs underflow() with a little extra step. π
Reimplemented from β std::basic_streambuf< _CharT, _Traits >.
π __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::underflow () β fetches more data from the controlled sequence
template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual int_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits
>::underflow () [inline], [protected], [virtual]
It returns the first character from the pending sequence. 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 refilled. In either case, the next available character is returned, or traits::eof() to indicate a null pending sequence.
For a formal definition of the pending sequence, see a good text such as Langer & Kreft, or [27.5.2.4.3]/7-14.
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.
Note β Base class version does nothing, returns eof().
Reimplemented from β std::basic_streambuf< _CharT, _Traits >.
π«Ά xsgetn (char_type * __s, streamsize __n) β multiple character extraction
template<typename _CharT , typename _Traits > streamsize
std::basic_streambuf< _CharT, _Traits >::xsgetn (char_type * __s,
streamsize __n) [protected], [virtual], [inherited]
__sβ a buffer area.__nβ maximum number of characters to assign.
It returns the number of characters assigned. It fills __s[0] through __s[__n-1] with characters from the input sequence, as if by sbumpc(). It stops when either __n characters have been copied, or when traits::eof() would be copied.
It is expected that derived classes provide a more efficient implementation by overriding this definition. Optimization invitation, slay. β‘
Reimplemented in β std::basic_filebuf< _CharT, _Traits >, std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >, std::basic_filebuf< _CharT, std::char_traits< _CharT > >, and std::basic_filebuf< char_type, traits_type >.
References β std::min().
Referenced by β std::basic_streambuf< _CharT, _Traits >::sgetn().
π xsputn (const char_type * __s, streamsize __n) β multiple character insertion
template<typename _CharT , typename _Traits > streamsize
std::basic_streambuf< _CharT, _Traits >::xsputn (const char_type * __s,
streamsize __n) [protected], [virtual], [inherited]
__sβ a buffer area.__nβ maximum number of characters to write.
It returns the number of characters written. It writes __s[0] through __s[__n-1] to the output sequence, as if by sputc(). It stops when either n characters have been copied, or when sputc() would return traits::eof().
It is expected that derived classes provide a more efficient implementation by overriding this definition.
Reimplemented in β std::basic_filebuf< _CharT, _Traits >, std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >, std::basic_filebuf< _CharT, std::char_traits< _CharT > >, and std::basic_filebuf< char_type, traits_type >.
References β std::min().
Referenced by β std::basic_streambuf< _CharT, _Traits >::sputn().
β¨ Member Data Documentation β¨
okay bestie, final stretch β this is the member data glossary for std::basic_streambuf< _CharT, _Traits >, and yes, every single protected/inherited little data member is here. no skips, no cap. π
template<typename _CharT , typename _Traits > locale std::basic_streambuf< _CharT, _Traits >::_M_buf_locale[protected], [inherited]β Current locale setting. Referenced bystd::basic_filebuf< _CharT, _Traits >::basic_filebuf(),std::basic_streambuf< _CharT, _Traits >::getloc(), andstd::basic_streambuf< _CharT, _Traits >::pubimbue(). πtemplate<typename _CharT , typename _Traits > char_type* std::basic_streambuf< _CharT, _Traits >::_M_in_beg[protected], [inherited]β Start of get area. Referenced bystd::basic_streambuf< _CharT, _Traits >::eback(), andstd::basic_streambuf< _CharT, _Traits >::setg(). πΈtemplate<typename _CharT , typename _Traits > char_type* std::basic_streambuf< _CharT, _Traits >::_M_in_cur[protected], [inherited]β Current read area. Referenced bystd::basic_streambuf< _CharT, _Traits >::gbump(),std::basic_streambuf< _CharT, _Traits >::gptr(), andstd::basic_streambuf< _CharT, _Traits >::setg(). π¦template<typename _CharT , typename _Traits > char_type* std::basic_streambuf< _CharT, _Traits >::_M_in_end[protected], [inherited]β End of get area. Referenced bystd::basic_streambuf< _CharT, _Traits >::egptr(), andstd::basic_streambuf< _CharT, _Traits >::setg(). β¨template<typename _CharT , typename _Traits > char_type* std::basic_streambuf< _CharT, _Traits >::_M_out_beg[protected], [inherited]β Start of put area. Referenced bystd::basic_streambuf< _CharT, _Traits >::pbase(), andstd::basic_streambuf< _CharT, _Traits >::setp(). πtemplate<typename _CharT , typename _Traits > char_type* std::basic_streambuf< _CharT, _Traits >::_M_out_cur[protected], [inherited]β Current put area. Referenced bystd::basic_streambuf< _CharT, _Traits >::pbump(),std::basic_streambuf< _CharT, _Traits >::pptr(), andstd::basic_streambuf< _CharT, _Traits >::setp(). π₯template<typename _CharT , typename _Traits > char_type* std::basic_streambuf< _CharT, _Traits >::_M_out_end[protected], [inherited]β End of put area. Referenced bystd::basic_streambuf< _CharT, _Traits >::epptr(), andstd::basic_streambuf< _CharT, _Traits >::setp(). π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
and thatβs the whole page, bestie π«Ά the footer line is libst__gnu_cxx::stdi...harT, _Traits >(3cxx) β thatβs the source/version and date doing its little behind-the-scenes moment. auto-generated by Doxygen for libstdc++ from the source code, iconic behavior only. π
β¨
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms