Permalink
Browse files

Added documentation to SerializationException. Started adding documen…

…tation to Serializer.
  • Loading branch information...
1 parent 1b91197 commit 864cbe17132f82fe050bbd3bc7916d133c54dc22 @jacob-carlborg committed Sep 11, 2011
Showing with 46 additions and 9 deletions.
  1. +16 −8 orange/serialization/SerializationException.d
  2. +30 −1 orange/serialization/Serializer.d
@@ -15,27 +15,29 @@ else
alias Throwable ExceptionBase;
/**
- *
- * Authors: doob
+ * This class represents an exception, it's the base class of all exceptions used
+ * throughout this library.
*/
class SerializationException : ExceptionBase
{
/**
+ * Creates a new exception with the given message.
*
* Params:
- * message =
+ * message = the message of the exception
*/
this (string message)
{
super(message);
}
/**
+ * Creates a new exception with the given message, file and line info.
*
* Params:
- * message =
- * file =
- * line =
+ * message = the message of the exception
+ * file = the file where the exception occurred
+ * line = the line in the file where the exception occurred
*/
this (string message, string file, long line)
{
@@ -49,9 +51,12 @@ class SerializationException : ExceptionBase
version (Tango)
{
/**
+ * Creates a new exception out of the given exception. Used for wrapping already existing
+ * exceptions as SerializationExceptions.
+ *
*
* Params:
- * exception =
+ * exception = the exception exception to wrap
*/
this (ExceptionBase exception)
{
@@ -62,9 +67,12 @@ class SerializationException : ExceptionBase
else
{
/**
+ * Creates a new exception out of the given exception. Used for wrapping already existing
+ * exceptions as SerializationExceptions.
+ *
*
* Params:
- * exception =
+ * exception = the exception exception to wrap
*/
this (ExceptionBase exception)
{
@@ -44,8 +44,37 @@ private
}
/**
+ * This interface represents a type that this is serializable. To implement this interface
+ * This class represents a serializer. It's the main interface to the (de)serialization
+ * process and it's this class that actually performs most of the (de)serialization that
+ * is archive independent.
*
- * Authors: doob
+ * Examples:
+ * ---
+ * import orange.serialization._;
+ * import orange.serialization.archives._;
+ * import orange.core._;
+ *
+ * class Foo
+ * {
+ * int a;
+ * }
+ *
+ * void main ()
+ * {
+ * auto archive = new XMLArchive!();
+ * auto serializer = new Serializer;
+ *
+ * auto foo = new Foo;
+ * foo.a = 3;
+ *
+ * serializer.serialize(foo);
+ * auto foo2 = serializer.deserialize!(Foo)(archive.untypedData);
+ *
+ * println(foo2.a); // prints "3"
+ * assert(foo.a == foo2.a);
+ * }
+ * ---
*/
class Serializer
{

0 comments on commit 864cbe1

Please sign in to comment.