aboutsummaryrefslogtreecommitdiff
path: root/odb/type-processor.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-12-01 14:36:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-12-01 14:36:39 +0200
commit16ebe8f2b2464c682848cb3d8ef7168586779700 (patch)
tree242ede30b299b6473eb9c9bb144d14c9ba4f9cb4 /odb/type-processor.cxx
parentce46e20efba053e914986f20e578d90ab2e42751 (diff)
Implement not_null pointer pragma
New exception: null_pointer.
Diffstat (limited to 'odb/type-processor.cxx')
-rw-r--r--odb/type-processor.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/odb/type-processor.cxx b/odb/type-processor.cxx
index b47c413..381a4e4 100644
--- a/odb/type-processor.cxx
+++ b/odb/type-processor.cxx
@@ -107,8 +107,12 @@ namespace
if (type.empty () && idt.count ("type"))
type = idt.get<string> ("type");
- type = data_->column_type_impl (
- idt, type, id, ctf_default_null | ctf_object_id_ref);
+ column_type_flags f (ctf_object_id_ref);
+
+ if (null_pointer (m))
+ f |= ctf_default_null;
+
+ type = data_->column_type_impl (idt, type, id, f);
}
else
{
@@ -190,8 +194,12 @@ namespace
if (type.empty () && idt.count ("type"))
type = idt.get<string> ("type");
- type = data_->column_type_impl (
- idt, type, id, ctf_default_null | ctf_object_id_ref);
+ column_type_flags f (ctf_object_id_ref);
+
+ if (null_pointer (m, prefix))
+ f |= ctf_default_null;
+
+ type = data_->column_type_impl (idt, type, id, f);
}
else
type = data_->column_type_impl (t, type, m, ctf_none);
@@ -465,6 +473,12 @@ namespace
m.set (kp + (kp.empty () ? "": "-") + "object-pointer", c);
+ if (m.count ("not-null") && !kp.empty ())
+ {
+ m.remove ("not-null");
+ m.set (kp + "-not-null", string ()); // Keep compatible with pragma.
+ }
+
// See if this is the inverse side of a bidirectional relationship.
// If so, then resolve the member and cache it in the context.
//