aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-08-21 09:26:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-08-21 09:26:29 +0200
commit6e2325337ff31a3b3c5b2ab2e74352e1765d2daa (patch)
tree2177aa7ac22551e3fa467f249e270d37ca776897
parent8d066b8a07f45c517b6f8256eb4e4adbff3709a4 (diff)
Use different suffix for composite values in query columns
This avoids potential name clash between the class name and its members (both of which, before this fix, had the _type_ suffix).
-rw-r--r--odb/common-query.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/odb/common-query.cxx b/odb/common-query.cxx
index 14d438c..26b4c8c 100644
--- a/odb/common-query.cxx
+++ b/odb/common-query.cxx
@@ -29,7 +29,7 @@ struct query_nested_types: object_columns_base, virtual context
if (m != 0)
{
string name (prefix_ + public_name (*m));
- name += in_ptr_ ? "_column_type_" : "_type_";
+ name += in_ptr_ ? "_column_class_" : "_class_";
types.push_back (name);
string p (prefix_);
@@ -486,8 +486,11 @@ traverse_composite (semantics::data_member* m, semantics::class_& c)
return;
}
+ // Use _class_ instead of _type_ to avoid potential clashes between
+ // the class and member names.
+ //
string name (public_name (*m));
- string suffix (in_ptr_ ? "_column_type_" : "_type_");
+ string suffix (in_ptr_ ? "_column_class_" : "_class_");
if (decl_)
{
@@ -525,7 +528,7 @@ traverse_composite (semantics::data_member* m, semantics::class_& c)
os << "};";
if (!in_ptr_)
- os << "static " << const_ << name << "_type_ " << name << ";"
+ os << "static " << const_ << name << "_class_ " << name << ";"
<< endl;
}
else
@@ -545,7 +548,8 @@ traverse_composite (semantics::data_member* m, semantics::class_& c)
tmpl += "< " + fq_name_ + ", id_" + db.string () + ", A >" + scope_;
os << "template <typename A>" << endl
- << const_ << "typename " << tmpl << "::" << name << "_type_" << endl
+ << const_ << "typename " << tmpl << "::" << name <<
+ (in_ptr_ ? "_type_" : "_class_") << endl
<< tmpl << "::" << name << ";"
<< endl;
}
@@ -667,7 +671,7 @@ traverse_pointer (semantics::data_member& m, semantics::class_& c)
<< endl;
os << "struct " << name << "_type_: " <<
- name << "_pointer_type_, " << name << "_column_type_"
+ name << "_pointer_type_, " << name << "_column_class_"
<< "{";
if (!const_.empty ())