]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/memory.cpp
Put the check_access function in Base
[libs/core.git] / source / io / memory.cpp
index f89d9fc894c26d207e6e3b8300d9f9dc99c6f7ae..6ccf84654764cbe8086a3ac841330580d302dcd1 100644 (file)
@@ -39,7 +39,7 @@ void Memory::init(char *b, char *e, Mode m)
 
 unsigned Memory::do_write(const char *buf, unsigned size)
 {
-       check_mode(M_WRITE);
+       check_access(M_WRITE);
 
        size = min<unsigned>(size, end-pos);
        memcpy(pos, buf, size);
@@ -63,7 +63,7 @@ unsigned Memory::do_read(char *buf, unsigned size)
 
 unsigned Memory::put(char c)
 {
-       check_mode(M_WRITE);
+       check_access(M_WRITE);
        *pos++ = c;
        return 1;
 }
@@ -88,7 +88,7 @@ int Memory::get()
        return static_cast<unsigned char>(*pos++);
 }
 
-unsigned Memory::seek(int off, SeekType type)
+SeekOffset Memory::seek(SeekOffset off, SeekType type)
 {
        char *new_pos;
        if(type==S_BEG)
@@ -107,16 +107,5 @@ unsigned Memory::seek(int off, SeekType type)
        return pos-begin;
 }
 
-const Handle &Memory::get_event_handle()
-{
-       throw logic_error("Memory doesn't support events");
-}
-
-void Memory::check_mode(Mode m) const
-{
-       if(m==M_WRITE && !(mode&M_WRITE))
-               throw invalid_access(M_WRITE);
-}
-
 } // namespace IO
 } // namespace Msp