[Lemon-commits] ladanyi: r3348 - glemon/branches/akos

Lemon SVN svn at lemon.cs.elte.hu
Fri Oct 26 10:05:17 CEST 2007


Author: ladanyi
Date: Fri Oct 26 10:05:16 2007
New Revision: 3348

Added:
   glemon/branches/akos/io_helper.cc

Log:
Forgot to add this.

Added: glemon/branches/akos/io_helper.cc
==============================================================================
--- (empty file)
+++ glemon/branches/akos/io_helper.cc	Fri Oct 26 10:05:16 2007
@@ -0,0 +1,34 @@
+#include "io_helper.h"
+
+namespace lemon {
+  void xml(XmlIo &x, MapValue::Type& v)
+  {
+    if(x.write()) {
+      switch (v)
+      {
+        case MapValue::NUMERIC:
+          { x("type", std::string("numeric")); }
+          break;
+        case MapValue::STRING:
+          { x("type", std::string("string")); }
+          break;
+      }
+    }
+    else {
+      std::string type;
+      { x("type", type); }
+      if (type == "numeric")
+      {
+        v = MapValue::NUMERIC;
+      }
+      else if (type == "string")
+      {
+        v = MapValue::STRING;
+      }
+      else
+      {
+        throw DataFormatError("Bad format");
+      }
+    }
+  }
+};



More information about the Lemon-commits mailing list