X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fseekable.h;h=99915d850efc3a8879d88a7e9e3e9de7e11eb531;hp=cabb9dcdfc7ffc50b979163e447443fdd100e3e2;hb=b116e161e377da0e4e52f07745ecb2d22f962ae9;hpb=86e0004bd195bc7f7478cf736871339bddf38127 diff --git a/source/io/seekable.h b/source/io/seekable.h index cabb9dc..99915d8 100644 --- a/source/io/seekable.h +++ b/source/io/seekable.h @@ -1,11 +1,17 @@ #ifndef MSP_IO_SEEKABLE_H_ #define MSP_IO_SEEKABLE_H_ +#include +#include #include "base.h" namespace Msp { namespace IO { +class Handle; + +typedef std::int64_t SeekOffset; + enum SeekType { S_BEG, @@ -13,7 +19,13 @@ enum SeekType S_END }; -int sys_seek_type(SeekType); + +class bad_seek: public std::runtime_error +{ +public: + bad_seek(SeekOffset, SeekType); + virtual ~bad_seek() throw() { } +}; class Seekable: public Base @@ -23,12 +35,15 @@ protected: 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