aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-07-30 13:23:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-07-30 13:23:50 +0200
commit08de79b43a09b02a7b8feae2a9c12005d4bbb878 (patch)
tree6d593ddd026faf67627c3574461ab8e12e23b642
parenta902c57dbe101a698101d601ce69df1cda038701 (diff)
Add value type traits
-rw-r--r--odb/traits.hxx25
1 files changed, 25 insertions, 0 deletions
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