1 #ifndef MSP_IO_FILTERED_H_
2 #define MSP_IO_FILTERED_H_
7 template<typename B, typename F>
8 class Filtered: public B
15 Activator(Filtered &f_): f(f_) { f.active = true; }
16 ~Activator() { f.active = false; }
23 Filtered(): filter(*this), active(false) { }
24 ~Filtered() { active = true; }
27 Filtered(A0 a0): B(a0), filter(*this), active(false) { }
29 template<typename A0, typename A1>
30 Filtered(A0 a0, A1 a1): B(a0, a1), filter(*this), active(false) { }
33 virtual unsigned do_write(const char *b, unsigned s)
38 return filter.write(b, s);
41 return B::do_write(b, s);
44 virtual unsigned do_read(char *b, unsigned s)
49 return filter.read(b, s);
52 return B::do_read(b, s);
56 virtual unsigned put(char c) { return filter.put(c); }
57 virtual bool getline(std::string &l) { return filter.getline(l); }
58 virtual int get() { return filter.get(); }
60 F &get_filter() { return filter; }