diff options
Diffstat (limited to 'odb/context.cxx')
-rw-r--r-- | odb/context.cxx | 99 |
1 files changed, 85 insertions, 14 deletions
diff --git a/odb/context.cxx b/odb/context.cxx index 39a01f7..3b684ea 100644 --- a/odb/context.cxx +++ b/odb/context.cxx @@ -325,10 +325,45 @@ column_options (semantics::data_member& m) // semantics::type& t (m.type ()); - string mo (m.get<string> ("options", string ())); - string to (t.get<string> ("options", string ())); + string r; + + if (t.count ("options")) + { + strings const& o (t.get<strings> ("options")); + + for (strings::const_iterator i (o.begin ()); i != o.end (); ++i) + { + if (i->empty ()) + r.clear (); + else + { + if (!r.empty ()) + r += ' '; + + r += *i; + } + } + } - return to + (mo.empty () || to.empty () ? "" : " ") + mo; + if (m.count ("options")) + { + strings const& o (m.get<strings> ("options")); + + for (strings::const_iterator i (o.begin ()); i != o.end (); ++i) + { + if (i->empty ()) + r.clear (); + else + { + if (!r.empty ()) + r += ' '; + + r += *i; + } + } + } + + return r; } string context:: @@ -344,24 +379,60 @@ column_options (semantics::data_member& m, string const& kp) semantics::type& c (m.type ()); semantics::type& t (member_type (m, kp)); - string r (t.get<string> ("options", string ())); + string r; - string o (c.get<string> (k, string ())); - if (!o.empty ()) + if (t.count ("options")) { - if (!r.empty ()) - r += ' '; + strings const& o (t.get<strings> ("options")); - r += o; + for (strings::const_iterator i (o.begin ()); i != o.end (); ++i) + { + if (i->empty ()) + r.clear (); + else + { + if (!r.empty ()) + r += ' '; + + r += *i; + } + } + } + + if (c.count (k)) + { + strings const& o (c.get<strings> (k)); + + for (strings::const_iterator i (o.begin ()); i != o.end (); ++i) + { + if (i->empty ()) + r.clear (); + else + { + if (!r.empty ()) + r += ' '; + + r += *i; + } + } } - o = m.get<string> (k, string ()); - if (!o.empty ()) + if (m.count (k)) { - if (!r.empty ()) - r += ' '; + strings const& o (m.get<strings> (k)); - r += o; + for (strings::const_iterator i (o.begin ()); i != o.end (); ++i) + { + if (i->empty ()) + r.clear (); + else + { + if (!r.empty ()) + r += ' '; + + r += *i; + } + } } return r; |