aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.h
diff options
context:
space:
mode:
authorGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-15 17:39:20 +0800
committerGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-17 15:55:05 +0800
commit9808829ece19fce949a0accde6f2a0f4c4b2202b (patch)
tree0cf59022576983871b3f6f2db4d347bdaeb3373c /io.h
parent00b6431ad9ec17f551b5ea175a46e5d63c181fc7 (diff)
Make io_data_t pure virtual, its constructor protected
Diffstat (limited to 'io.h')
-rw-r--r--io.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/io.h b/io.h
index 5f3c1a67..a50c54e5 100644
--- a/io.h
+++ b/io.h
@@ -10,7 +10,7 @@ using std::tr1::shared_ptr;
*/
enum io_mode_t
{
- IO_INVALID, IO_FILE, IO_PIPE, IO_FD, IO_BUFFER, IO_CLOSE
+ IO_FILE, IO_PIPE, IO_FD, IO_BUFFER, IO_CLOSE
};
/** Represents an FD redirection */
@@ -21,27 +21,26 @@ private:
io_data_t(const io_data_t &rhs);
void operator=(const io_data_t &rhs);
+protected:
+ io_data_t(io_mode_t m, int f) :
+ io_mode(m),
+ fd(f),
+ is_input(0)
+ {
+ }
+
public:
/** Type of redirect */
io_mode_t io_mode;
/** FD to redirect */
int fd;
- virtual void print() const;
+ virtual void print() const = 0;
/** Set to true if this is an input io redirection */
bool is_input;
- io_data_t(io_mode_t m = IO_INVALID, int f=0) :
- io_mode(m),
- fd(f),
- is_input(0)
- {
- }
-
- virtual ~io_data_t()
- {
- }
+ virtual ~io_data_t() = 0;
};
class io_close_t : public io_data_t