]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/seekable.h
Add move semantics to Variant
[libs/core.git] / source / io / seekable.h
index cabb9dcdfc7ffc50b979163e447443fdd100e3e2..e549d24c5dd7b8a0527b4cb9fc4e039ce887ad91 100644 (file)
@@ -1,11 +1,18 @@
 #ifndef MSP_IO_SEEKABLE_H_
 #define MSP_IO_SEEKABLE_H_
 
+#include <cstdint>
+#include <stdexcept>
+#include <msp/core/mspcore_api.h>
 #include "base.h"
 
 namespace Msp {
 namespace IO {
 
+class Handle;
+
+typedef std::int64_t SeekOffset;
+
 enum SeekType
 {
        S_BEG,
@@ -13,22 +20,31 @@ enum SeekType
        S_END
 };
 
-int sys_seek_type(SeekType);
+
+class MSPCORE_API bad_seek: public std::runtime_error
+{
+public:
+       bad_seek(SeekOffset, SeekType);
+       ~bad_seek() throw() override = default;
+};
 
 
-class Seekable: public Base
+class MSPCORE_API Seekable: public Base
 {
 protected:
-       Seekable() { }
+       Seekable() = default;
 
 public:
        /** Changes the read/write offset.  Returns the new offset. */
-       virtual unsigned seek(int, SeekType) = 0;
+       virtual SeekOffset seek(SeekOffset, SeekType) = 0;
        
        /** Returns the current read/write offset. */
-       virtual unsigned tell() const = 0;
+       virtual SeekOffset tell() const = 0;
 };
 
+
+SeekOffset sys_seek(Handle &, SeekOffset, SeekType);
+
 } // namespace IO
 } // namespace Msp