From 6508eb18a20a2f0bc48374f3f0a352f1195cc95b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 15 Oct 2011 11:33:40 +0200 Subject: Add support for readonly members New pragma: readonly. New test: readonly. --- odb/validator.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'odb/validator.cxx') diff --git a/odb/validator.cxx b/odb/validator.cxx index c12bff0..ffa8aec 100644 --- a/odb/validator.cxx +++ b/odb/validator.cxx @@ -71,6 +71,32 @@ namespace valid_ = false; } + // Make sure id or inverse member is not marked readonly since we + // depend on these three sets not having overlaps. Once we support + // composite ids, we will also need to make sure there are no + // nested readonly members (probably move it to pass 2 and use + // column_count()). + // + if (m.count ("readonly")) + { + if (m.count ("id")) + { + cerr << m.file () << ":" << m.line () << ":" << m.column () << ":" + << " error: object id should not be declared readonly" << endl; + + valid_ = false; + } + + if (m.count ("inverse")) + { + cerr << m.file () << ":" << m.line () << ":" << m.column () << ":" + << " error: inverse object pointer should not be declared " + << "readonly" << endl; + + valid_ = false; + } + } + // Resolve null overrides. // override_null (m); -- cgit v1.1