aboutsummaryrefslogtreecommitdiff
path: root/odb/relational/inline.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-09-05 10:36:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-09-05 10:36:33 +0200
commit428558c89850fe8c79b9c89a943bd996912d12f5 (patch)
treeb6d8af6fd6a82b3e3822f7da4637c7c16ee7100d /odb/relational/inline.hxx
parenta7ec19749a76cc262240124f5c71c1ee4051cba7 (diff)
Support for views; native part
Diffstat (limited to 'odb/relational/inline.hxx')
-rw-r--r--odb/relational/inline.hxx55
1 files changed, 45 insertions, 10 deletions
diff --git a/odb/relational/inline.hxx b/odb/relational/inline.hxx
index 311640e..1134df6 100644
--- a/odb/relational/inline.hxx
+++ b/odb/relational/inline.hxx
@@ -41,29 +41,31 @@ namespace relational
virtual void
traverse (type& c)
{
+ bool obj (object (c));
+
// Ignore transient bases.
//
- if (!object (c))
+ if (!(obj || view (c)))
return;
if (c.count ("callback"))
{
string name (c.get<string> ("callback"));
- // In case of the const object, we only generate the call if
+ // In case of the const instance, we only generate the call if
// there is a const callback.
//
if (const_)
{
if (c.count ("callback-const"))
- os << "static_cast< const " << c.fq_name () << "& > (obj)." <<
+ os << "static_cast< const " << c.fq_name () << "& > (x)." <<
name << " (e, db);";
}
else
- os << "static_cast< " << c.fq_name () << "& > (obj)." <<
+ os << "static_cast< " << c.fq_name () << "& > (x)." <<
name << " (e, db);";
}
- else
+ else if (obj)
inherits (c);
}
@@ -86,6 +88,8 @@ namespace relational
if (object (c))
traverse_object (c);
+ if (view (c))
+ traverse_view (c);
else if (composite (c))
traverse_composite (c);
}
@@ -178,11 +182,11 @@ namespace relational
//
os << "inline" << endl
<< "void " << traits << "::" << endl
- << "callback (database& db, object_type& obj, callback_event e)"
+ << "callback (database& db, object_type& x, callback_event e)"
<< endl
<< "{"
<< "ODB_POTENTIALLY_UNUSED (db);"
- << "ODB_POTENTIALLY_UNUSED (obj);"
+ << "ODB_POTENTIALLY_UNUSED (x);"
<< "ODB_POTENTIALLY_UNUSED (e);"
<< endl;
callback_calls_->traverse (c, false);
@@ -190,11 +194,10 @@ namespace relational
os << "inline" << endl
<< "void " << traits << "::" << endl
- << "callback (database& db, const object_type& obj, " <<
- "callback_event e)"
+ << "callback (database& db, const object_type& x, callback_event e)"
<< "{"
<< "ODB_POTENTIALLY_UNUSED (db);"
- << "ODB_POTENTIALLY_UNUSED (obj);"
+ << "ODB_POTENTIALLY_UNUSED (x);"
<< "ODB_POTENTIALLY_UNUSED (e);"
<< endl;
callback_calls_->traverse (c, true);
@@ -239,6 +242,38 @@ namespace relational
}
virtual void
+ view_extra (type&)
+ {
+ }
+
+ virtual void
+ traverse_view (type& c)
+ {
+ string const& type (c.fq_name ());
+ string traits ("access::view_traits< " + type + " >");
+
+ os << "// " << c.name () << endl
+ << "//" << endl
+ << endl;
+
+ view_extra (c);
+
+ // callback ()
+ //
+ os << "inline" << endl
+ << "void " << traits << "::" << endl
+ << "callback (database& db, view_type& x, callback_event e)"
+ << endl
+ << "{"
+ << "ODB_POTENTIALLY_UNUSED (db);"
+ << "ODB_POTENTIALLY_UNUSED (x);"
+ << "ODB_POTENTIALLY_UNUSED (e);"
+ << endl;
+ callback_calls_->traverse (c, false);
+ os << "}";
+ }
+
+ virtual void
traverse_composite (type&)
{
/*