#include <stdiobuf.defs.hh>
Public Member Functions | |
| stdiobuf (FILE *file) | |
| Constructor. | |
Protected Member Functions | |
| virtual int_type | underflow () |
| Gets a character in case of underflow. | |
| virtual int_type | uflow () |
| In case of underflow, gets a character and advances the next pointer. | |
| virtual std::streamsize | xsgetn (char_type *s, std::streamsize n) |
| Gets a sequence of characters. | |
| virtual int_type | pbackfail (int_type c=traits_type::eof()) |
| Puts character back in case of backup underflow. | |
| virtual std::streamsize | xsputn (const char_type *s, std::streamsize n) |
| Writes a sequence of characters. | |
| virtual int_type | overflow (int_type c) |
| Writes a character in case of overflow. | |
| virtual int | sync () |
| Synchronizes the stream buffer. | |
Private Types | |
| typedef char | char_type |
| Character type of the streambuf. | |
| typedef std::char_traits < char_type > | traits_type |
| Traits type of the streambuf. | |
| typedef traits_type::int_type | int_type |
| Integer type of the streambuf. | |
Private Attributes | |
| FILE * | fp |
| The encapsulated stdio file. | |
| int_type | ungetc_buf |
| Buffer for the last character read. | |
Definition at line 31 of file stdiobuf.defs.hh.
typedef char Parma_Polyhedra_Library::stdiobuf::char_type [private] |
Character type of the streambuf.
Definition at line 90 of file stdiobuf.defs.hh.
typedef traits_type::int_type Parma_Polyhedra_Library::stdiobuf::int_type [private] |
Integer type of the streambuf.
Definition at line 96 of file stdiobuf.defs.hh.
typedef std::char_traits<char_type> Parma_Polyhedra_Library::stdiobuf::traits_type [private] |
Traits type of the streambuf.
Definition at line 93 of file stdiobuf.defs.hh.
| Parma_Polyhedra_Library::stdiobuf::stdiobuf | ( | FILE * | file | ) | [inline] |
Constructor.
Definition at line 30 of file stdiobuf.inlines.hh.
00031 : fp(file), ungetc_buf(traits_type::eof()) { 00032 }
| stdiobuf::int_type Parma_Polyhedra_Library::stdiobuf::overflow | ( | int_type | c | ) | [protected, virtual] |
Writes a character in case of overflow.
Specified by ISO/IEC 14882:1998: 27.5.2.4.5.
Definition at line 65 of file stdiobuf.cc.
References fp.
| stdiobuf::int_type Parma_Polyhedra_Library::stdiobuf::pbackfail | ( | int_type | c = traits_type::eof() |
) | [protected, virtual] |
Puts character back in case of backup underflow.
Definition at line 52 of file stdiobuf.cc.
References fp, and ungetc_buf.
00053 { 00054 const int_type eof = traits_type::eof(); 00055 int_type u = traits_type::eq_int_type(c, eof) ? ungetc_buf : c; 00056 ungetc_buf = eof; 00057 return traits_type::eq_int_type(u, eof) ? eof : ungetc(u, fp);
| int Parma_Polyhedra_Library::stdiobuf::sync | ( | ) | [protected, virtual] |
Synchronizes the stream buffer.
Specified by ISO/IEC 14882:1998: 27.5.2.4.2.
Definition at line 74 of file stdiobuf.cc.
References fp.
00075 { 00076 return fflush(fp);
| stdiobuf::int_type Parma_Polyhedra_Library::stdiobuf::uflow | ( | ) | [protected, virtual] |
In case of underflow, gets a character and advances the next pointer.
Definition at line 30 of file stdiobuf.cc.
References fp, and ungetc_buf.
00031 { 00032 ungetc_buf = getc(fp); 00033 return ungetc_buf;
| stdiobuf::int_type Parma_Polyhedra_Library::stdiobuf::underflow | ( | ) | [protected, virtual] |
| std::streamsize Parma_Polyhedra_Library::stdiobuf::xsgetn | ( | char_type * | s, | |
| std::streamsize | n | |||
| ) | [protected, virtual] |
Gets a sequence of characters.
Definition at line 42 of file stdiobuf.cc.
References fp, and ungetc_buf.
00043 { 00044 std::streamsize r = fread(s, 1, n, fp); 00045 if (r > 0) 00046 ungetc_buf = traits_type::to_int_type(s[r - 1]); 00047 else 00048 ungetc_buf = traits_type::eof(); 00049 return r;
| std::streamsize Parma_Polyhedra_Library::stdiobuf::xsputn | ( | const char_type * | s, | |
| std::streamsize | n | |||
| ) | [protected, virtual] |
Writes a sequence of characters.
Definition at line 60 of file stdiobuf.cc.
References fp.
00061 { 00062 return fwrite(s, 1, n, fp);
FILE* Parma_Polyhedra_Library::stdiobuf::fp [private] |
The encapsulated stdio file.
Definition at line 99 of file stdiobuf.defs.hh.
Referenced by overflow(), pbackfail(), sync(), uflow(), underflow(), xsgetn(), and xsputn().
Buffer for the last character read.
Definition at line 102 of file stdiobuf.defs.hh.
Referenced by pbackfail(), uflow(), and xsgetn().
1.6.3