aboutsummaryrefslogtreecommitdiff
path: root/odb/view-result.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-09-05 10:20:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-09-05 10:20:47 +0200
commit9c275a93cec797a021571ba8545906e0b4ffbfbc (patch)
treed1a697417df10bd7b5fc35fa795d20855047c5e9 /odb/view-result.txx
parent713b3a62d97c6bea7c23597094af6b2439314b8c (diff)
Support for views; native part
Diffstat (limited to 'odb/view-result.txx')
-rw-r--r--odb/view-result.txx49
1 files changed, 49 insertions, 0 deletions
diff --git a/odb/view-result.txx b/odb/view-result.txx
new file mode 100644
index 0000000..52d478e
--- /dev/null
+++ b/odb/view-result.txx
@@ -0,0 +1,49 @@
+// file : odb/view-result.txx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+namespace odb
+{
+ //
+ // result_impl
+ //
+
+ template <typename T>
+ result_impl<T, class_view>::
+ ~result_impl ()
+ {
+ }
+
+ template <typename T>
+ typename result_impl<T, class_view>::pointer_type&
+ result_impl<T, class_view>::
+ current ()
+ {
+ if (pointer_traits::null_ptr (current_) && !end_)
+ {
+ // For views, pointer_type is unrestricted_pointer_type.
+ //
+ pointer_type p (view_traits::create ());
+ view_type& view (pointer_traits::get_ref (p));
+ current (p);
+ load (view);
+ }
+
+ return current_;
+ }
+
+ //
+ // result_iterator
+ //
+
+ template <typename T>
+ void result_iterator<T, class_view>::
+ load (view_type& view)
+ {
+ if (res_->end ())
+ return;
+
+ res_->load (view);
+ }
+}