]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/file.h
Wrap seek in a helper function and make it compatible with 64-bit offsets
[libs/core.git] / source / io / file.h
index 05aaf9565a08653f278773e010fee4acb6361779..ee83554cff806bc4ba47d0e1383cbcb426b5f153 100644 (file)
@@ -1,21 +1,29 @@
 #ifndef MSP_IO_FILE_H_
 #define MSP_IO_FILE_H_
 
+#include <stdexcept>
 #include <string>
-#include "base.h"
 #include "buffered.h"
 #include "filtered.h"
-#include "seek.h"
+#include "handle.h"
+#include "seekable.h"
 
 namespace Msp {
 namespace IO {
 
+class file_not_found: public std::runtime_error
+{
+public:
+       file_not_found(const std::string &fn): std::runtime_error(fn) { }
+};
+
+
 /**
 A class for reading and writing files.
 
 Non-blocking mode is not supported on Win32.
 */
-class File: public Base
+class File: public Seekable
 {
 public:
        enum CreateMode
@@ -48,13 +56,8 @@ protected:
 public:
        virtual void sync();
 
-       /** Changes the read/write offset of the file.  Returns the new offset. */
-       virtual int seek(int, SeekType);
-       
-       /** Returns the current read/write offset of the file. */
-       virtual int tell() const;
-
-       virtual Handle get_event_handle() { return handle; }
+       virtual SeekOffset seek(SeekOffset, SeekType);
+       virtual SeekOffset tell() const;
 
 private:
        void check_access(Mode) const;