aboutsummaryrefslogtreecommitdiff
path: root/odb/pragma.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-07-04 17:53:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-07-04 17:53:47 +0200
commit932cd7a53b3996468fee5cfa63c2b2998dbe971a (patch)
tree55424fe09a95310bc2b8e6d1473108b64107e06c /odb/pragma.cxx
parent1ac1ae65e6cbf42c002acb27615127bbc0b20d9e (diff)
Implement support for database operations callbacks
New object pragma: callback. New test: common/callback. New manual section: 10.1.4, "callback".
Diffstat (limited to 'odb/pragma.cxx')
-rw-r--r--odb/pragma.cxx38
1 files changed, 37 insertions, 1 deletions
diff --git a/odb/pragma.cxx b/odb/pragma.cxx
index a22c1d1..3b8d222 100644
--- a/odb/pragma.cxx
+++ b/odb/pragma.cxx
@@ -127,7 +127,8 @@ check_decl_type (tree d, string const& name, string const& p, location_t l)
}
else if (p == "object" ||
p == "pointer" ||
- p == "abstract")
+ p == "abstract" ||
+ p == "callback")
{
if (tc != RECORD_TYPE)
{
@@ -374,6 +375,41 @@ handle_pragma (cpp_reader* reader,
tt = pragma_lex (&t);
}
+ else if (p == "callback")
+ {
+ // callback (name)
+ //
+
+ // Make sure we've got the correct declaration type.
+ //
+ if (decl != 0 && !check_decl_type (decl, decl_name, p, loc))
+ return;
+
+ if (pragma_lex (&t) != CPP_OPEN_PAREN)
+ {
+ error () << "'(' expected after db pragma '" << p << "'" << endl;
+ return;
+ }
+
+ tt = pragma_lex (&t);
+
+ if (tt != CPP_NAME)
+ {
+ error () << "member function name expected in db pragma '" << p
+ << "'" << endl;
+ return;
+ }
+
+ val = IDENTIFIER_POINTER (t);
+
+ if (pragma_lex (&t) != CPP_CLOSE_PAREN)
+ {
+ error () << "')' expected at the end of db pragma '" << p << "'" << endl;
+ return;
+ }
+
+ tt = pragma_lex (&t);
+ }
else if (p == "id")
{
// id