]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/persistence/persistent_enum.tpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_enum.tpp
diff --git a/src/stlplus/persistence/persistent_enum.tpp b/src/stlplus/persistence/persistent_enum.tpp
new file mode 100644 (file)
index 0000000..9778688
--- /dev/null
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+//   Author:    Andy Rushton\r
+//   Copyright: (c) Southampton University 1999-2004\r
+//              (c) Andy Rushton           2004-2009\r
+//   License:   BSD License, see ../docs/license.html\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+#include "persistent_int.hpp"\r
+\r
+namespace stlplus\r
+{\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // enumeration types\r
+\r
+  template<typename T>\r
+  void dump_enum(dump_context& context, const T& data)\r
+    throw(persistent_dump_failed)\r
+  {\r
+    dump_unsigned(context,(unsigned)data);\r
+  }\r
+\r
+  template<typename T>\r
+  void restore_enum(restore_context& context, T& data)\r
+    throw(persistent_restore_failed)\r
+  {\r
+    unsigned value = 0;\r
+    restore_unsigned(context, value);\r
+    data = (T)value;\r
+  }\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+} // end namespace stlplus\r
This page took 0.021755 seconds and 4 git commands to generate.