__GNU_CXX::STDIO_FILEBUF(3)

โœจ NAME โœจ</p>

__gnu_cxx::stdio_filebuf< _CharT, _Traits > โ€” bestie, this one is literally the compatibility layer for C/POSIX. That's it, that's the whole vibe. ๐Ÿซถ

This is page __gnu_cxx:..., _Traits >(3) from the Library Functions Manual. ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <stdio_filebuf.h>

Inherits std::basic_filebuf< _CharT, _Traits >. Yes, it's giving nepo baby energy but make it โœจlegitimate inheritanceโœจ.

๐Ÿ’– Public Types

  • typedef codecvt< char_type, char, __state_type > __codecvt_type
  • typedef __basic_file< char > __file_type
  • typedef basic_filebuf< char_type, traits_type > __filebuf_type
  • typedef traits_type::state_type __state_type
  • typedef basic_streambuf< char_type, traits_type > __streambuf_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 std::size_t size_t
  • typedef _Traits traits_type

๐Ÿฆ‹ Public Member Functions

  • stdio_filebuf ()
  • stdio_filebuf (int __fd, std::ios_base::openmode __mode, size_t __size=static_cast< size_t >(BUFSIZ))
  • stdio_filebuf (std::__c_file *__f, std::ios_base::openmode __mode, size_t __size=static_cast< size_t >(BUFSIZ))
  • stdio_filebuf (stdio_filebuf &&)=default
  • virtual ~stdio_filebuf ()
  • __filebuf_type * close () โ€” closes the currently associated file. bye bestie ๐Ÿ‘‹
  • int fd ()
  • std::__c_file * file ()
  • locale getloc () const โ€” locale access. the way it just tells you the localeโ€ฆ iconic.
  • streamsize in_avail () โ€” looking ahead into the stream. it's giving psychic ๐Ÿ”ฎ
  • bool is_open () const throw () โ€” returns true if the external file is open.
  • template<typename _Path> _If_fs_path< _Path, __filebuf_type * > open (const _Path &__s, ios_base::openmode __mode) โ€” opens an external file.
  • __filebuf_type * open (const char *__s, ios_base::openmode __mode) โ€” opens an external file.
  • __filebuf_type * open (const std::string &__s, ios_base::openmode __mode) โ€” opens an external file.
  • stdio_filebuf & operator= (stdio_filebuf &&)=default
  • locale pubimbue (const locale &__loc) โ€” entry point for imbue().
  • int_type sbumpc () โ€” getting the next character.
  • int_type sgetc () โ€” getting the next character.
  • streamsize sgetn (char_type *__s, streamsize __n) โ€” entry point for xsgetn.
  • int_type snextc () โ€” getting the next character.
  • int_type sputbackc (char_type __c) โ€” pushing characters back into the input stream.
  • int_type sputc (char_type __c) โ€” entry point for all single-character output functions.
  • streamsize sputn (const char_type *__s, streamsize __n) โ€” entry point for all single-character output functions.
  • int_type sungetc () โ€” moving backwards in the input stream.
  • void swap (stdio_filebuf &__fb)
  • void swap (basic_filebuf &)
    • basic_streambuf * pubsetbuf (char_type *__s, streamsize __n) โ€” entry points for derived buffer functions.
    • pos_type pubseekoff (off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out) โ€” alters the stream position.
    • pos_type pubseekpos (pos_type __sp, ios_base::openmode __mode=ios_base::in|ios_base::out) โ€” alters the stream position.
    • int pubsync () โ€” calls virtual sync function.

๐Ÿงš Protected Member Functions

  • void __safe_gbump (streamsize __n)
  • void __safe_pbump (streamsize __n)
  • void _M_allocate_internal_buffer ()
  • bool _M_convert_to_external (char_type *, streamsize)
  • void _M_create_pback ()
  • void _M_destroy_internal_buffer () throw ()
  • void _M_destroy_pback () throw ()
  • int _M_get_ext_pos (__state_type &__state)
  • pos_type _M_seek (off_type __off, ios_base::seekdir __way, __state_type __state)
  • void _M_set_buffer (streamsize __off)
  • bool _M_terminate_output ()
  • void gbump (int __n) โ€” moving the read position.
  • virtual void imbue (const locale &__loc) โ€” changes translations.
  • virtual int_type overflow (int_type __c=_Traits::eof()) โ€” consumes data from the buffer; writes to the controlled sequence.
  • virtual int_type pbackfail (int_type __c=_Traits::eof()) โ€” tries to back up the input sequence.
  • void pbump (int __n) โ€” moving the write position.
  • virtual pos_type seekoff (off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out) โ€” alters the stream positions.
  • virtual pos_type seekpos (pos_type __pos, ios_base::openmode __mode=ios_base::in|ios_base::out) โ€” alters the stream positions.
  • virtual __streambuf_type * setbuf (char_type *__s, streamsize __n) โ€” manipulates the buffer.
  • void setg (char_type *__gbeg, char_type *__gnext, char_type *__gend) โ€” setting the three read area pointers.
  • void setp (char_type *__pbeg, char_type *__pend) โ€” setting the three write area pointers.
  • virtual streamsize showmanyc () โ€” investigating the data available.
  • void swap (basic_streambuf &__sb)
  • virtual int sync () โ€” synchronizes the buffer arrays with the controlled sequences.
  • virtual int_type uflow () โ€” fetches more data from the controlled sequence.
  • virtual int_type underflow () โ€” fetches more data from the controlled sequence.
  • virtual streamsize xsgetn (char_type *__s, streamsize __n) โ€” multiple character extraction.
  • virtual streamsize xsputn (const char_type *__s, streamsize __n) โ€” multiple character insertion.
    • char_type * eback () const โ€” access to the get area.
    • char_type * gptr () const โ€” access to the get area.
    • char_type * egptr () const โ€” access to the get area.
    • char_type * pbase () const โ€” access to the put area.
    • char_type * pptr () const โ€” access to the put area.
    • char_type * epptr () const โ€” access to the put area.

๐Ÿ“ Protected Attributes

  • char_type * _M_buf โ€” pointer to the beginning of internal buffer.
  • bool _M_buf_allocated
  • locale _M_buf_locale โ€” current locale setting.
  • size_t _M_buf_size
  • const __codecvt_type * _M_codecvt
  • char * _M_ext_buf
  • streamsize _M_ext_buf_size
  • char * _M_ext_end
  • const char * _M_ext_next
  • __file_type _M_file
  • 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.
  • __c_lock _M_lock
  • ios_base::openmode _M_mode โ€” place to stash in || out || in | out settings for current filebuf.
  • 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.
  • bool _M_reading
  • __state_type _M_state_beg
  • __state_type _M_state_cur
  • __state_type _M_state_last
  • bool _M_writing
    • char_type _M_pback
    • char_type * _M_pback_cur_save
    • char_type * _M_pback_end_save
    • bool _M_pback_init

๐ŸŒˆ Detailed Description ๐ŸŒˆ

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
class __gnu_cxx::stdio_filebuf< _CharT, _Traits >

Provides a layer of compatibility for C/POSIX. ๐Ÿ’…

Okay so here's the tea, bestie: this GNU extension hands you extensions for working with standard C FILE*'s and POSIX file descriptors. The catch? you have to instantiate it yourself, with the type of character used in the file stream. Like, e.g., stdio_filebuf<char>. No auto-magic, you're the main character here. ๐Ÿ‘‘


๐Ÿ’œ Constructor & Destructor Documentation ๐Ÿ’œ

stdio_filebuf () [inline]

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
__gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf ()

Deferred initialization. It's giving "we'll deal with it later" energy and honestly? relatable. ๐Ÿ˜Œ

References std::basic_filebuf< _CharT, _Traits >::basic_filebuf().


stdio_filebuf (int __fd, std::ios_base::openmode __mode, size_t __size = static_cast<size_t>( BUFSIZ ))

template<typename _CharT, typename _Traits>
__gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf (int __fd,
    std::ios_base::openmode __mode,
    size_t __size = static_cast<size_t>( BUFSIZ ))

Parameters

  • __fd โ€” an open file descriptor.
  • __mode โ€” same meaning as in a standard filebuf.
  • __size โ€” optimal or preferred size of internal buffer, in chars.

This constructor associates a file stream buffer with an open POSIX file descriptor. Heads up: the file descriptor will be automatically closed when the stdio_filebuf is closed/destroyed. So like, don't go double-closing it, that's not the vibe. ๐Ÿ’€

References std::basic_filebuf< _CharT, _Traits >::_M_buf_size, std::basic_filebuf< _CharT, _Traits >::_M_mode, std::basic_filebuf< _CharT, _Traits >::_M_reading, std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), and std::basic_filebuf< _CharT, _Traits >::is_open().


stdio_filebuf (std::__c_file * __f, std::ios_base::openmode __mode, size_t __size = static_cast<size_t>( BUFSIZ ))

template<typename _CharT, typename _Traits>
__gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf (std::__c_file * __f,
    std::ios_base::openmode __mode,
    size_t __size = static_cast<size_t>( BUFSIZ ))

Parameters

  • __f โ€” an open FILE*.
  • __mode โ€” same meaning as in a standard filebuf.
  • __size โ€” optimal or preferred size of internal buffer, in chars. Defaults to system's BUFSIZ.

This constructor associates a file stream buffer with an open C FILE*. And here's the plot twist, bestie: the FILE* will not be automatically closed when the stdio_filebuf is closed/destroyed. She's independent, she doesn't need you to clean up after her. ๐Ÿ™ˆ

References std::basic_filebuf< _CharT, _Traits >::_M_buf_size, std::basic_filebuf< _CharT, _Traits >::_M_mode, std::basic_filebuf< _CharT, _Traits >::_M_reading, std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), and std::basic_filebuf< _CharT, _Traits >::is_open().


~stdio_filebuf () [virtual]

template<typename _CharT, typename _Traits>
__gnu_cxx::stdio_filebuf< _CharT, _Traits >::~stdio_filebuf ()

Closes the external data stream if the file descriptor constructor was used. (Remember the FILE* one? Yeah, that one stays open. Different girl, different rules. โœจ)


โญ Member Function Documentation โญ

_M_create_pback () [inline], [protected], [inherited]

template<typename _CharT, typename _Traits>
void std::basic_filebuf< _CharT, _Traits >::_M_create_pback ()

Initializes pback buffers, and moves normal buffers to safety.

Assumptions: _M_in_cur has already been moved back.

Referenced by pbackfail().


_M_destroy_pback () [inline], [protected], [inherited]

template<typename _CharT, typename _Traits>
void std::basic_filebuf< _CharT, _Traits >::_M_destroy_pback ()

Deactivates pback buffer contents, and restores normal buffer.

Assumptions: the pback buffer has only moved forward.

Referenced by overflow(), seekoff(), seekpos(), underflow(), and xsgetn().


_M_set_buffer (streamsize __off) [inline], [protected], [inherited]

template<typename _CharT, typename _Traits>
void std::basic_filebuf< _CharT, _Traits >::_M_set_buffer (streamsize __off)

This function sets the pointers of the internal buffer, both get and put areas. Typically:

__off == egptr() - eback() upon underflow/uflow (read mode);
__off == 0 upon overflow (write mode);
__off == -1 upon open, setbuf, seekoff/pos (uncommitted mode).
NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size reflects the actual allocated memory and the last cell is reserved for the overflow char of a full put area. ๐Ÿ‘‘ (yes, they really do reserve a whole cell for that one dramatic moment, and honestly? iconic.)

Referenced by __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), close(), imbue(), open(), overflow(), pbackfail(), underflow(), xsgetn(), and xsputn().


to be continued, bestieโ€ฆ more parts incoming ๐Ÿ’–

๐ŸŒธ close() โ€” say bye to the file, bestie

template<typename _CharT, typename _Traits>
  basic_filebuf< _CharT, _Traits >::__filebuf_type *
  std::basic_filebuf< _CharT, _Traits >::close()

[inherited]

Ok so this one closes the currently associated file. That's it, that's the job. ๐Ÿ’…

Returns: this on success, NULL on failure ๐Ÿ˜ญ

If there's no file currently open, this function immediately fails โ€” no file, no closing, sorry babe.

If a put buffer area exists, overflow(eof) gets called to flush all the characters out. Then the file is closed. If any of those operations fail, this function fails too.

References: basic_filebuf(), _M_mode, _M_pback_init, _M_reading, _M_set_buffer(), and is_open().

Referenced by: std::basic_filebuf< char_type, traits_type >::~basic_filebuf(), and open().


๐Ÿฆ‹ eback() โ€” where the get area begins

template<typename _CharT, typename _Traits>
  char_type *
  std::basic_streambuf< _CharT, _Traits >::eback() const

[inline], [protected], [inherited]

Access to the get area, bestie. These functions are only available to other protected functions, including derived classes โ€” so like, not for the general public, it's giving VIP section energy ๐ŸŽ€

  • eback() returns the beginning pointer for the input sequence
  • gptr() returns the next pointer for the input sequence
  • egptr() returns the end pointer for the input sequence

Referenced by: std::basic_filebuf< char_type, traits_type >::_M_destroy_pback(), std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_streambuf< char_type, traits_type >::sputbackc(), std::basic_streambuf< char_type, traits_type >::sungetc(), std::basic_filebuf< _CharT, _Traits >::underflow(), and std::basic_filebuf< _CharT, _Traits >::xsgetn().


๐ŸŒˆ egptr() โ€” where the get area ends

template<typename _CharT, typename _Traits>
  char_type *
  std::basic_streambuf< _CharT, _Traits >::egptr() const

[inline], [protected], [inherited]

Access to the get area again, same rules: only other protected functions and derived classes get to peek ๐Ÿ‘€

  • eback() returns the beginning pointer for the input sequence
  • gptr() returns the next pointer for the input sequence
  • egptr() returns the end pointer for the input sequence

Referenced by: std::basic_filebuf< char_type, traits_type >::_M_create_pback(), std::basic_streambuf< char_type, traits_type >::in_avail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_streambuf< char_type, traits_type >::sbumpc(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_streambuf< char_type, traits_type >::sgetc(), std::basic_filebuf< _CharT, _Traits >::showmanyc(), std::basic_stringbuf< char >::showmanyc(), std::basic_filebuf< _CharT, _Traits >::underflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow(), std::wbuffer_convert< _Codecvt, _Elem, _Tr >::underflow(), std::basic_filebuf< _CharT, _Traits >::xsgetn(), and xsgetn().


โœจ epptr() โ€” where the put area ends

template<typename _CharT, typename _Traits>
  char_type *
  std::basic_streambuf< _CharT, _Traits >::epptr() const

[inline], [protected], [inherited]

Now we're on the put area (output side, main character energy ๐Ÿ‘‘). Same deal โ€” only other protected functions and derived classes, no walk-ins.

  • pbase() returns the beginning pointer for the output sequence
  • pptr() returns the next pointer for the output sequence
  • epptr() returns the end pointer for the output sequence

Referenced by: std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_streambuf< char_type, traits_type >::sputc(), std::basic_filebuf< _CharT, _Traits >::xsputn(), and xsputn().


๐Ÿ“ fd() โ€” the raw file descriptor, unlocked ๐Ÿ”“

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
  int
  __gnu_cxx::stdio_filebuf< _CharT, _Traits >::fd()

[inline]

Returns: The underlying file descriptor.

Once you're associated with an external data stream, this function lets you get at the underlying POSIX file descriptor. But listen โ€” there is no way for the library to track what you do with the descriptor, so be careful. Fr fr. It's giving handing your bestie the aux and then leaving the room ๐Ÿ™ˆ


๐Ÿงš file() โ€” the FILE*, also unlocked

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
  std::__c_file *
  __gnu_cxx::stdio_filebuf< _CharT, _Traits >::file()

[inline]

Returns: The underlying FILE*.

This one gets you the underlying "C" file pointer. And again โ€” there is no way for the library to track what you do with the file, so be careful. Same warning, same energy, we love a consistent queen ๐Ÿ’…


๐ŸŽ€ gbump() โ€” scoot the read position forward

template<typename _CharT, typename _Traits>
  void
  std::basic_streambuf< _CharT, _Traits >::gbump(int __n)

[inline], [protected], [inherited]

Moving the read position, that's the whole vibe.

Parameters:

  • __n โ€” The delta by which to move.

This just advances the read position without returning any data. Like scrolling past a post without double-tapping. No cap.

Referenced by: std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_streambuf< char_type, traits_type >::sbumpc(), std::basic_streambuf< char_type, traits_type >::sputbackc(), std::basic_streambuf< char_type, traits_type >::sungetc(), std::basic_streambuf< char_type, traits_type >::uflow(), and std::basic_filebuf< _CharT, _Traits >::xsgetn().


๐Ÿ’œ getloc() โ€” which locale are we in rn?

template<typename _CharT, typename _Traits>
  locale
  std::basic_streambuf< _CharT, _Traits >::getloc() const

[inline], [inherited]

Locale access, periodt.

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 gets returned. So it's like, either the new vibe you set or the one you were born with ๐Ÿฆ‹

Referenced by: std::basic_streambuf< char_type, traits_type >::pubimbue().


๐ŸŒธ gptr() โ€” the next pointer for the input sequence

template<typename _CharT, typename _Traits>
  char_type *
  std::basic_streambuf< _CharT, _Traits >::gptr() const

[inline], [protected], [inherited]

Get area access, third time's the charm โœจ Protected-only, derived classes and other protected functions, you know the drill.

  • eback() returns the beginning pointer for the input sequence
  • gptr() returns the next pointer for the input sequence
  • egptr() returns the end pointer for the input sequence

Referenced by: std::basic_filebuf< char_type, traits_type >::_M_create_pback(), std::basic_filebuf< char_type, traits_type >::_M_destroy_pback(), std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_streambuf< char_type, traits_type >::in_avail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_streambuf< char_type, traits_type >::sbumpc(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_streambuf< char_type, traits_type >::sgetc(), std::basic_filebuf< _CharT, _Traits >::showmanyc(), std::basic_stringbuf< char >::showmanyc(), std::basic_streambuf< char_type, traits_type >::sputbackc(), std::basic_streambuf< char_type, traits_type >::sungetc(), std::basic_streambuf< char_type, traits_type >::uflow(), std::basic_filebuf< _CharT, _Traits >::underflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow(), std::wbuffer_convert< _Codecvt, _Elem, _Tr >::underflow(), std::basic_filebuf< _CharT, _Traits >::xsgetn(), and xsgetn().


๐Ÿฆ‹ imbue() โ€” new locale, who dis

template<typename _CharT, typename _Traits>
  void
  std::basic_filebuf< _CharT, _Traits >::imbue(const locale & __loc)

[protected], [virtual], [inherited]

Changes translations. Slay.

Parameters:

  • __loc โ€” A new locale.

Translations done during I/O that depend on the current locale get swapped out by this call. The standard adds: "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: Base class version does nothing. Literally nothing. It's giving "I showed up but I'm not participating" ๐Ÿ’€

Reimplemented from: std::basic_streambuf< _CharT, _Traits >.

References: _M_ext_buf, _M_ext_next, _M_mode, _M_reading, _M_set_buffer(), std::ios_base::cur, std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::gptr(), is_open(), and seekoff().


โญ in_avail() โ€” peeking ahead into the stream

template<typename _CharT, typename _Traits>
  streamsize
  std::basic_streambuf< _CharT, _Traits >::in_avail()

[inline], [inherited]

Looking ahead into the stream, lowkey the most useful thing here ๐Ÿ‘€

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().


๐Ÿ”ฅ is_open() โ€” bestie check: is the file even open?

template<typename _CharT, typename _Traits>
  bool
  std::basic_filebuf< _CharT, _Traits >::is_open() const

[inline], [nodiscard], [inherited]

Returns true if the external file is open. That's it. Short, sweet, iconic.

Referenced by: __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), close(), imbue(), open(), seekoff(), seekpos(), setbuf(), and showmanyc().


๐Ÿงš open() โ€” the filesystem::path flavour

template<typename _CharT, typename _Traits>
  template<typename _Path>
    _If_fs_path< _Path, __filebuf_type * >
    std::basic_filebuf< _CharT, _Traits >::open(const _Path & __s, ios_base::openmode __mode)

[inline], [inherited]

Opens an external file ๐Ÿ’–

Parameters:

  • __s โ€” The name of the file, as a filesystem::path.
  • __mode โ€” The open mode flags.

Returns: this on success, NULL on failure.


๐ŸŽ€ open() โ€” the const char * flavour

template<typename _CharT, typename _Traits>
  basic_filebuf< _CharT, _Traits >::__filebuf_type *
  std::basic_filebuf< _CharT, _Traits >::open(const char * __s, ios_base::openmode __mode)

[inherited]

Opens an external file ๐Ÿ’– (yes, again, different signature, don't @ me)

Parameters:

  • __s โ€” The name of the file.
  • __mode โ€” The open mode flags.

Returns: this on success, NULL on failure.

If a file is already open, this function immediately fails โ€” one file at a time, we're monogamous here ๐Ÿ™ˆ Otherwise it tries to open the file named __s using the flags given in __mode.

Table 92, adapted here, gives the relation between openmode combinations and the equivalent fopen() flags. (NB: lines app, in|out|app, in|app, binary|app, binary|in|out|app, and binary|in|app per DR 596)

That table tho โ€” it's the whole vibe of "which ios_base flag combo gives you which stdio mode". Read it like a little cheat sheet, bestie ๐Ÿ’…:

+---------------------------------------------------------+
| ios_base Flag combination            stdio equivalent   |
|binary  in  out  trunc  app                              |
+---------------------------------------------------------+
|             +                        w                  |
|             +           +            a                  |
|                         +            a                  |
|             +     +                  w                  |
|         +                            r                  |
|         +   +                        r+                 |
|         +   +     +                  w+                 |
|         +   +           +            a+                 |
|         +               +            a+                 |
+---------------------------------------------------------+
|   +         +                        wb                 |
|   +         +           +            ab                 |
|   +                     +            ab                 |
|   +         +     +                  wb                 |
|   +     +                            rb                 |
|   +     +   +                        r+b                |
|   +     +   +     +                  w+b                |
|   +     +   +           +            a+b                |
|   +     +               +            a+b                |
+---------------------------------------------------------+

References _M_mode, _M_reading, _M_set_buffer(), std::ios_base::ate, close(), std::ios_base::end, is_open(), and seekoff().

Referenced by std::basic_filebuf< char_type, traits_type >::open(), and std::basic_filebuf< char_type, traits_type >::open().


๐Ÿฆ‹ template<typename _CharT, typename _Traits> __filebuf_type * std::basic_filebuf< _CharT, _Traits >::open (const std::string & __s, ios_base::openmode __mode) [inline], [inherited]

Opens an external file. Yes babe, it literally opens the file for you ๐Ÿซถ

Parameters

  • __s โ€” The name of the file.
  • __mode โ€” The open mode flags.

Returns

this on success, NULL on failure ๐Ÿ˜ญ


๐ŸŒธ template<typename _CharT, typename _Traits> basic_filebuf< _CharT, _Traits >::int_type std::basic_filebuf< _CharT, _Traits >::overflow (int_type __c = _Traits::eof()) [protected], [virtual], [inherited]

Consumes data from the buffer; writes to the controlled sequence. It's giving "the buffer is full, time to flush" energy โœจ

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 >.

References _M_buf_size, _M_destroy_pback(), _M_mode, _M_reading, _M_set_buffer(), std::ios_base::app, std::ios_base::cur, std::ios_base::out, std::basic_streambuf< _CharT, _Traits >::pbase(), std::basic_streambuf< _CharT, _Traits >::pbump(), and std::basic_streambuf< _CharT, _Traits >::pptr().

Referenced by pbackfail(), sync(), underflow(), and xsgetn().


๐Ÿ’œ template<typename _CharT, typename _Traits> basic_filebuf< _CharT, _Traits >::int_type std::basic_filebuf< _CharT, _Traits >::pbackfail (int_type __c = _Traits::eof()) [protected], [virtual], [inherited]

Tries to back up the input sequence. Rewind, but make it a struggle ๐Ÿ˜ญ

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 >.

References _M_create_pback(), _M_mode, _M_pback_init, _M_reading, _M_set_buffer(), std::ios_base::cur, std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::gbump(), std::basic_streambuf< _CharT, _Traits >::gptr(), std::ios_base::in, overflow(), seekoff(), and underflow().


โœจ 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.

  • pbase() returns the beginning pointer for the output sequence
  • pptr() returns the next pointer for the output sequence
  • epptr() returns the end pointer for the output sequence

Referenced by std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_stringbuf< char >::str(), std::basic_filebuf< _CharT, _Traits >::sync(), and std::basic_filebuf< _CharT, _Traits >::xsputn().


๐ŸŽ€ template<typename _CharT, typename _Traits> void std::basic_streambuf< _CharT, _Traits >::pbump (int __n) [inline], [protected], [inherited]

Moving the write position. Little scoot, no data returned ๐Ÿฆ‹

Parameters

  • __n โ€” The delta by which to move.

This just advances the write position without returning any data.

Referenced by std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), and std::basic_streambuf< char_type, traits_type >::sputc().


๐ŸŒˆ template<typename _CharT, typename _Traits> char_type * std::basic_streambuf< _CharT, _Traits >::pptr () 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 sequence
  • pptr() returns the next pointer for the output sequence
  • epptr() returns the end pointer for the output sequence

Referenced by std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_streambuf< char_type, traits_type >::sputc(), std::basic_filebuf< _CharT, _Traits >::sync(), std::basic_filebuf< _CharT, _Traits >::xsputn(), and xsputn().


๐Ÿ’– 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 hands off to the real one ๐Ÿ’…

Parameters

  • __loc โ€” The new locale.

Returns

The previous locale.

Calls the derived imbue(__loc).


โญ 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. Glow-up for the stream's location ๐Ÿ“

Parameters

  • __off โ€” Offset.
  • __way โ€” Value for ios_base::seekdir.
  • __mode โ€” Value for ios_base::openmode.

Calls virtual seekoff function.


๐Ÿ“ 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.

Parameters

  • __sp โ€” Position
  • __mode โ€” Value for ios_base::openmode.

Calls virtual seekpos function.


๐Ÿงš 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. So pub-prefixed = the front door, no cap ๐Ÿซถ


๐Ÿ‘‘ template<typename _CharT, typename _Traits> int std::basic_streambuf< _CharT, _Traits >::pubsync () [inline], [inherited]

Calls virtual sync function.

Referenced by std::basic_istream< _CharT, _Traits >::sync().


๐Ÿ”ฅ template<typename _CharT, typename _Traits> int_type std::basic_streambuf< _CharT, _Traits >::sbumpc () [inline], [inherited]

Getting the next character. Grab it and move on, periodt โœจ

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().

Referenced by std::basic_istream< _CharT, _Traits >::ignore(), std::basic_streambuf< char_type, traits_type >::snextc(), and std::basic_istream< _CharT, char_traits< _CharT > >::unget().


๐Ÿ’œ template<typename _CharT, typename _Traits> basic_filebuf< _CharT, _Traits >::pos_type std::basic_filebuf< _CharT, _Traits >::seekoff (off_type , ios_base::seekdir , ios_base::openmode = ios_base::in | ios_base::out) [protected], [virtual], [inherited]

Alters the stream positions. Each derived class provides its own appropriate behavior.

Note โ€” Base class version does nothing, returns a pos_type that represents an invalid stream position. So lowkey it's a no-op up here, don't be fooled ๐Ÿ˜ญ

Reimplemented from std::basic_streambuf< _CharT, _Traits >.

References _M_destroy_pback(), _M_reading, std::ios_base::cur, is_open(), std::basic_streambuf< _CharT, _Traits >::pbase(), and std::basic_streambuf< _CharT, _Traits >::pptr().

Referenced by imbue(), open(), and pbackfail().


๐ŸŒธ template<typename _CharT, typename _Traits> basic_filebuf< _CharT, _Traits >::pos_type std::basic_filebuf< _CharT, _Traits >::seekpos (pos_type , ios_base::openmode = ios_base::in | ios_base::out) [protected], [virtual], [inherited]

Alters the stream positions. Each derived class provides its own appropriate behavior.

Note โ€” Base class version does nothing, returns a pos_type that represents an invalid stream position. Again bestie, base class is just vibing ๐Ÿซ 

Reimplemented from std::basic_streambuf< _CharT, _Traits >.

References _M_destroy_pback(), std::ios_base::beg, and is_open().


๐Ÿฆ‹ template<typename _CharT, typename _Traits> basic_filebuf< _CharT, _Traits >::__streambuf_type * std::basic_filebuf< _CharT, _Traits >::setbuf (char_type * __s, streamsize __n) [protected], [virtual], [inherited]

Manipulates the buffer. You're literally choosing where the tea gets held ๐Ÿต

Parameters

  • __s โ€” Pointer to a buffer area.
  • __n โ€” Size of __s.

Returns

this

If no file has been opened, and both __s and __n are zero, then the stream becomes unbuffered. Otherwise, __s is used as a buffer; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering for more.

Reimplemented from std::basic_streambuf< _CharT, _Traits >.

References _M_buf, _M_buf_size, and is_open().


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]

Okay bestie, this one is literally just setting the three read area pointers. That's it. That's the job. ๐ŸŽ€

Parameters

  • __gbeg โ€” A pointer.
  • __gnext โ€” A pointer.
  • __gend โ€” A pointer.

Postcondition

__gbeg == eback(), __gnext == gptr(), and __gend == egptr()

So yeah, after you call this, those three line up exactly like that. no cap. โœจ

Referenced by std::wbuffer_convert< _Codecvt, _Elem, _Tr >::wbuffer_convert(), std::basic_filebuf< char_type, traits_type >::_M_create_pback(), std::basic_filebuf< char_type, traits_type >::_M_destroy_pback(), std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), and std::basic_filebuf< _CharT, _Traits >::xsgetn().


setp ๐Ÿ’–

template<typename _CharT, typename _Traits> void std::basic_streambuf< _CharT, _Traits >::setp (char_type * __pbeg, char_type * __pend) [inline],  [protected],  [inherited]

And this is the twin flame of setg โ€” setting the three write area pointers. the way these two are always side by side. ๐Ÿฆ‹

Parameters

  • __pbeg โ€” A pointer.
  • __pend โ€” A pointer.

Postcondition

__pbeg == pbase(), __pbeg == pptr(), and __pend == epptr()

Yes, the original really does say __pbeg == pptr(). Not __pbeg == pbase() twice, not __pbeg == pptr() twice โ€” we're reading it exactly as written, bestie. ๐Ÿ’…

Referenced by std::wbuffer_convert< _Codecvt, _Elem, _Tr >::wbuffer_convert(), and std::basic_filebuf< char_type, traits_type >::_M_set_buffer().


sgetc ๐ŸŒธ

template<typename _CharT, typename _Traits> int_type std::basic_streambuf< _CharT, _Traits >::sgetc () [inline],  [inherited]

Getting the next character. lowkey the most "peek don't touch" function in the whole building. ๐Ÿ‘€

Returns

The next character, or eof.

If the input read position is available, it returns that character, otherwise it calls and returns underflow(). And the important part โ€” it does not move the read position after fetching the character. it's giving window shopping. ๐Ÿ›๏ธ

Referenced by std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, char_traits< _CharT > >::readsome(), and std::basic_streambuf< char_type, traits_type >::snextc().


sgetn ๐ŸŒธ

template<typename _CharT, typename _Traits> streamsize std::basic_streambuf< _CharT, _Traits >::sgetn (char_type * __s, streamsize __n) [inline],  [inherited]

Entry point for xsgetn. that's the whole vibe. ๐ŸŽ€

Parameters

  • __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. "if possible" doing a LOT of heavy lifting in that sentence, fr fr. ๐Ÿ˜ญ


showmanyc ๐Ÿ‘‘

template<typename _CharT, typename _Traits> streamsize std::basic_filebuf< _CharT, _Traits >::showmanyc () [protected],  [virtual],  [inherited]

Investigating the data available. it's the detective of the streambuf world. ๐Ÿ”

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 [to underflow or uflow] will not return eof() but that they will return immediately.
  • The standard adds that the morphemes of showmanyc are es-how-many-see, not show-manic.
Not "show-manic" bestie. "es-how-many-see." the standard said it, not me. ๐Ÿ’€๐Ÿ’…

Reimplemented from std::basic_streambuf< _CharT, _Traits >.

References _M_mode, std::ios_base::binary, std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gptr(), std::ios_base::in, and is_open().


snextc โœจ

template<typename _CharT, typename _Traits> int_type std::basic_streambuf< _CharT, _Traits >::snextc () [inline],  [inherited]

Also getting the next character โ€” yes, another one, they're a family. ๐Ÿซถ

Returns

The next character, or eof.

Calls sbumpc(), and if that function returns traits::eof(), so does this function. Otherwise, sgetc(). It's giving "skip one, then peek." iconic behavior honestly. ๐ŸŒˆ

Referenced by std::basic_istream< _CharT, char_traits< _CharT > >::get(), std::basic_iostream< char_type, traits_type >::ignore(), and std::basic_istream< _CharT, char_traits< _CharT > >::readsome().


sputbackc ๐Ÿ’…

template<typename _CharT, typename _Traits> int_type std::basic_streambuf< _CharT, _Traits >::sputbackc (char_type __c) [inline],  [inherited]

Pushing characters back into the input stream. putting it back like you never took it. ๐Ÿ’–

Parameters

  • __c โ€” The character to push back.

Returns

The previous character, if possible.

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. So yes, you literally get to choose what comes next. main character energy fr. ๐Ÿ‘‘

Referenced by std::basic_istream< _CharT, _Traits >::putback().


sputc ๐Ÿ“

template<typename _CharT, typename _Traits> int_type std::basic_streambuf< _CharT, _Traits >::sputc (char_type __c) [inline],  [inherited]

Entry point for all single-character output functions. all of them. every single one. the pressure is real. ๐Ÿ˜ญ

Parameters

  • __c โ€” A character to output.

Returns

__c, if possible.

One of two public output functions.

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). so basically: room? cool. no room? overflow handles it. slay. โœจ

Referenced by std::wbuffer_convert< _Codecvt, _Elem, _Tr >::overflow().


sputn ๐Ÿ“

template<typename _CharT, typename _Traits> streamsize std::basic_streambuf< _CharT, _Traits >::sputn (const char_type * __s, streamsize __n) [inline],  [inherited]

Entry point for all single-character output functions โ€” and yes, it says that same line here too. not a typo on my end, bestie, that's genuinely what the page says. ๐Ÿ™ˆ

Parameters

  • __s โ€” A buffer read area.
  • __n โ€” A count.

One of two public output functions.

Returns xsputn(__s,__n). The effect is to write __s[0] through __s[__n-1] to the output sequence, if possible. again with the "if possible." the audacity. ๐Ÿ’€


sungetc ๐Ÿฆ‹

template<typename _CharT, typename _Traits> int_type std::basic_streambuf< _CharT, _Traits >::sungetc () [inline],  [inherited]

Moving backwards in the input stream. going back?? in THIS economy?? ๐ŸŒธ

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. it's giving "undo" but for characters. ๐ŸŽ€

Referenced by std::basic_istream< _CharT, _Traits >::unget().


sync ๐Ÿงš

template<typename _CharT, typename _Traits> int std::basic_filebuf< _CharT, _Traits >::sync () [protected],  [virtual],  [inherited]

Synchronizes the buffer arrays with the controlled sequences. getting everybody on the same page, literally. ๐Ÿ“–

Returns

-1 on failure.

Each derived class provides its own appropriate behavior, including the definition of failure. so "failure" is kinda subjective here and that's on purpose. iykyk. ๐Ÿ’…

Note

Base class version does nothing, returns zero.

Reimplemented from std::basic_streambuf< _CharT, _Traits >.

References overflow(), std::basic_streambuf< _CharT, _Traits >::pbase(), and std::basic_streambuf< _CharT, _Traits >::pptr().


uflow ๐ŸŒˆ

template<typename _CharT, typename _Traits> virtual int_type std::basic_streambuf< _CharT, _Traits >::uflow () [inline],  [protected],  [virtual],  [inherited]

Fetches more data from the controlled sequence. ๐Ÿซถ

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. that's the one little difference. the plot twist. ๐Ÿ˜ญ

Reimplemented in __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >.

Referenced by std::basic_streambuf< char_type, traits_type >::sbumpc(), and xsgetn().


underflow ๐Ÿ‘‘

template<typename _CharT, typename _Traits> basic_filebuf< _CharT, _Traits >::int_type std::basic_filebuf< _CharT, _Traits >::underflow () [protected],  [virtual],  [inherited]

Fetches more data from the controlled sequence. the icon. the legend. the moment. โญ

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 >.

References _M_buf_size, _M_destroy_pback(), _M_mode, _M_set_buffer(), std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gptr(), std::ios_base::in, and overflow().

Referenced by pbackfail().


xsgetn ๐Ÿ’œ

template<typename _CharT, typename _Traits> streamsize std::basic_filebuf< _CharT, _Traits >::xsgetn (char_type * __s, streamsize __n) [protected],  [virtual],  [inherited]

Multiple character extraction. bulk mode. it ate. ๐Ÿ”ฅ

Parameters

  • __s โ€” A buffer area.
  • __n โ€” Maximum number of characters to assign.

Returns

The number of characters assigned.

Fills __s[0] through __s[__n-1] with characters from the input sequence, as if by sbumpc(). Stops when either __n characters have been copied, or when traits::eof() would be copied. so it stops before it copies eof, it doesn't copy eof and then stop. very demure, very mindful. ๐ŸŽ€

It is expected that derived classes provide a more efficient implementation by overriding this definition.

Reimplemented from std::basic_streambuf< _CharT, _Traits >.

References _M_buf_size, _M_destroy_pback(), _M_mode, _M_pback_init, _M_reading, _M_set_buffer(), std::basic_streambuf< _CharT, _Traits >::eback(), std::basic_streambuf< _CharT, _Traits >::egptr(), std::basic_streambuf< _CharT, _Traits >::gbump(), std::basic_streambuf< _CharT, _Traits >::gptr(), std::ios_base::in, overflow(), std::basic_streambuf< _CharT, _Traits >::setg(), and std::basic_streambuf< char_type, traits_type >::xsgetn().


xsputn ๐Ÿ’œ

template<typename _CharT, typename _Traits> streamsize std::basic_filebuf< _CharT, _Traits >::xsputn (const char_type * __s, streamsize __n) [protected],  [virtual],  [inherited]

Multiple character insertion. the writing counterpart, holding it down on the other side. ๐Ÿ’…

Parameters

  • __s โ€” A buffer area.
  • __n โ€” Maximum number of characters to write.

Returns

The number of characters written.

Writes __s[0] through __s[__n-1] to the output sequence, as if by sputc(). 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 from std::basic_streambuf< _CharT, _Traits >.

Okay so the references for that last function were literally: _M_buf_size, _M_mode, _M_reading, _M_set_buffer(), std::ios_base::app, std::basic_streambuf< _CharT, _Traits >::epptr(), std::ios_base::out, std::basic_streambuf< _CharT, _Traits >::pbase(), std::basic_streambuf< _CharT, _Traits >::pptr(), and std::basic_streambuf< char_type, traits_type >::xsputn(). Periodt. ๐Ÿ’…


๐Ÿ’– Member Data Documentation ๐Ÿ’–

Okay bestie, now we're in the member data zone. These are all [protected] and [inherited], so they're like the VIP section of the class. Let's get into it. ๐ŸŽ€


_M_buf ๐Ÿ’–

template<typename _CharT, typename _Traits> char_type* std::basic_filebuf< _CharT, _Traits >::_M_buf

[protected], [inherited] โ€” This is literally the pointer to the beginning of the internal buffer. It's giving "start of the vibe". Referenced by basic_filebuf(), and setbuf().


_M_buf_locale ๐ŸŒ

template<typename _CharT, typename _Traits> locale std::basic_streambuf< _CharT, _Traits >::_M_buf_locale

[protected], [inherited] โ€” The current locale setting. So you know what language and formatting rules are in play. Referenced by std::basic_filebuf< _CharT, _Traits >::basic_filebuf().


_M_buf_size ๐Ÿ“

template<typename _CharT, typename _Traits> size_t std::basic_filebuf< _CharT, _Traits >::_M_buf_size

[protected], [inherited] โ€” The actual size of the internal buffer. This number is equal to the size of the put area + 1 position, reserved for the overflow char of a full area. So it's like the buffer's official size, plus one for the overflow char. Referenced by basic_filebuf(), __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), overflow(), setbuf(), underflow(), xsgetn(), and xsputn().


_M_ext_buf ๐Ÿงณ

template<typename _CharT, typename _Traits> char* std::basic_filebuf< _CharT, _Traits >::_M_ext_buf

[protected], [inherited] โ€” Buffer for external characters. Used for input when codecvt::always_noconv() == false. When valid, this corresponds to eback(). So it's the external buffer, used when codecvt isn't in no-conversion mode. Referenced by basic_filebuf(), and imbue().


_M_ext_buf_size ๐Ÿ“

template<typename _CharT, typename _Traits> streamsize std::basic_filebuf< _CharT, _Traits >::_M_ext_buf_size

[protected], [inherited] โ€” Size of buffer held by _M_ext_buf. Referenced by basic_filebuf().


_M_ext_next โžก๏ธ

template<typename _CharT, typename _Traits> const char* std::basic_filebuf< _CharT, _Traits >::_M_ext_next

[protected], [inherited] โ€” Pointers into the buffer held by _M_ext_buf that delimit a subsequence of bytes that have been read but not yet converted. When valid, _M_ext_next corresponds to egptr(). Referenced by basic_filebuf(), and imbue().


_M_in_beg ๐Ÿ

template<typename _CharT, typename _Traits> char_type* std::basic_streambuf< _CharT, _Traits >::_M_in_beg

[protected], [inherited] โ€” Start of get area. So the beginning of the read zone.


_M_in_cur ๐Ÿ“–

template<typename _CharT, typename _Traits> char_type* std::basic_streambuf< _CharT, _Traits >::_M_in_cur

[protected], [inherited] โ€” Current read area. Where you're at in the get area.


_M_in_end ๐Ÿ”š

template<typename _CharT, typename _Traits> char_type* std::basic_streambuf< _CharT, _Traits >::_M_in_end

[protected], [inherited] โ€” End of get area. The finish line for reading.


_M_mode ๐ŸŽ›๏ธ

template<typename _CharT, typename _Traits> ios_base::openmode std::basic_filebuf< _CharT, _Traits >::_M_mode

[protected], [inherited] โ€” Place to stash in || out || in | out settings for current filebuf. So it holds the open mode flags. Referenced by basic_filebuf(), __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), close(), imbue(), open(), overflow(), pbackfail(), showmanyc(), underflow(), xsgetn(), and xsputn().


_M_out_beg ๐Ÿš€

template<typename _CharT, typename _Traits> char_type* std::basic_streambuf< _CharT, _Traits >::_M_out_beg

[protected], [inherited] โ€” Start of put area. The beginning of the write zone.


_M_out_cur โœ๏ธ

template<typename _CharT, typename _Traits> char_type* std::basic_streambuf< _CharT, _Traits >::_M_out_cur

[protected], [inherited] โ€” Current put area. Where you're writing right now.


_M_out_end ๐Ÿ

template<typename _CharT, typename _Traits> char_type* std::basic_streambuf< _CharT, _Traits >::_M_out_end

[protected], [inherited] โ€” End of put area. The limit of the write zone.


_M_pback โ†ฉ๏ธ

template<typename _CharT, typename _Traits> char_type std::basic_filebuf< _CharT, _Traits >::_M_pback

[protected], [inherited] โ€” Necessary bits for putback buffer management.

Note: pbacks of over one character are not currently supported.

Referenced by basic_filebuf().


_M_pback_cur_save ๐Ÿ’พ

template<typename _CharT, typename _Traits> char_type* std::basic_filebuf< _CharT, _Traits >::_M_pback_cur_save

[protected], [inherited] โ€” Necessary bits for putback buffer management.

Note: pbacks of over one character are not currently supported.

Referenced by basic_filebuf().


_M_pback_end_save ๐Ÿ’พ

template<typename _CharT, typename _Traits> char_type* std::basic_filebuf< _CharT, _Traits >::_M_pback_end_save

[protected], [inherited] โ€” Necessary bits for putback buffer management.

Note: pbacks of over one character are not currently supported.

Referenced by basic_filebuf().


_M_pback_init ๐Ÿ”ง

template<typename _CharT, typename _Traits> bool std::basic_filebuf< _CharT, _Traits >::_M_pback_init

[protected], [inherited] โ€” Necessary bits for putback buffer management.

Note: pbacks of over one character are not currently supported.

Referenced by basic_filebuf(), close(), pbackfail(), and xsgetn().


_M_reading ๐Ÿ“–

template<typename _CharT, typename _Traits> bool std::basic_filebuf< _CharT, _Traits >::_M_reading

[protected], [inherited] โ€” _M_reading == false && _M_writing == false for uncommitted mode; _M_reading == true for read mode; _M_writing == true for write mode;

NB: _M_reading == true && _M_writing == true is unused.

Referenced by basic_filebuf(), __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), __gnu_cxx::stdio_filebuf< _CharT, _Traits >::stdio_filebuf(), close(), imbue(), open(), overflow(), pbackfail(), seekoff(), xsgetn(), and xsputn().


โœจ Author โœจ

Generated automatically by Doxygen for libstdc++ from the source code. So no human wrote this, it's all machine magic. ๐Ÿค–โœจ


And that's the whole page, bestie! This was brought to you by libstdc++, and the page is __gnu_cxx:..., _Traits >(3). No date on this one, soz. Stay iconic! ๐Ÿ’–โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 ยท GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 ยท GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 ยท GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms