From 08de79b43a09b02a7b8feae2a9c12005d4bbb878 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Fri, 30 Jul 2010 13:23:50 +0200
Subject: Add value type traits

---
 odb/traits.hxx | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/odb/traits.hxx b/odb/traits.hxx
index 8aee00c..aa98ae1 100644
--- a/odb/traits.hxx
+++ b/odb/traits.hxx
@@ -7,6 +7,7 @@
 #define ODB_TRAITS_HXX
 
 #include <odb/forward.hxx>
+#include <odb/buffer.hxx>
 #include <odb/shared-ptr.hxx>
 #include <odb/pointer-traits.hxx>
 
@@ -88,6 +89,30 @@ namespace odb
     pointer_traits<typename access::object_traits<T>::pointer_type>
     pointer_ops;
   };
+
+  template <typename V>
+  struct value_traits
+  {
+    typedef V value_type;
+
+    template <typename I>
+    static void
+    set_value (value_type& v, I i, bool is_null)
+    {
+      if (!is_null)
+        v = value_type (i);
+      else
+        v = value_type ();
+    }
+
+    template <typename I>
+    static void
+    set_image (I& i, bool& is_null, value_type v)
+    {
+      is_null = false;
+      i = I (v);
+    }
+  };
 }
 
 #endif // ODB_TRAITS_HXX
-- 
cgit v1.1