1 #ifndef MSP_IO_SLICE_H_
2 #define MSP_IO_SLICE_H_
10 Presents a part of seekable I/O object as if it was a complete object. This
11 allows in-place access to embedded resources where the loader expects to
12 receive a complete file.
14 When a Slice is created, its read/write offset is placed at the beginning of
15 its range. If the offset of the underlying object is changed, the Slice will
16 restore it before the next access. This enables multiple Slices to be created
17 on top of the same object.
19 class Slice: public Seekable, public sigc::trackable
23 SeekOffset start_offset;
29 Slice(Seekable &, SeekOffset, SeekOffset);
31 virtual void set_block(bool);
32 virtual void set_inherit(bool);
37 unsigned prepare_op(unsigned, Mode);
39 virtual std::size_t do_write(const char *, std::size_t);
40 virtual std::size_t do_read(char *, std::size_t);
43 virtual std::size_t put(char);
46 virtual const Handle &get_handle(Mode);
48 virtual SeekOffset seek(SeekOffset, SeekType);
49 virtual SeekOffset tell() const { return position; }