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