diff options
author | Cheer Xiao <xiaqqaix@gmail.com> | 2013-01-15 17:31:36 +0800 |
---|---|---|
committer | Cheer Xiao <xiaqqaix@gmail.com> | 2013-01-17 15:55:05 +0800 |
commit | 00b6431ad9ec17f551b5ea175a46e5d63c181fc7 (patch) | |
tree | 831fd83134ba4dc366489e343bc8d50f4d33be4e /io.h | |
parent | e020ad0c068861325dca1655cb0ed487a22b67c5 (diff) |
Split out io_pipe_t, let io_buffer_t inherit it
Diffstat (limited to 'io.h')
-rw-r--r-- | io.h | 29 |
1 files changed, 17 insertions, 12 deletions
@@ -27,15 +27,6 @@ public: /** FD to redirect */ int fd; - /** - Type-specific parameter for redirection - */ - union - { - /** Fds for IO_PIPE and for IO_BUFFER */ - int pipe_fd[2]; - } param1; - virtual void print() const; /** Set to true if this is an input io redirection */ @@ -44,7 +35,6 @@ public: io_data_t(io_mode_t m = IO_INVALID, int f=0) : io_mode(m), fd(f), - param1(), is_input(0) { } @@ -113,16 +103,31 @@ public: } }; -class io_buffer_t : public io_data_t +class io_pipe_t : public io_data_t +{ +public: + int pipe_fd[2]; + + virtual void print() const; + + io_pipe_t(int f): + io_data_t(IO_PIPE, f), + pipe_fd() + { + } +}; + +class io_buffer_t : public io_pipe_t { private: /** buffer to save output in */ shared_ptr<std::vector<char> > out_buffer; io_buffer_t(int f): - io_data_t(IO_BUFFER, f), + io_pipe_t(f), out_buffer() { + io_mode = IO_BUFFER; } public: |