]> git.tdb.fi Git - libs/core.git/blobdiff - source/file.h
Add put, getline and get to Filtered to make use of possible optimizations in the...
[libs/core.git] / source / file.h
index 49b596bb943077411db57b0bc66044de8de87a92..df5105daaade7f83a1496f80bb8476cbd75eb40a 100644 (file)
@@ -9,6 +9,8 @@ Distributed under the LGPL
 
 #include <string>
 #include "base.h"
+#include "buffered.h"
+#include "filtered.h"
 #include "seek.h"
 
 namespace Msp {
@@ -34,22 +36,22 @@ public:
        void close();
 
        void set_block(bool);
-       void enable_events();
 
-       void sync();
+       virtual void sync();
 
-       int  seek(int, SeekType);
-       int  tell() const;
+       virtual int  seek(int, SeekType);
+       virtual int  tell() const;
 
-       Handle get_event_handle() { return handle; }
+       virtual Handle get_event_handle() { return handle; }
 
-       ~File();
+       virtual ~File();
 private:
        Handle handle;
 
-       void      check_access(Mode) const;
-       unsigned  do_write(const char *, unsigned);
-       unsigned  do_read(char *, unsigned);
+       void              check_access(Mode) const;
+protected:
+       virtual unsigned  do_write(const char *, unsigned);
+       virtual unsigned  do_read(char *, unsigned);
 };
 
 inline File::CreateMode operator|(File::CreateMode m, File::CreateMode n)
@@ -61,6 +63,8 @@ inline File::CreateMode operator&(File::CreateMode m, File::CreateMode n)
 inline File::CreateMode operator~(File::CreateMode m)
 { return File::CreateMode(~(int)m); }
 
+typedef Filtered<File, Buffered> BufferedFile;
+
 } // namespace IO
 } // namespace Msp