1 #ifndef MSP_IO_MEMORY_H_
2 #define MSP_IO_MEMORY_H_
9 class Memory: public Seekable
12 char *begin = nullptr;
17 Memory(char *d, std::size_t s, Mode m = M_RDWR): Memory(d, d+s, m) { }
18 Memory(char *, char *, Mode = M_RDWR);
19 Memory(const char *d, std::size_t s): Memory(const_cast<char *>(d), const_cast<char *>(d+s), M_READ) { }
20 Memory(const char *b, const char *e): Memory(const_cast<char *>(b), const_cast<char *>(e), M_READ) { }
22 void set_block(bool) override;
23 void set_inherit(bool) override;
26 std::size_t do_write(const char *, std::size_t) override;
27 std::size_t do_read(char *, std::size_t) override;
29 std::size_t put(char) override;
30 bool getline(std::string &) override;
33 const Handle &get_handle(Mode) override;
35 SeekOffset seek(SeekOffset, SeekType) override;
36 SeekOffset tell() const override { return pos-begin; }