__gnu_cxx::stdio_sync_filebuf< _CharT, _Traits > Class Template Reference

#include <stdio_sync_filebuf.h>

Inheritance diagram for __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >:

std::basic_streambuf< _CharT, _Traits > List of all members.

Public Types

typedef _CharT char_type
typedef _Traits traits_type
typedef traits_type::int_type int_type
typedef traits_type::pos_type pos_type
typedef traits_type::off_type off_type

Public Member Functions

 stdio_sync_filebuf (std::__c_file *__f)
std::__c_file *const  file ()

Protected Member Functions

int_type syncgetc ()
int_type syncungetc (int_type __c)
int_type syncputc (int_type __c)
virtual int_type underflow ()
 Fetches more data from the controlled sequence.

virtual int_type uflow ()
 Fetches more data from the controlled sequence.

virtual int_type pbackfail (int_type __c=traits_type::eof())
 Tries to back up the input sequence.

virtual std::streamsize xsgetn (char_type *__s, std::streamsize __n)
 Multiple character extraction.

virtual int_type overflow (int_type __c=traits_type::eof())
 Consumes data from the buffer; writes to the controlled sequence.

virtual std::streamsize xsputn (const char_type *__s, std::streamsize __n)
 Multiple character insertion.

virtual int sync ()
 Synchronizes the buffer arrays with the controlled sequences.

virtual std::streampos seekoff (std::streamoff __off, std::ios_base::seekdir __dir, std::ios_base::openmode=std::ios_base::in|std::ios_base::out)
virtual std::streampos seekpos (std::streampos __pos, std::ios_base::openmode __mode=std::ios_base::in|std::ios_base::out)

Private Attributes

std::__c_file *const  _M_file
int_type _M_unget_buf

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


Member Typedef Documentation

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
typedef _CharT __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::char_type
 

These are standard types. They permit a standardized way of referring to names of (or names dependant on) the template parameters, which are specific to the implementation.

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

Definition at line 54 of file stdio_sync_filebuf.h.

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
typedef traits_type::int_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::int_type
 

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

Definition at line 56 of file stdio_sync_filebuf.h.

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
typedef traits_type::off_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::off_type
 

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

Definition at line 58 of file stdio_sync_filebuf.h.

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
typedef traits_type::pos_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::pos_type
 

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

Definition at line 57 of file stdio_sync_filebuf.h.

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
typedef _Traits __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::traits_type
 

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

Definition at line 55 of file stdio_sync_filebuf.h.


Constructor & Destructor Documentation

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
__gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::stdio_sync_filebuf std::__c_file __f  )  [inline, explicit]
 

Definition at line 70 of file stdio_sync_filebuf.h.

References std::__c_file, and __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::_M_unget_buf.


Member Function Documentation

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
std::__c_file* const __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.

Definition at line 82 of file stdio_sync_filebuf.h.

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.

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

Definition at line 135 of file stdio_sync_filebuf.h.

References __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::syncputc().

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.

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

Definition at line 110 of file stdio_sync_filebuf.h.

References __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::_M_unget_buf, and __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::syncungetc().

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
virtual std::streampos __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::seekoff std::streamoff  __off,
std::ios_base::seekdir  __dir,
std::ios_base::openmode  = std::ios_base::in | std::ios_base::out
[inline, protected, virtual]
 

Definition at line 158 of file stdio_sync_filebuf.h.

References std::ios_base::openmode, std::ios_base::seekdir, std::streamoff, and std::streampos.

Referenced by __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::seekpos().

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
virtual std::streampos __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::seekpos std::streampos  __pos,
std::ios_base::openmode  __mode = std::ios_base::in | std::ios_base::out
[inline, protected, virtual]
 

Definition at line 180 of file stdio_sync_filebuf.h.

References std::ios_base::openmode, __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::seekoff(), std::streamoff, and std::streampos.

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
virtual int __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::sync  )  [inline, protected, virtual]
 

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".
Note:
Base class version does nothing, returns zero.

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

Definition at line 154 of file stdio_sync_filebuf.h.

stdio_sync_filebuf< char >::int_type __gnu_cxx::stdio_sync_filebuf<>::syncgetc  )  [inline, protected]
 

Definition at line 188 of file stdio_sync_filebuf.h.

Referenced by __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::uflow(), and __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::underflow().

stdio_sync_filebuf< char >::int_type __gnu_cxx::stdio_sync_filebuf<>::syncputc int_type  __c  )  [inline, protected]
 

Definition at line 198 of file stdio_sync_filebuf.h.

Referenced by __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::overflow().

stdio_sync_filebuf< char >::int_type __gnu_cxx::stdio_sync_filebuf<>::syncungetc int_type  __c  )  [inline, protected]
 

Definition at line 193 of file stdio_sync_filebuf.h.

Referenced by __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::pbackfail(), and __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::underflow().

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
virtual int_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::uflow  )  [inline, protected, virtual]
 

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.

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

Definition at line 102 of file stdio_sync_filebuf.h.

References __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::_M_unget_buf, and __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::syncgetc().

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
virtual int_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::underflow  )  [inline, protected, virtual]
 

Fetches more data from the controlled sequence.

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 definiton 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 http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#6

Note:
Base class version does nothing, returns eof().

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

Definition at line 95 of file stdio_sync_filebuf.h.

References __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::syncgetc(), and __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::syncungetc().

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
virtual std::streamsize __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::xsgetn char_type __s,
std::streamsize  __n
[protected, virtual]
 

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.

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

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
virtual std::streamsize __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::xsputn const char_type __s,
std::streamsize  __n
[protected, virtual]
 

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.

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


Member Data Documentation

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
std::__c_file* const __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::_M_file [private]
 

Definition at line 62 of file stdio_sync_filebuf.h.

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
int_type __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::_M_unget_buf [private]
 

Definition at line 66 of file stdio_sync_filebuf.h.

Referenced by __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::pbackfail(), __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::stdio_sync_filebuf(), and __gnu_cxx::stdio_sync_filebuf< _CharT, _Traits >::uflow().


The documentation for this class was generated from the following file:
Generated on Tue Jan 30 17:32:03 2007 for GNU C++ STL by doxygen 1.3.6