]> git.tdb.fi Git - libs/core.git/blob - source/seek.cpp
88ba0337e578b437242edcfde38b28307f031e21
[libs/core.git] / source / seek.cpp
1 /* $Id$
2
3 This file is part of libmspio
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7 #ifdef WIN32
8 #include <windows.h>
9 #endif
10 #include "except.h"
11 #include "seek.h"
12
13 namespace Msp {
14 namespace IO {
15
16 int sys_seek_type(SeekType st)
17 {
18 #ifdef WIN32
19         if(st==S_BEG)
20                 return FILE_BEGIN;
21         else if(st==S_CUR)
22                 return FILE_CURRENT;
23         else if(st==S_END)
24                 return FILE_END;
25 #else
26         if(st==S_BEG)
27                 return SEEK_SET;
28         else if(st==S_CUR)
29                 return SEEK_CUR;
30         else if(st==S_END)
31                 return SEEK_END;
32 #endif
33
34         throw InvalidParameterValue("Invalid seek type");
35 }
36
37 } // namespace IO
38 } // namespace Msp