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
23 SeekOffset start_offset;
29 Slice(Seekable &, SeekOffset, SeekOffset);
34 unsigned prepare_op(unsigned, Mode);
36 virtual unsigned do_write(const char *, unsigned);
37 virtual unsigned do_read(char *, unsigned);
40 virtual unsigned put(char);
43 virtual SeekOffset seek(SeekOffset, SeekType);
44 virtual SeekOffset tell() const { return position; }