diff mde/lookup/Options.d @ 79:61ea26abe4dd

Moved mde/mergetag/parse/parse(To/From) to mde/mergetag/(de)serialize. Implemented (de)serialization of structs.
author Diggory Hardy <diggory.hardy@gmail.com>
date Tue, 05 Aug 2008 11:51:51 +0100
parents 25cb7420dc91
children ea58f277f487
line wrap: on
line diff
--- a/mde/lookup/Options.d	Tue Jul 29 18:14:53 2008 +0100
+++ b/mde/lookup/Options.d	Tue Aug 05 11:51:51 2008 +0100
@@ -28,8 +28,7 @@
 import mde.mergetag.Writer;
 import mde.mergetag.DataSet;
 import mde.mergetag.exception;
-import mde.mergetag.parse.parseTo : parseTo;
-import mde.mergetag.parse.parseFrom : parseFrom;
+import mde.mergetag.serialize;
 
 import tango.core.Exception : ArrayBoundsException;
 import tango.util.log.Log : Log, Logger;
@@ -202,8 +201,7 @@
      * via hash-maps, which is a little slower than direct access but necessary since the option
      * must be changed in two separate places. */
     void set(T) (char[] symbol, T val) {
-        static if (!TIsIn!(T,TYPES))
-            static assert (false, "Options.set does not currently support type "~T.stringof);
+        static assert (TIsIn!(T,TYPES), "Options does not support type "~T.stringof);
         
         mixin (`alias opts`~TName!(T)~` optsVars;`);
         
@@ -222,8 +220,7 @@
      *
      * Using this method to read an option is not necessary, but allows for generic use.  */
     T get(T) (char[] symbol) {
-        static if (!TIsIn!(T,TYPES))
-            static assert (false, "Options.get does not currently support type "~T.stringof);
+        static assert (TIsIn!(T,TYPES), "Options does not support type "~T.stringof);
         
         mixin (`alias opts`~TName!(T)~` optsVars;`);
         
@@ -237,8 +234,7 @@
     
     /** List the names of all options of a specific type. */
     char[][] list(T) () {
-        static if (!TIsIn!(T,TYPES))
-            static assert (false, "Options.list does not currently support type "~T.stringof);
+        static assert (TIsIn!(T,TYPES), "Options does not support type "~T.stringof);
         
         mixin (`alias opts`~TName!(T)~` optsVars;`);
         
@@ -248,7 +244,7 @@
     protected {
         OptionChanges optionChanges;	// all changes to options (for saving)
     	
-    	// The "pointer lists":
+        // The "pointer lists", e.g. char[]*[ID] optscharA;
         mixin (PLists!(TYPES));
     }
     
@@ -408,8 +404,7 @@
     this () {}
     
     void set(T) (ID id, T x) {
-        static if (!TIsIn!(T,TYPES))
-            static assert (false, "OptionChanges.set does not currently support type "~T.stringof);
+        static assert (TIsIn!(T,TYPES), "Options does not support type "~T.stringof);
         
         mixin (`alias opts`~TName!(T)~` optsVars;`);
         mixin (`alias `~TName!(T)~`s vars;`);