[Scummvm-cvs-logs] SF.net SVN: scummvm:[39658] scummvm/trunk/common/serializer.h

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Mar 24 12:30:52 CET 2009


Revision: 39658
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39658&view=rev
Author:   fingolfin
Date:     2009-03-24 11:30:52 +0000 (Tue, 24 Mar 2009)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/common/serializer.h

Modified: scummvm/trunk/common/serializer.h
===================================================================
--- scummvm/trunk/common/serializer.h	2009-03-24 11:30:37 UTC (rev 39657)
+++ scummvm/trunk/common/serializer.h	2009-03-24 11:30:52 UTC (rev 39658)
@@ -33,7 +33,7 @@
 
 
 #define SYNC_AS(SUFFIX,TYPE,SIZE) \
-	template <class T> \
+	template <typename T> \
 	void syncAs ## SUFFIX(T &val) { \
 		if (_loadStream) \
 			val = static_cast<T>(_loadStream->read ## SUFFIX()); \
@@ -57,8 +57,29 @@
 	bool isSaving() { return (_saveStream != 0); }
 	bool isLoading() { return (_loadStream != 0); }
 
+	/**
+	 * Return the total number of bytes synced so far.
+	 */
 	uint bytesSynced() const { return _bytesSynced; }
 
+
+	/**
+	 * Skip a number of bytes in the data stream.
+	 * This is useful to skip obsolete fields in old savestates.
+	 */
+	void skip(uint32 size) {
+		_bytesSynced += size;
+		if (_loadStream)
+			_loadStream->skip(size);
+		else {
+			while (size--)
+				_saveStream->writeByte(0);
+		}
+	}
+
+	/**
+	 * Sync a block of arbitrary fixed-length data.
+	 */
 	void syncBytes(byte *buf, uint32 size) {
 		if (_loadStream)
 			_loadStream->read(buf, size);
@@ -93,16 +114,6 @@
 		syncBytes((byte *)buf, size);
 	}
 
-	void skip(uint32 size) {
-		_bytesSynced += size;
-		if (_loadStream)
-			_loadStream->skip(size);
-		else {
-			while (size--)
-				_saveStream->writeByte(0);
-		}
-	}
-
 	SYNC_AS(Byte, byte, 1)
 
 	SYNC_AS(Uint16LE, uint16, 2)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list