aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.h
diff options
context:
space:
mode:
authorGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-17 14:46:02 +0800
committerGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-17 15:55:06 +0800
commita3b15b995e9448e1ed34b1a9d4d168abdf161b6e (patch)
tree5ccaffacd5d8c22edb33b52313d250e77dc70de8 /io.h
parent57ef5289feb4f8551031cc1077df7c33be2180bb (diff)
Make io_data_t::io_mode const
A protected constructor is needed in io_pipe_t to let io_buffer_t override its io_mode.
Diffstat (limited to 'io.h')
-rw-r--r--io.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/io.h b/io.h
index c9bcd36a..c463836b 100644
--- a/io.h
+++ b/io.h
@@ -30,7 +30,7 @@ protected:
public:
/** Type of redirect */
- io_mode_t io_mode;
+ const io_mode_t io_mode;
/** FD to redirect */
int fd;
@@ -99,6 +99,14 @@ public:
class io_pipe_t : public io_data_t
{
+protected:
+ io_pipe_t(io_mode_t m, int f, bool i):
+ io_data_t(m, f),
+ pipe_fd(),
+ is_input(i)
+ {
+ }
+
public:
int pipe_fd[2];
bool is_input;
@@ -120,10 +128,9 @@ private:
std::vector<char> *out_buffer;
io_buffer_t(int f, bool i):
- io_pipe_t(f, i),
+ io_pipe_t(IO_BUFFER, f, i),
out_buffer(new std::vector<char>)
{
- io_mode = IO_BUFFER;
}
public: