aboutsummaryrefslogtreecommitdiff
path: root/odb/validator.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-09-05 13:02:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-09-05 13:02:10 +0200
commit654826cdafaac4199c8a8c90ef3396e312f0944f (patch)
tree5fb40bdbca960c426fe9d20a4450d89fc6250a7d /odb/validator.cxx
parent7e922ee487bad99ce3cad3a2b2bec8ac2b381c92 (diff)
Versioned section support
Diffstat (limited to 'odb/validator.cxx')
-rw-r--r--odb/validator.cxx116
1 files changed, 58 insertions, 58 deletions
diff --git a/odb/validator.cxx b/odb/validator.cxx
index 86fcf55..6059bc8 100644
--- a/odb/validator.cxx
+++ b/odb/validator.cxx
@@ -178,12 +178,6 @@ namespace
valid_ = false;
}
- if (section)
- {
- error (l) << "section cannod be soft-added" << endl;
- valid_ = false;
- }
-
if (!versioned ())
{
error (l) << "added data member in a non-versioned object " <<
@@ -231,12 +225,6 @@ namespace
valid_ = false;
}
- if (section)
- {
- error (l) << "section cannod be soft-deleted" << endl;
- valid_ = false;
- }
-
if (!versioned ())
{
error (l) << "deleted data member in a non-versioned object " <<
@@ -279,8 +267,8 @@ namespace
valid_ = false;
}
- if (dv == 0)
- count_++; // Don't include deleted members in the count.
+ if (section)
+ return; // Section data member is transient.
// Resolve null overrides.
//
@@ -289,7 +277,6 @@ namespace
}
bool& valid_;
- size_t count_;
};
// Find special members (id, version).
@@ -525,7 +512,6 @@ namespace
// Check bases.
//
- bool base (false);
type* poly_root (0);
for (type::inherits_iterator i (c.inherits_begin ());
@@ -536,8 +522,6 @@ namespace
if (object (b))
{
- base = true;
-
if (type* r = polymorphic (b))
{
if (poly_root == 0)
@@ -590,17 +574,8 @@ namespace
// Check members.
//
- member_.count_ = 0;
names (c);
- if (member_.count_ == 0 && !base)
- {
- os << c.file () << ":" << c.line () << ":" << c.column () << ":"
- << " error: no persistent data members in the class" << endl;
-
- valid_ = false;
- }
-
// Check special members.
//
semantics::data_member* id (0);
@@ -906,17 +881,8 @@ namespace
// Check members.
//
- member_.count_ = 0;
names (c);
- if (member_.count_ == 0)
- {
- os << c.file () << ":" << c.line () << ":" << c.column () << ":"
- << " error: no persistent data members in the class" << endl;
-
- valid_ = false;
- }
-
// Check id.
//
semantics::data_member* id (0);
@@ -957,17 +923,13 @@ namespace
virtual void
traverse_composite (type& c)
{
- bool base (false);
-
for (type::inherits_iterator i (c.inherits_begin ());
i != c.inherits_end ();
++i)
{
type& b (i->base ());
- if (composite (b))
- base = true;
- else if (object (b) || view (b))
+ if (object (b) || view (b))
{
// @@ Should we use hint here?
//
@@ -991,17 +953,8 @@ namespace
// Check members.
//
- member_.count_ = 0;
names (c);
- if (member_.count_ == 0 && !base)
- {
- os << c.file () << ":" << c.line () << ":" << c.column () << ":"
- << " error: no persistent data members in the class" << endl;
-
- valid_ = false;
- }
-
// Check id.
//
semantics::data_member* id (0);
@@ -1068,12 +1021,17 @@ namespace
data_member2 (bool& valid): valid_ (valid) {}
virtual void
- traverse (type&)
+ traverse (type& m)
{
- // Enable the names() calls below if adding any tests here.
+ if (transient (m))
+ return;
+
+ if (!deleted (m)) // Don't include deleted members in the count.
+ count_++;
}
bool& valid_;
+ size_t count_;
};
struct class2: traversal::class_, context
@@ -1135,6 +1093,15 @@ namespace
virtual void
traverse_object (type& c)
{
+ bool base (false);
+ for (type::inherits_iterator i (c.inherits_begin ());
+ !base && i != c.inherits_end ();
+ ++i)
+ {
+ if (object (i->base ()))
+ base = true;
+ }
+
bool poly (polymorphic (c));
// Make sure we have no empty or pointless sections unless we
@@ -1261,29 +1228,62 @@ namespace
// Check members.
//
- //names (c);
+ member_.count_ = 0;
+ names (c);
+
+ if (member_.count_ == 0 && !base)
+ {
+ os << c.file () << ":" << c.line () << ":" << c.column () << ":"
+ << " error: no persistent data members in the class" << endl;
+ valid_ = false;
+ }
}
virtual void
- traverse_view (type&)
+ traverse_view (type& c)
{
// Check members.
//
- //names (c);
+ member_.count_ = 0;
+ names (c);
+
+ if (member_.count_ == 0)
+ {
+ os << c.file () << ":" << c.line () << ":" << c.column () << ":"
+ << " error: no persistent data members in the class" << endl;
+ valid_ = false;
+ }
}
virtual void
- traverse_composite (type&)
+ traverse_composite (type& c)
{
+ bool base (false);
+ for (type::inherits_iterator i (c.inherits_begin ());
+ !base && i != c.inherits_end ();
+ ++i)
+ {
+ if (composite (i->base ()))
+ base = true;
+ }
+
// Check members.
//
- //names (c);
+ member_.count_ = 0;
+ names (c);
+
+ if (member_.count_ == 0 && !base)
+ {
+ os << c.file () << ":" << c.line () << ":" << c.column () << ":"
+ << " error: no persistent data members in the class" << endl;
+ valid_ = false;
+ }
}
bool& valid_;
tree has_lt_operator_;
- data_member1 member_;
+ data_member2 member_;
traversal::names names_;
};
}