#include <rutz/stdiobuf.h>
Public Member Functions | |
stdiobuf (FILE *f, int om, bool throw_exception=false) | |
Create with a reference to a FILE object. | |
stdiobuf (int fd, int om, bool throw_exception=false) | |
Create with a reference to a file descriptor. | |
~stdiobuf () | |
Destructor flushes buffer, but DOES NOT CLOSE the file descriptor. | |
bool | is_open () const |
Check whether we have an open file descriptor. | |
void | close () |
Flushes the buffer and forgets the file descriptor, but DOESN'T CLOSE IT. | |
virtual int | underflow () |
Get more data from the underlying file descriptor. | |
virtual int | overflow (int c) |
Send more data to the underlying file descriptor. | |
virtual int | sync () |
Flush the current buffer contents to the underlying file. |
Definition at line 48 of file stdiobuf.h.
rutz::stdiobuf::stdiobuf | ( | FILE * | f, | |
int | om, | |||
bool | throw_exception = false | |||
) |
Create with a reference to a FILE object.
The stdiobuf will NOT close the FILE on destruction, that is left up to the caller (since the caller must also have been the one to open the FILE object).
Definition at line 71 of file stdiobuf.cc.
rutz::stdiobuf::stdiobuf | ( | int | fd, | |
int | om, | |||
bool | throw_exception = false | |||
) |
Create with a reference to a file descriptor.
The stdiobuf will NOT close the descriptor on destruction, that is left up to the caller (since the caller must also have been the one to open the file descriptor).
Definition at line 78 of file stdiobuf.cc.
void rutz::stdiobuf::close | ( | ) |
Flushes the buffer and forgets the file descriptor, but DOESN'T CLOSE IT.
It is assumed that the same caller who passed the open file descriptor to our constructor will also eventually close that file descriptor.
Definition at line 86 of file stdiobuf.cc.
References is_open(), and sync().
Referenced by ~stdiobuf().
int rutz::stdiobuf::underflow | ( | ) | [virtual] |
Get more data from the underlying file descriptor.
Called when the streambuf's buffer has run out of data.
Definition at line 99 of file stdiobuf.cc.
int rutz::stdiobuf::overflow | ( | int | c | ) | [virtual] |
Send more data to the underlying file descriptor.
Called when the streambuf's buffer has become full.
Definition at line 143 of file stdiobuf.cc.
References is_open().