aboutsummaryrefslogtreecommitdiff
path: root/odb/validator.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-10-15 11:33:40 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-10-21 19:25:06 +0200
commit6508eb18a20a2f0bc48374f3f0a352f1195cc95b (patch)
tree0aaf5a65d82b7d58721b0020c17885d16f178b3e /odb/validator.cxx
parentb2f0cd834b8f5651985357f8acbe82edd7d11c63 (diff)
Add support for readonly members
New pragma: readonly. New test: readonly.
Diffstat (limited to 'odb/validator.cxx')
-rw-r--r--odb/validator.cxx26
1 files changed, 26 insertions, 0 deletions
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);