__GNU_CXX::ENC_FILEBUF(3)

okay bestie, this page comes from the Library Functions Manual and it's giving major C++ library energy. We're talking about __gnu_cxx::enc_filebuf< _CharT > β€” a whole class, no cap. Let's get into it. πŸ’–


🌸 NAME 🌸

  • __gnu_cxx::enc_filebuf< _CharT > β€” class enc_filebuf. that's the whole vibe.

✨ SYNOPSIS ✨

#include <enc_filebuf.h>

Inherits from std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >.

πŸŽ€ 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 traits_type::state_type state_type
  • typedef encoding_char_traits< _CharT > traits_type

πŸ’… Public Member Functions πŸ’…

  • enc_filebuf (state_type &__state)
  • __filebuf_type * close () β€” Closes the currently associated file.
  • locale getloc () const β€” Locale access.
  • streamsize in_avail () β€” Looking ahead into the stream.
  • bool is_open () const throw () β€” Returns true if the external file is open.
  • __filebuf_type * open (const char *__s, ios_base::openmode __mode) β€” Opens an external file.
  • 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 (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=encoding_char_traits< _CharT >::eof()) β€” Consumes data from the buffer; writes to the controlled sequence.
  • virtual int_type pbackfail (int_type __c=encoding_char_traits< _CharT >::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>
    class __gnu_cxx::enc_filebuf< _CharT >"class enc_filebuf.

πŸ’– MEMBER FUNCTION DOCUMENTATION πŸ’–

🌟 void std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_create_pback () [inline], [protected], [inherited]

Initializes pback buffers, and moves normal buffers to safety.

Assumptions: _M_in_cur has already been moved back.


🌟 void std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_destroy_pback () [inline], [protected], [inherited]

Deactivates pback buffer contents, and restores normal buffer.

Assumptions: The pback buffer has only moved forward.


🌟 void std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_set_buffer (streamsize __off) [inline], [protected], [inherited]

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.

Referenced by seekpos(), and setbuf().


🌟 basic_filebuf< _CharT, encoding_char_traits< _CharT > >::__filebuf_type * std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::close () [inherited]

Closes the currently associated file.

Returns

  • this on success, NULL on failure.

If no file is currently open, this function immediately fails.

If a put buffer area exists, overflow(eof) is called to flush all the characters. The file is then closed.

If any operations fail, this function also fails.


🌟 char_type * std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::eback () 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 sequence
  • gptr() returns the next pointer for the input sequence
  • egptr() returns the end pointer for the input sequence

🌟 char_type * std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::egptr () const [inline], [protected], [inherited]

Access to the get area. These functions are only available to other protected functions, including derived classes.

Same bullet trio as above, bestie:

  • 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

🌟 char_type * std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::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 sequence
  • pptr() returns the next pointer for the output sequence
  • epptr() returns the end pointer for the output sequence

🌟 void std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::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.


🌟 locale std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::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.


🌟 char_type * std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::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 sequence
  • gptr() returns the next pointer for the input sequence
  • egptr() returns the end pointer for the input sequence

🌟 void std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::imbue (const locale & __loc) [protected], [virtual], [inherited]

Changes translations.

Parameters

  • __loc β€” A new locale.

Translations done during I/O which depend on the current locale are changed 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.

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

streamsize std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::in_avail () [inline], [inherited]

bestie this one is literally just πŸ‘€ looking ahead into the stream. That's the whole vibe.

Returns: the number of characters available.

If a read position is available, it gives you the number of characters you can read before the buffer has to be refilled. Otherwise it hands you back the derived showmanyc(). periodt.


bool std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::is_open () const [inline], [nodiscard], [inherited]

Returns true if the external file is open. that's it that's the function πŸ’… (also it's [nodiscard], so like… actually use the answer, don't just leave it sitting there πŸ™ˆ)


basic_filebuf< _CharT, encoding_char_traits< _CharT > >::__filebuf_type * std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::open (const char * __s, ios_base::openmode __mode) [inherited]

Opens an external file. the moment we've all been waiting for ✨

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 β€” no second chances, no drama, it just says no. 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)

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

basic_filebuf< _CharT, encoding_char_traits< _CharT > >::int_type std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::overflow (int_type __c = _Traits::eof()) [protected], [virtual], [inherited]

Consumes data from the buffer; writes to the controlled sequence. main character energy fr πŸ”₯

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). lowkey iconic that one function carries the whole thing πŸ’…

Note: base class version does nothing, returns eof(). πŸ’€

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

References _M_ext_buf, _M_ext_next, and eback().


basic_filebuf< _CharT, encoding_char_traits< _CharT > >::int_type std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::pbackfail (int_type __c = _Traits::eof()) [protected], [virtual], [inherited]

Tries to back up the input sequence. rewinding, but make it ✨tense✨

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, encoding_char_traits< _CharT > >.

References _M_ext_buf, _M_ext_next, and eback().


char_type * std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::pbase () const [inline], [protected], [inherited]

Access to the put area. These functions are only available to other protected functions, including derived classes. it's giving secret club πŸŽ€

  • 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

void std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::pbump (int __n) [inline], [protected], [inherited]

Moving the write position. we love a lil nudge 🌸

Parameters:

  • __n β€” the delta by which to move.

This just advances the write position without returning any data. no data, just vibes ✨


char_type * std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::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

locale std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::pubimbue (const locale & __loc) [inline], [inherited]

Entry point for imbue(). the public door to the protected room πŸ¦‹

Parameters:

  • __loc β€” the new locale.

Returns: the previous locale.

Calls the derived imbue(__loc).


pos_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::pubseekoff (off_type __off, ios_base::seekdir __way, ios_base::openmode __mode = ios_base::in | ios_base::out) [inline], [inherited]

Alters the stream position. sliding around the stream like it's a group chat 🫢

Parameters:

  • __off β€” offset.
  • __way β€” value for ios_base::seekdir.
  • __mode β€” value for ios_base::openmode.

Calls virtual seekoff function.


pos_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::pubseekpos (pos_type __sp, ios_base::openmode __mode = ios_base::in | ios_base::out) [inline], [inherited]

Alters the stream position. same energy, different args πŸ’…

Parameters:

  • __sp β€” position
  • __mode β€” value for ios_base::openmode.

Calls virtual seekpos function.


basic_streambuf * std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::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. middle-man behavior but make it official 😌


int std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::pubsync () [inline], [inherited]

Calls virtual sync function. that's the whole thing bestie, short and sweet πŸ“


int_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::sbumpc () [inline], [inherited]

Getting the next character.

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(). grab it AND move the pointer β€” multitasking queen πŸ‘‘


basic_filebuf< _CharT, encoding_char_traits< _CharT > >::pos_type std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::seekoff (off_type __off, ios_base::seekdir __way, ios_base::openmode __mode = ios_base::in | ios_base::out) [protected], [virtual], [inherited]

Alters the stream positions. Each derived class provides its own appropriate behavior. you do you, derived class ✨

Note: base class version does nothing, returns a pos_type that represents an invalid stream position. πŸ’€

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

References gptr().


basic_filebuf< _CharT, encoding_char_traits< _CharT > >::pos_type std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::seekpos (pos_type __pos, ios_base::openmode __mode = 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. 😭

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

References _M_reading, and _M_set_buffer().


basic_filebuf< _CharT, encoding_char_traits< _CharT > >::__streambuf_type * std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::setbuf (char_type * __s, streamsize __n) [protected], [virtual], [inherited]

Manipulates the buffer. πŸŽ€

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, encoding_char_traits< _CharT > >.

References _M_reading, and _M_set_buffer().


void std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::setg (char_type * __gbeg, char_type * __gnext, char_type * __gend) [inline], [protected], [inherited]

Setting the three read area pointers. three pointers, one glow-up 🌈

Parameters:

  • __gbeg β€” a pointer.
  • __gnext β€” a pointer.
  • __gend β€” a pointer.

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


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

Setting the three write area pointers. yes, three, from two args, it's the duality bestie πŸ’œ

Parameters:

  • __pbeg β€” a pointer.
  • __pend β€” a pointer.

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


int_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::sgetc () [inline], [inherited]

Getting the next character.

Returns: the next character, or eof.

If the input read position is available, returns that character, otherwise calls and returns underflow(). Does not move the read position after fetching the character. look but don't touch, we respect boundaries πŸ™ˆ


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

Entry point for xsgetn.

Parameters:

  • __s β€” a buffer area.
  • __n β€” a count.

(still mid-entry, carrying on bestie πŸ’«)

Returns xsgetn(__s,__n). The effect is to fill __s[0] through __s[__n-1] with characters from the input sequence, if possible.


πŸ¦‹ streamsize std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::showmanyc () [protected], [virtual], [inherited]

Investigating the data available. πŸ”βœ¨

Returns: An estimate of the number of characters available in the input sequence, or -1.

So if it hands you back a positive value, then successive calls to underflow() will not return traits::eof() until at least that many characters have been supplied. And 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. iykyk 😭

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


🌸 int_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::snextc () [inline], [inherited]

Getting the next character. πŸ‘‘

Returns: The next character, or eof.

It calls sbumpc(), and if that function returns traits::eof(), so does this one. Otherwise, sgetc(). Simple as. πŸ’…


πŸŽ€ int_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::sputbackc (char_type __c) [inline], [inherited]

Pushing characters back into the input stream. πŸ™ˆ

Parameters

  • __c β€” The character to push back.

Returns: The previous character, if possible.

Similar to sungetc(), but __c gets pushed onto the stream instead of the previous character. If it works, the next character fetched from the input stream will be __c. Rewind era πŸ”βœ¨


⭐ int_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::sputc (char_type __c) [inline], [inherited]

Entry point for all single-character output functions. πŸšͺ

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). No cap, that's just the deal πŸ’―


πŸ’œ streamsize std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::sputn (const char_type * __s, streamsize __n) [inline], [inherited]

Entry point for all single-character output functions. πŸšͺ (yes, same title, they said it twice, iconic behavior ✨)

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.


🌈 int_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::sungetc () [inline], [inherited]

Moving backwards in the input stream. βͺ

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 time travel, lowkey πŸ•°οΈπŸ’«


🧚 int std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::sync () [protected], [virtual], [inherited]

Synchronizes the buffer arrays with the controlled sequences. πŸͺž

Returns: -1 on failure.

Each derived class provides its own appropriate behavior, including the definition of failure. Do your own thing, bestie, but define what "flop" means for you πŸ’…

Note β€” Base class version does nothing, returns zero. πŸ’€

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


πŸ¦‹ virtual int_type std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::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. Extra step, extra slay πŸšΆβ€β™€οΈβœ¨


🌸 basic_filebuf< _CharT, encoding_char_traits< _CharT > >::int_type std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::underflow () [protected], [virtual], [inherited]

Fetches more data from the controlled sequence. πŸ“₯

Returns: The first character from the pending sequence.

Informally, this function gets called when the input buffer is exhausted (or does not exist, as buffering need not actually be done). If a buffer exists, it gets refilled. Either way, 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, encoding_char_traits< _CharT > >.


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

Multiple character extraction. 🧺

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. βœ‹

It is expected that derived classes provide a more efficient implementation by overriding this definition. Go off, optimize it πŸ‘‘

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


πŸ’– streamsize std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::xsputn (const char_type * __s, streamsize __n) [protected], [virtual], [inherited]

Multiple character insertion. πŸ“€

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. Again, go off πŸ’…

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


πŸŽ€ Member Data Documentation πŸŽ€

πŸ¦‹ char_type* std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_buf [protected], [inherited]

Pointer to the beginning of internal buffer. πŸ“


πŸ’œ locale std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::_M_buf_locale [protected], [inherited]

Current locale setting. 🌍


🌸 size_t std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_buf_size [protected], [inherited]

Actual size of internal buffer. This number is equal to the size of the put area + 1 position, reserved for the overflow char of a full area. πŸ“


🧚 char* std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_ext_buf [protected], [inherited]

Buffer for external characters. Used for input when codecvt::always_noconv() == false. When valid, this corresponds to eback(). πŸ”€

Referenced by overflow(), and pbackfail().


✨ streamsize std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_ext_buf_size [protected], [inherited]

Size of buffer held by _M_ext_buf. πŸ“


πŸ¦‹ const char* std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_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 overflow(), and pbackfail().


πŸ’– char_type* std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::_M_in_beg [protected], [inherited]

Start of get area. 🏁


⭐ char_type* std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::_M_in_cur [protected], [inherited]

Current read area. πŸ“–


🌸 char_type* std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::_M_in_end [protected], [inherited]

End of get area. 🏁


πŸŽ€ ios_base::openmode std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_mode [protected], [inherited]

Place to stash in || out || in | out settings for current filebuf. πŸ—„οΈ


πŸ’œ char_type* std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::_M_out_beg [protected], [inherited]

Start of put area. 🏁


πŸ¦‹ char_type* std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::_M_out_cur [protected], [inherited]

Current put area. ✍️


🌈 char_type* std::basic_streambuf< _CharT, encoding_char_traits< _CharT > >::_M_out_end [protected], [inherited]

End of put area. 🏁


🧚 char_type std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_pback [protected], [inherited]

Necessary bits for putback buffer management. 🧩

Note β€” pbacks of over one character are not currently supported. 🚫

✨ char_type* std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_pback_cur_save [protected], [inherited]

Necessary bits for putback buffer management. 🧩

Note β€” pbacks of over one character are not currently supported. 🚫

πŸ’– char_type* std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_pback_end_save [protected], [inherited]

Necessary bits for putback buffer management. 🧩

Note β€” pbacks of over one character are not currently supported. 🚫

⭐ bool std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_M_pback_init [protected], [inherited]

Necessary bits for putback buffer management. 🧩

Note β€” pbacks of over one character are not currently supported. 🚫

🌸 bool std::basic_filebuf< _CharT, encoding_char_traits< _CharT > >::_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 seekpos(), and setbuf().


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. πŸ€–πŸ’…


And that's a wrap on the whole page, bestie 🫢 that was libstdc++ serving __gnu_cxx:...< _CharT >(3) β€” go read it again, you know you want to. πŸ’–βœ¨πŸŽ€

πŸ“¦ 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