]> git.tdb.fi Git - libs/core.git/blob - source/io/buffered.h
Use native CreateDirectory/RemoveDirectory calls on Windows
[libs/core.git] / source / io / 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         void flush();
24
25 protected:
26         unsigned do_write(const char *, unsigned);
27         unsigned do_read(char *, unsigned);
28 public:
29         unsigned put(char);
30
31         bool getline(std::string &);
32         int get();
33
34 private:
35         void set_op(Mode);
36 public:
37         Mode get_current_op() const { return cur_op; }
38         unsigned get_current_size() const;
39 };
40
41 } // namespace IO
42 } // namespace Msp
43
44 #endif