Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef IBRCOMMON_APPSTREAMBUF_H_
00018 #define IBRCOMMON_APPSTREAMBUF_H_
00019
00020 #include <streambuf>
00021 #include <vector>
00022 #include <string>
00023 #include <stdio.h>
00024
00025 namespace ibrcommon
00026 {
00038 class appstreambuf : public std::basic_streambuf<char, std::char_traits<char> >
00039 {
00040 public:
00041 enum { BUF_SIZE = 512 };
00042
00043 enum Mode
00044 {
00045 MODE_READ = 0,
00046 MODE_WRITE = 1
00047 };
00048
00054 appstreambuf(std::string command, appstreambuf::Mode mode);
00055 virtual ~appstreambuf();
00056
00057 protected:
00058 virtual std::char_traits<char>::int_type underflow();
00059 virtual int sync();
00060 virtual std::char_traits<char>::int_type overflow( std::char_traits<char>::int_type m = traits_type::eof() );
00061
00062 private:
00063 std::vector< char_type > m_buf;
00064 FILE *_handle;
00065 };
00066 }
00067
00068 #endif