From 851cbe3927b987ec992bbbb69bd62224bf4a0dc3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Apr 2012 16:48:01 +0200 Subject: Polymorphic inheritance support --- odb/sqlite/polymorphic-object-result.hxx | 87 ++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 odb/sqlite/polymorphic-object-result.hxx (limited to 'odb/sqlite/polymorphic-object-result.hxx') diff --git a/odb/sqlite/polymorphic-object-result.hxx b/odb/sqlite/polymorphic-object-result.hxx new file mode 100644 index 0000000..54f4092 --- /dev/null +++ b/odb/sqlite/polymorphic-object-result.hxx @@ -0,0 +1,87 @@ +// file : odb/sqlite/polymorphic-object-result.hxx +// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_SQLITE_POLYMORPHIC_OBJECT_RESULT_HXX +#define ODB_SQLITE_POLYMORPHIC_OBJECT_RESULT_HXX + +#include + +#include // std::size_t + +#include + +#include + +#include +#include // query +#include +#include + +namespace odb +{ + namespace sqlite + { + template + class polymorphic_object_result_impl: + public odb::polymorphic_object_result_impl, + public result_impl_base + { + public: + typedef odb::polymorphic_object_result_impl base_type; + + typedef typename base_type::object_type object_type; + typedef typename base_type::object_traits object_traits; + typedef typename base_type::id_type id_type; + + typedef typename base_type::pointer_type pointer_type; + typedef typename base_type::pointer_traits pointer_traits; + + typedef typename base_type::root_type root_type; + typedef typename base_type::root_traits root_traits; + typedef typename base_type::discriminator_type discriminator_type; + + typedef typename object_traits::statements_type statements_type; + + virtual + ~polymorphic_object_result_impl (); + + polymorphic_object_result_impl (const query&, + details::shared_ptr, + statements_type&); + + virtual void + load (object_type*, bool fetch); + + virtual id_type + load_id (); + + virtual discriminator_type + load_discriminator (); + + virtual void + next (); + + virtual void + cache (); + + virtual std::size_t + size (); + + using base_type::current; + + private: + void + load_image (); + + private: + statements_type& statements_; + }; + } +} + +#include + +#include + +#endif // ODB_SQLITE_POLYMORPHIC_OBJECT_RESULT_HXX -- cgit v1.1