]> git.tdb.fi Git - libs/core.git/blob - source/buffered.h
Drop copyright and license notices from files
[libs/core.git] / source / buffered.h
1 #ifndef MSP_IO_BUFFERED_H_
2 #define MSP_IO_BUFFERED_H_
3
4 #include "base.h"
5
6 namespace Msp {
7 namespace IO {
8
9 class Buffered: public Base
10 {
11 private:
12         Base     &below;
13         unsigned buf_size;
14         char     *buf;
15         char     *begin;
16         char     *end;
17         Mode     cur_op;
18
19 public:
20         Buffered(Base &, unsigned =8192);
21         ~Buffered();
22
23         unsigned put(char);
24         void flush();
25         bool getline(std::string &);
26         int  get();
27         Handle get_event_handle();
28         Mode get_current_op() const { return cur_op; }
29         unsigned get_current_size() const;
30 private:
31         void set_op(Mode);
32 protected:
33         unsigned do_write(const char *, unsigned);
34         unsigned do_read(char *, unsigned);
35 };
36
37 } // namespace IO
38 } // namespace Msp
39
40 #endif