]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/slice.h
Use default member initializers and constructor delegation
[libs/core.git] / source / io / slice.h
index f6115851c4c4c0637dcc262191c15e51cdcec81c..cec1fcf12b0dc0d822f8a837445a096f64236637 100644 (file)
@@ -16,30 +16,35 @@ its range.  If the offset of the underlying object is changed, the Slice will
 restore it before the next access.  This enables multiple Slices to be created
 on top of the same object.
 */
-class Slice: public Seekable
+class Slice: public Seekable, public sigc::trackable
 {
 private:
        Seekable &below;
-       SeekOffset start_offset;
-       SeekOffset length;
-       SeekOffset position;
-       bool sync_position;
+       SeekOffset start_offset = 0;
+       SeekOffset length = 0;
+       SeekOffset position = 0;
+       bool sync_position = true;
 
 public:
        Slice(Seekable &, SeekOffset, SeekOffset);
 
+       virtual void set_block(bool);
+       virtual void set_inherit(bool);
+
 private:
        void flush();
 
        unsigned prepare_op(unsigned, Mode);
 protected:
-       virtual unsigned do_write(const char *, unsigned);
-       virtual unsigned do_read(char *, unsigned);
+       virtual std::size_t do_write(const char *, std::size_t);
+       virtual std::size_t do_read(char *, std::size_t);
 
 public:
-       virtual unsigned put(char);
+       virtual std::size_t put(char);
        virtual int get();
 
+       virtual const Handle &get_handle(Mode);
+
        virtual SeekOffset seek(SeekOffset, SeekType);
        virtual SeekOffset tell() const { return position; }
 };