Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IBRCOMMON_APPSTREAMBUF_H_
00009 #define IBRCOMMON_APPSTREAMBUF_H_
00010
00011 #include <streambuf>
00012 #include <vector>
00013 #include <string>
00014 #include <stdio.h>
00015
00016 namespace ibrcommon
00017 {
00029 class appstreambuf : public std::streambuf
00030 {
00031 public:
00032 enum { BUF_SIZE = 512 };
00033
00034 enum Mode
00035 {
00036 MODE_READ = 0,
00037 MODE_WRITE = 1
00038 };
00039
00045 appstreambuf(std::string command, appstreambuf::Mode mode);
00046 virtual ~appstreambuf();
00047
00048 protected:
00049 virtual int underflow();
00050 virtual int sync();
00051 virtual std::char_traits<char>::int_type overflow( std::char_traits<char>::int_type m = traits_type::eof() );
00052
00053 private:
00054 std::vector< char_type > m_buf;
00055 FILE *_handle;
00056 };
00057 }
00058
00059 #endif