]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/seekable.cpp
Remove deprecated things
[libs/core.git] / source / io / seekable.cpp
index 101676e0ef304a5d56efada803808d3e990b5065..6bc84855541c6f0974eb3c8ba29405fb67d8febd 100644 (file)
@@ -1,7 +1,4 @@
-#ifdef WIN32
-#include <windows.h>
-#endif
-#include <stdexcept>
+#include <msp/strings/format.h>
 #include "seekable.h"
 
 using namespace std;
@@ -9,26 +6,12 @@ using namespace std;
 namespace Msp {
 namespace IO {
 
-int sys_seek_type(SeekType st)
-{
-#ifdef WIN32
-       if(st==S_BEG)
-               return FILE_BEGIN;
-       else if(st==S_CUR)
-               return FILE_CURRENT;
-       else if(st==S_END)
-               return FILE_END;
-#else
-       if(st==S_BEG)
-               return SEEK_SET;
-       else if(st==S_CUR)
-               return SEEK_CUR;
-       else if(st==S_END)
-               return SEEK_END;
-#endif
-
-       throw invalid_argument("sys_seek_type");
-}
+bad_seek::bad_seek(SeekOffset offset, SeekType type):
+       runtime_error(type==S_BEG ? lexical_cast<string>(offset) :
+               type==S_CUR ? format("CUR%+d", offset) :
+               type==S_END ? format("END%+d", offset) :
+               format("SeekType(%d)", type))
+{ }
 
 } // namespace IO
 } // namespace Msp