1 #ifndef MSP_IO_FILTERED_H_
2 #define MSP_IO_FILTERED_H_
7 // XXX This needs a redesign
8 template<typename B, typename F>
9 class Filtered: public B
16 Activator(Filtered &f_): f(f_) { f.active = true; }
17 ~Activator() { f.active = false; }
24 Filtered(): filter(*this), active(false) { }
25 ~Filtered() { active = true; }
28 Filtered(A0 a0): B(a0), filter(*this), active(false) { }
30 template<typename A0, typename A1>
31 Filtered(A0 a0, A1 a1): B(a0, a1), filter(*this), active(false) { }
34 virtual unsigned do_write(const char *b, unsigned s)
39 return filter.write(b, s);
42 return B::do_write(b, s);
45 virtual unsigned do_read(char *b, unsigned s)
50 return filter.read(b, s);
53 return B::do_read(b, s);
57 virtual unsigned put(char c)
66 virtual bool getline(std::string &l)
72 return filter.getline(l);
84 F &get_filter() { return filter; }