From 16ebe8f2b2464c682848cb3d8ef7168586779700 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 1 Dec 2010 14:36:39 +0200 Subject: Implement not_null pointer pragma New exception: null_pointer. --- odb/type-processor.cxx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'odb/type-processor.cxx') 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 ("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 ("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. // -- cgit v1.1