rvm 1.08

fdstream.h

Go to the documentation of this file.
00001 #ifndef __fdstream_h__
00002 #define __fdstream_h__
00003 
00004 #include <iostream>
00005 #ifdef HAVE_STREAMBUF
00006 #include <streambuf>
00007 #endif
00008 #include <cstdio>
00009 
00010 #include <string.h>
00011 
00012 class fdoutbuf : public std::streambuf
00013 {
00014 public:
00015         fdoutbuf();
00016         fdoutbuf(int a_fd);
00017         void attach(int a_fd);
00018         virtual int overflow(int a_c);
00019         virtual std::streamsize xsputn(const char* a_s, std::streamsize a_num);
00020 
00021 protected:
00022         int m_fd;
00023 };
00024 
00025 class ofdstream : public std::ostream
00026 {
00027 public:
00028         ofdstream();
00029         ofdstream(int a_fd);
00030         void attach(int a_fd);
00031         int fd(void);
00032 
00033 protected:
00034         fdoutbuf m_buf;
00035         int m_fd;
00036 };
00037 
00038 class fdinbuf : public std::streambuf
00039 {
00040 public:
00041         fdinbuf();
00042         fdinbuf(int a_fd);
00043         void attach(int a_fd);
00044         virtual int underflow(void);
00045 
00046 protected:
00047         int m_fd;
00048         static const int m_buffer_size = 10;
00049         char m_buffer[m_buffer_size];
00050 };
00051 
00052 class ifdstream : public std::istream
00053 {
00054 public:
00055         ifdstream();
00056         ifdstream(int a_fd);
00057         void attach(int a_fd);
00058         int fd(void);
00059 
00060 protected:
00061         fdinbuf m_buf;
00062         int m_fd;
00063 };
00064 
00065 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines