]> git.tdb.fi Git - libs/core.git/blobdiff - source/memory.cpp
Move class members and comments around
[libs/core.git] / source / memory.cpp
index 13a6606b8e9a6623dd3ae70ec3e574abfaab4574..6ea130b54ae134478ab40851f4c49cf1d68ad439 100644 (file)
@@ -37,6 +37,30 @@ void Memory::init(char *b, char *e, Mode m)
        mode = m;
 }
 
+unsigned Memory::do_write(const char *buf, unsigned size)
+{
+       check_mode(M_WRITE);
+
+       size = min<unsigned>(size, end-pos);
+       memcpy(pos, buf, size);
+       pos += size;
+       return size;
+}
+
+unsigned Memory::do_read(char *buf, unsigned size)
+{
+       if(pos==end)
+       {
+               eof_flag = true;
+               return 0;
+       }
+
+       size = min<unsigned>(size, end-pos);
+       memcpy(buf, pos, size);
+       pos += size;
+       return size;
+}
+
 unsigned Memory::put(char c)
 {
        check_mode(M_WRITE);
@@ -88,30 +112,6 @@ Handle Memory::get_event_handle()
        throw Exception("Memory doesn't support events");
 }
 
-unsigned Memory::do_write(const char *buf, unsigned size)
-{
-       check_mode(M_WRITE);
-
-       size = min<unsigned>(size, end-pos);
-       memcpy(pos, buf, size);
-       pos += size;
-       return size;
-}
-
-unsigned Memory::do_read(char *buf, unsigned size)
-{
-       if(pos==end)
-       {
-               eof_flag = true;
-               return 0;
-       }
-
-       size = min<unsigned>(size, end-pos);
-       memcpy(buf, pos, size);
-       pos += size;
-       return size;
-}
-
 void Memory::check_mode(Mode m) const
 {
        if(m==M_WRITE)