diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-12-01 14:36:39 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-12-01 14:36:39 +0200 |
commit | 16ebe8f2b2464c682848cb3d8ef7168586779700 (patch) | |
tree | 242ede30b299b6473eb9c9bb144d14c9ba4f9cb4 /odb/context.hxx | |
parent | ce46e20efba053e914986f20e578d90ab2e42751 (diff) |
Implement not_null pointer pragma
New exception: null_pointer.
Diffstat (limited to 'odb/context.hxx')
-rw-r--r-- | odb/context.hxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/odb/context.hxx b/odb/context.hxx index bc8a8bf..47375a3 100644 --- a/odb/context.hxx +++ b/odb/context.hxx @@ -88,6 +88,24 @@ public: : m.get<class_*> (key_prefix + "-object-pointer", 0); } + static bool + null_pointer (semantics::data_member& m) + { + return !(m.count ("not-null") || m.type ().count ("not-null")); + } + + static bool + null_pointer (semantics::data_member& m, string const& key_prefix) + { + if (key_prefix.empty ()) + return null_pointer (m); + + return !(m.count (key_prefix + "-not-null") || + m.type ().count ("not-null") || + m.type ().get<semantics::type*> ( + "tree-" + key_prefix +"-type")->count ("not-null")); + } + static semantics::data_member* inverse (semantics::data_member& m, string const& key_prefix = string ()) { |