]> git.tdb.fi Git - libs/core.git/blob - source/io/memory.h
Make certain functions pure virtual so I won't forget to implement them
[libs/core.git] / source / io / memory.h
1 #ifndef MSP_IO_MEMORY_H_
2 #define MSP_IO_MEMORY_H_
3
4 #include "seekable.h"
5
6 namespace Msp {
7 namespace IO {
8
9 class Memory: public Seekable
10 {
11 private:
12         char *begin;
13         char *end;
14         char *pos;
15
16 public:
17         Memory(char *, unsigned, Mode = M_RDWR);
18         Memory(char *, char *, Mode = M_RDWR);
19         Memory(const char *, unsigned);
20         Memory(const char *, const char *);
21 private:
22         void init(char *, char *, Mode);
23
24 public:
25         virtual void set_block(bool);
26
27 private:
28         virtual unsigned do_write(const char *, unsigned);
29         virtual unsigned do_read(char *, unsigned);
30 public:
31         virtual unsigned put(char);
32         virtual bool getline(std::string &);
33         virtual int get();
34
35         virtual const Handle &get_handle(Mode);
36
37         virtual SeekOffset seek(SeekOffset, SeekType);
38         virtual SeekOffset tell() const { return pos-begin; }
39 };
40
41 } // namespace IO
42 } // namespace Msp
43
44 #endif