From 2ca7acef7c858fb7f21b5101dedfc021aea62ff8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 22 Jun 2015 17:12:20 +0200 Subject: Get rid of member_[u]type(), other cleanups --- odb/context.cxx | 66 ++++++++++++++++++++++++++------------------------------- 1 file changed, 30 insertions(+), 36 deletions(-) (limited to 'odb/context.cxx') diff --git a/odb/context.cxx b/odb/context.cxx index dc94abc..737138a 100644 --- a/odb/context.cxx +++ b/odb/context.cxx @@ -946,8 +946,7 @@ null (semantics::data_member& m, string const& kp) const return null (m); semantics::type& c (utype (m)); - semantics::type& t (member_utype (m, kp)); - semantics::names* hint (0); // No hint for container elements. + semantics::type& t (utype (m, kp)); if (object_pointer (t)) { @@ -1005,8 +1004,7 @@ null (semantics::data_member& m, string const& kp) const // Otherwise, check the wrapped type. // pt = t.get ("wrapper-type"); - hint = t.get ("wrapper-hint"); - pt = &utype (*pt, hint); + pt = &utype (*pt); if (pt->count ("null")) return true; @@ -1167,20 +1165,40 @@ utype (semantics::type& t, semantics::names*& hint) } semantics::type& context:: -utype (semantics::data_member& m, semantics::names*& hint) +utype (semantics::data_member& m, semantics::names*& hint, string const& kp) { - semantics::type& t (m.type ()); + semantics::type* t (0); - if (semantics::qualifier* q = dynamic_cast (&t)) + if (kp.empty ()) { - hint = q->qualifies ().hint (); - return q->base_type (); + t = &m.type (); + + if (semantics::qualifier* q = dynamic_cast (t)) + { + hint = q->qualifies ().hint (); + t = &q->base_type (); + } + else + hint = m.belongs ().hint (); } else { - hint = m.belongs ().hint (); - return t; + if (m.count (kp + "-tree-type")) + t = indirect_type (m, kp, hint); + else + { + t = &utype (m); + + // "See through" wrappers. + // + if (semantics::type* wt = wrapper (*t)) + t = indirect_type (utype (*wt), kp, hint); + else + t = indirect_type (*t, kp, hint); + } } + + return *t; } bool context:: @@ -1192,30 +1210,6 @@ const_type (semantics::type& t) return false; } -semantics::type& context:: -member_type (semantics::data_member& m, string const& key_prefix) -{ - // This function returns the potentially-qualified type but for - // intermediate types we use unqualified versions. - // - if (key_prefix.empty ()) - return m.type (); - - string const key (key_prefix + "-tree-type"); - - if (m.count (key)) - return *indirect_value (m, key); - - // "See throught" wrappers. - // - semantics::type& t (utype (m)); - - if (semantics::type* wt = wrapper (t)) - return *indirect_value (utype (*wt), key); - else - return *indirect_value (t, key); -} - string context:: type_ref_type (semantics::type& t, semantics::names* hint, @@ -1969,7 +1963,7 @@ column_options (semantics::data_member& m, string const& kp) // Accumulate options from type, container, and member. // semantics::type& c (utype (m)); - semantics::type& t (member_utype (m, kp)); + semantics::type& t (utype (m, kp)); string r; -- cgit v1.1