1 #ifndef MSP_IO_FILTERED_H_
2 #define MSP_IO_FILTERED_H_
8 This class is broken by design. Do not use. It exposes base class methods in
9 an unsafe and misleading way. In particular, a Filtered<File, Buffered> causes
10 seeks to behave incorrectly.
12 template<typename B, typename F>
13 class Filtered: public B
20 Activator(Filtered &f_): f(f_) { f.active = true; }
21 ~Activator() { f.active = false; }
28 Filtered(): filter(*this), active(false) { }
29 ~Filtered() { active = true; }
32 Filtered(A0 a0): B(a0), filter(*this), active(false) { }
34 template<typename A0, typename A1>
35 Filtered(A0 a0, A1 a1): B(a0, a1), filter(*this), active(false) { }
38 virtual unsigned do_write(const char *b, unsigned s)
43 return filter.write(b, s);
46 return B::do_write(b, s);
49 virtual unsigned do_read(char *b, unsigned s)
54 return filter.read(b, s);
57 return B::do_read(b, s);
61 virtual unsigned put(char c)
70 virtual bool getline(std::string &l)
76 return filter.getline(l);
88 F &get_filter() { return filter; }