rvm  1.11
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fdstream.h
Go to the documentation of this file.
1 #ifndef __fdstream_h__
2 #define __fdstream_h__
3 
4 #include <iostream>
5 #ifdef HAVE_STREAMBUF
6 #include <streambuf>
7 #endif
8 #include <cstdio>
9 
10 #include <string.h>
11 
12 class fdoutbuf : public std::streambuf
13 {
14 public:
15  fdoutbuf();
16  fdoutbuf(int a_fd);
17  void attach(int a_fd);
18  virtual int overflow(int a_c);
19  virtual std::streamsize xsputn(const char* a_s, std::streamsize a_num);
20 
21 protected:
22  int m_fd;
23 };
24 
25 class ofdstream : public std::ostream
26 {
27 public:
28  ofdstream();
29  ofdstream(int a_fd);
30  void attach(int a_fd);
31  int fd(void);
32 
33 protected:
35  int m_fd;
36 };
37 
38 class fdinbuf : public std::streambuf
39 {
40 public:
41  fdinbuf();
42  fdinbuf(int a_fd);
43  void attach(int a_fd);
44  virtual int underflow(void);
45 
46 protected:
47  int m_fd;
48  static const int m_buffer_size = 10;
50 };
51 
52 class ifdstream : public std::istream
53 {
54 public:
55  ifdstream();
56  ifdstream(int a_fd);
57  void attach(int a_fd);
58  int fd(void);
59 
60 protected:
62  int m_fd;
63 };
64 
65 #endif
int m_fd
Definition: fdstream.h:47
fdoutbuf m_buf
Definition: fdstream.h:34
int m_fd
Definition: fdstream.h:62
static const int m_buffer_size
Definition: fdstream.h:48
int fd(void)
Definition: fdstream.cc:57
void attach(int a_fd)
Definition: fdstream.cc:19
fdinbuf m_buf
Definition: fdstream.h:61
void attach(int a_fd)
Definition: fdstream.cc:116
int m_fd
Definition: fdstream.h:22
fdoutbuf()
Definition: fdstream.cc:10
char m_buffer[m_buffer_size]
Definition: fdstream.h:49
virtual int overflow(int a_c)
Definition: fdstream.cc:24
virtual int underflow(void)
Definition: fdstream.cc:80
void attach(int a_fd)
Definition: fdstream.cc:75
ofdstream()
Definition: fdstream.cc:41
fdinbuf()
Definition: fdstream.cc:64
void attach(int a_fd)
Definition: fdstream.cc:51
int m_fd
Definition: fdstream.h:35
int fd(void)
Definition: fdstream.cc:122
virtual std::streamsize xsputn(const char *a_s, std::streamsize a_num)
Definition: fdstream.cc:34