| 1 |
#ifndef INCLUDED_OFDNSTREAMBUF_H_ |
| 2 |
#define INCLUDED_OFDNSTREAMBUF_H_ |
| 3 |
|
| 4 |
#ifndef INCLUDED_STREAMBUF_ |
| 5 |
#include <streambuf> |
| 6 |
#define INCLUDED_STREAMBUF_ |
| 7 |
#endif |
| 8 |
|
| 9 |
namespace FBB |
| 10 |
{ |
| 11 |
class OFdNStreambuf: public std::streambuf |
| 12 |
{ |
| 13 |
private: |
| 14 |
size_t d_n; |
| 15 |
int d_fd; |
| 16 |
char *d_buffer; |
| 17 |
|
| 18 |
public: |
| 19 |
OFdNStreambuf() |
| 20 |
: |
| 21 |
d_n(0), |
| 22 |
d_buffer(0) |
| 23 |
{} |
| 24 |
|
| 25 |
OFdNStreambuf(int fd, size_t n = 1) |
| 26 |
{ |
| 27 |
open(fd, n); |
| 28 |
} |
| 29 |
|
| 30 |
~OFdNStreambuf(); |
| 31 |
|
| 32 |
void open(int fd, size_t n = 1); |
| 33 |
int sync(); |
| 34 |
int overflow(int c); |
| 35 |
|
| 36 |
private: |
| 37 |
OFdNStreambuf(OFdNStreambuf const &other); // NI |
| 38 |
OFdNStreambuf &operator=(OFdNStreambuf const &other); // NI |
| 39 |
}; |
| 40 |
} |
| 41 |
|
| 42 |
#endif |