diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-10-19 10:47:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-10-21 19:25:06 +0200 |
commit | 6bd95f51beb26d87fd5d5db22391c73f333eee6e (patch) | |
tree | 59621cec994f55fce7a1ced5c3b9edb93a41b084 /odb/relational/header.hxx | |
parent | 7623fb5259da19c33ffe6623b0f306f6c39ede27 (diff) |
Add support for const data members
Const data members are automatically treated as readonly. New test:
const-member.
Diffstat (limited to 'odb/relational/header.hxx')
-rw-r--r-- | odb/relational/header.hxx | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/odb/relational/header.hxx b/odb/relational/header.hxx index 7190e49..7c74d09 100644 --- a/odb/relational/header.hxx +++ b/odb/relational/header.hxx @@ -523,16 +523,24 @@ namespace relational os << "typedef "; { - semantics::type& t (m.type ()); + semantics::names* hint; + semantics::type& t (utype (m, hint)); - if (wrapper (t)) - // Use the hint from the wrapper. + if (semantics::type* wt = wrapper (t)) + { + // Use the hint from the wrapper unless the wrapped type is + // qualified. In this case use the hint for the unqualified + // type. // - os << c.fq_name (t.get<semantics::names*> ("wrapper-hint")); + hint = t.get<semantics::names*> ("wrapper-hint"); + utype (*wt, hint); + + os << c.fq_name (hint); + } else // t and c are the same. // - os << c.fq_name (m.belongs ().hint ()); + os << t.fq_name (hint); } os << " container_type;"; @@ -986,10 +994,13 @@ namespace relational } else { - os << "typedef " << id->type ().fq_name (id->belongs ().hint ()) << - " id_type;" - << endl - << "static const bool auto_id = " << + semantics::names* hint; + semantics::type& t (utype (*id, hint)); + + os << "typedef " << t.fq_name (hint) << " id_type;" + << endl; + + os << "static const bool auto_id = " << (auto_id ? "true" : "false") << ";" << endl; |