]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/memory.cpp
Make certain functions pure virtual so I won't forget to implement them
[libs/core.git] / source / io / memory.cpp
index bc14ff1fd4e832967b93f346a7fd4de29c74f552..c5aee1e0536e040e72187172b2c084269596cce9 100644 (file)
@@ -37,6 +37,11 @@ void Memory::init(char *b, char *e, Mode m)
        mode = m;
 }
 
+void Memory::set_block(bool)
+{
+       throw logic_error("Memory::set_block");
+}
+
 unsigned Memory::do_write(const char *buf, unsigned size)
 {
        check_access(M_WRITE);
@@ -66,6 +71,10 @@ unsigned Memory::do_read(char *buf, unsigned size)
 unsigned Memory::put(char c)
 {
        check_access(M_WRITE);
+
+       if(pos==end)
+               return 0;
+
        *pos++ = c;
        return 1;
 }
@@ -99,6 +108,11 @@ int Memory::get()
        return static_cast<unsigned char>(*pos++);
 }
 
+const Handle &Memory::get_handle(Mode)
+{
+       throw logic_error("Memory::get_handle");
+}
+
 SeekOffset Memory::seek(SeekOffset off, SeekType type)
 {
        char *new_pos;
@@ -112,9 +126,10 @@ SeekOffset Memory::seek(SeekOffset off, SeekType type)
                throw invalid_argument("Memory::seek");
 
        if(new_pos<begin || new_pos>end)
-               throw out_of_range("Memory::seek");
+               throw bad_seek(off, type);
 
        pos = new_pos;
+       eof_flag = false;
        return pos-begin;
 }