Commits

Adam Labranche  committed b736e71

Worked on the Serializable class.

  • Participants
  • Parent commits 2dd88d5

Comments (0)

Files changed (3)

File ALSerializable

+# HG changeset patch
+# Parent 1167177d51cf3fe20e6d8e4a29069b8261f3ad7e
+Created the Serializable class.
+
+diff -r 1167177d51cf RedBox/RedBox/Helper/Serialization/Serializable.cpp
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/RedBox/RedBox/Helper/Serialization/Serializable.cpp	Wed Jan 25 08:49:03 2012 -0500
+@@ -0,0 +1,6 @@
++#include "Serializable.h"
++
++namespace RedBox {
++	Serializable::~Serializable() {
++	}
++}
+diff -r 1167177d51cf RedBox/RedBox/Helper/Serialization/Serializable.h
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/RedBox/RedBox/Helper/Serialization/Serializable.h	Wed Jan 25 08:49:03 2012 -0500
+@@ -0,0 +1,38 @@
++/**
++ * @file
++ * @ingroup Serialization
++ */
++#ifndef RB_SERIALIZABLE_H
++#define RB_SERIALIZABLE_H
++
++namespace RedBox {
++	class Value;
++
++	/**
++	 * Base class for all serializable classes.
++	 * @ingroup Serialization
++	 */
++	class Serializable {
++	public:
++		/**
++		 * Destructor.
++		 */
++		virtual ~Serializable();
++
++		/**
++		 * Serializes the instance to a Value.
++		 * @param node Node to serialize the instance into.
++		 */
++		virtual void serialize(Value &node) const = 0;
++
++		/**
++		 * Deserializes the instance from a Value.
++		 * @param node Value to read the data from.
++		 * @return True on success, false on failure to read all the
++		 * necessary data. Does not modify the instance when there is a failure.
++		 */
++		virtual bool deserialize(const Value &node) = 0;
++	};
++}
++
++#endif
 # HG changeset patch
-# Parent d8f523cda1b6a654c88f6f3990468afb0b038cd8
+# Parent f80de52ba30143ff95c9e974558fa2b5d4e71169
 Created the initial classes to be used for serialization.
 
-diff -r d8f523cda1b6 RedBox/RedBox.h
---- a/RedBox/RedBox.h	Thu Jan 19 15:37:44 2012 -0500
-+++ b/RedBox/RedBox.h	Wed Jan 25 00:42:25 2012 -0500
+diff -r f80de52ba301 RedBox/RedBox.h
+--- a/RedBox/RedBox.h	Tue Jan 24 14:45:05 2012 -0500
++++ b/RedBox/RedBox.h	Wed Jan 25 08:38:33 2012 -0500
 @@ -27,6 +27,12 @@
   */
  
   * @defgroup Physics Physics
   * @brief Classes used in the physics engine.
   */
-diff -r d8f523cda1b6 RedBox/RedBox/Helper/Serialization/Array.h
+diff -r f80de52ba301 RedBox/RedBox/Helper/Serialization/Array.h
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/RedBox/RedBox/Helper/Serialization/Array.h	Wed Jan 25 00:42:25 2012 -0500
++++ b/RedBox/RedBox/Helper/Serialization/Array.h	Wed Jan 25 08:38:33 2012 -0500
 @@ -0,0 +1,16 @@
 +/**
 + * @file
 +}
 +
 +#endif
-diff -r d8f523cda1b6 RedBox/RedBox/Helper/Serialization/Object.h
+diff -r f80de52ba301 RedBox/RedBox/Helper/Serialization/Object.h
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/RedBox/RedBox/Helper/Serialization/Object.h	Wed Jan 25 00:42:25 2012 -0500
++++ b/RedBox/RedBox/Helper/Serialization/Object.h	Wed Jan 25 08:38:33 2012 -0500
 @@ -0,0 +1,17 @@
 +/**
 + * @file
 +}
 +
 +#endif
-diff -r d8f523cda1b6 RedBox/RedBox/Helper/Serialization/Serializer.cpp
+diff -r f80de52ba301 RedBox/RedBox/Helper/Serialization/Serializer.cpp
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/RedBox/RedBox/Helper/Serialization/Serializer.cpp	Wed Jan 25 00:42:25 2012 -0500
++++ b/RedBox/RedBox/Helper/Serialization/Serializer.cpp	Wed Jan 25 08:38:33 2012 -0500
 @@ -0,0 +1,68 @@
 +#include "Serializer.h"
 +
 +		}
 +	}
 +}
-diff -r d8f523cda1b6 RedBox/RedBox/Helper/Serialization/Serializer.h
+diff -r f80de52ba301 RedBox/RedBox/Helper/Serialization/Serializer.h
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/RedBox/RedBox/Helper/Serialization/Serializer.h	Wed Jan 25 00:42:25 2012 -0500
++++ b/RedBox/RedBox/Helper/Serialization/Serializer.h	Wed Jan 25 08:38:33 2012 -0500
 @@ -0,0 +1,64 @@
 +/**
 + * @file
 +}
 +
 +#endif
-diff -r d8f523cda1b6 RedBox/RedBox/Helper/Serialization/Sources.cmake
+diff -r f80de52ba301 RedBox/RedBox/Helper/Serialization/Sources.cmake
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/RedBox/RedBox/Helper/Serialization/Sources.cmake	Wed Jan 25 00:42:25 2012 -0500
++++ b/RedBox/RedBox/Helper/Serialization/Sources.cmake	Wed Jan 25 08:38:33 2012 -0500
 @@ -0,0 +1,12 @@
 +get_filename_component(Helper_Serialization_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
 +file(GLOB RedBox_RedBox_Helper_Serialization_Headers ${Helper_Serialization_dir}/*.h)
 +
 +source_group(RedBox\\Helper\\Serialization  FILES ${RedBox_RedBox_Helper_Serialization_Sources} ${RedBox_RedBox_Helper_Serialization_Headers})
 +
-diff -r d8f523cda1b6 RedBox/RedBox/Helper/Serialization/Value.cpp
+diff -r f80de52ba301 RedBox/RedBox/Helper/Serialization/Value.cpp
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/RedBox/RedBox/Helper/Serialization/Value.cpp	Wed Jan 25 00:42:25 2012 -0500
++++ b/RedBox/RedBox/Helper/Serialization/Value.cpp	Wed Jan 25 08:38:33 2012 -0500
 @@ -0,0 +1,320 @@
 +#include "Value.h"
 +
 +		}
 +	}
 +}
-diff -r d8f523cda1b6 RedBox/RedBox/Helper/Serialization/Value.h
+diff -r f80de52ba301 RedBox/RedBox/Helper/Serialization/Value.h
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/RedBox/RedBox/Helper/Serialization/Value.h	Wed Jan 25 00:42:25 2012 -0500
++++ b/RedBox/RedBox/Helper/Serialization/Value.h	Wed Jan 25 08:38:33 2012 -0500
 @@ -0,0 +1,370 @@
 +/**
 + * @file
 +}
 +
 +#endif
-diff -r d8f523cda1b6 RedBox/RedBox/Helper/Sources.cmake
---- a/RedBox/RedBox/Helper/Sources.cmake	Thu Jan 19 15:37:44 2012 -0500
-+++ b/RedBox/RedBox/Helper/Sources.cmake	Wed Jan 25 00:42:25 2012 -0500
+diff -r f80de52ba301 RedBox/RedBox/Helper/Sources.cmake
+--- a/RedBox/RedBox/Helper/Sources.cmake	Tue Jan 24 14:45:05 2012 -0500
++++ b/RedBox/RedBox/Helper/Sources.cmake	Wed Jan 25 08:38:33 2012 -0500
 @@ -19,6 +19,7 @@
  endif(iphone)
  
 ALValue
+ALSerializable
 #ALTileSet
 #ALBatchMod
 #ALTileMap