]> git.tdb.fi Git - libs/core.git/blob - source/io/seekable.h
9522311f55b32ae2f75bd2f62f9e233a3f28a6fd
[libs/core.git] / source / io / seekable.h
1 #ifndef MSP_IO_SEEKABLE_H_
2 #define MSP_IO_SEEKABLE_H_
3
4 #include "base.h"
5
6 namespace Msp {
7 namespace IO {
8
9 class Handle;
10
11 #ifdef MSVC
12 typedef __int64 SeekOffset;
13 #else
14 typedef long long SeekOffset;
15 #endif
16
17 enum SeekType
18 {
19         S_BEG,
20         S_CUR,
21         S_END
22 };
23
24
25 class Seekable: public Base
26 {
27 protected:
28         Seekable() { }
29
30 public:
31         /** Changes the read/write offset.  Returns the new offset. */
32         virtual SeekOffset seek(SeekOffset, SeekType) = 0;
33         
34         /** Returns the current read/write offset. */
35         virtual SeekOffset tell() const = 0;
36 };
37
38
39 SeekOffset sys_seek(Handle &, SeekOffset, SeekType);
40
41 } // namespace IO
42 } // namespace Msp
43
44 #endif