From 3f8c237b1abe02df8147170f2fc037edc3f384db Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Jan 2010 14:49:11 +0200 Subject: Add support for default/fixed values of QName type --- xsd/cxx/tree/tree-source.cxx | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'xsd/cxx/tree/tree-source.cxx') diff --git a/xsd/cxx/tree/tree-source.cxx b/xsd/cxx/tree/tree-source.cxx index 49a846c..4a94520 100644 --- a/xsd/cxx/tree/tree-source.cxx +++ b/xsd/cxx/tree/tree-source.cxx @@ -557,7 +557,7 @@ namespace CXX // default_value // - if (m.default_ () && !is_qname (m.type ())) + if (m.default_ ()) { SemanticGraph::Type& t (m.type ()); Boolean simple (true); @@ -1190,31 +1190,8 @@ namespace CXX if (a.default_ ()) { - Boolean fund (false); - { - IsFundamentalType traverser (fund); - traverser.dispatch (a.type ()); - } - - String const& tr (etraits (a)); // traits type name - - if (fund || !is_qname (a.type ())) - { - os << "this->" << member << ".set (" << - edefault_value (a) << " ());"; - } - else - { - // Parse the default value in the context of the element. - // - os << "::std::auto_ptr< " << etype (a) << " > r (" << endl - << tr << "::create (" << endl - << string_type << " (" << L << strlit (a.value ()) << - ")," << endl - << "&p.element (), f, this));" - << endl - << "this->" << member << ".set (r);"; - } + os << "this->" << member << ".set (" << + edefault_value (a) << " ());"; } else os << "throw ::xsd::cxx::tree::expected_attribute< " << @@ -1330,7 +1307,7 @@ namespace CXX // Note that we are not including attributes with default // or required fixed values here. // - if (min (a) == 1 && !(a.fixed () && !is_qname (a.type ()))) + if (min (a) == 1 && !a.fixed ()) { // one // @@ -1407,7 +1384,7 @@ namespace CXX { String const& member (emember (a)); - Boolean def (a.default_ () && !is_qname (a.type ())); + Boolean def (a.default_ ()); if (min (a) == 0 && !def) { @@ -1643,7 +1620,7 @@ namespace CXX { String const& member (emember (a)); - if (a.default_ () && !is_qname (a.type ())) + if (a.default_ ()) { // This is an attribute with default or fixed value. We are // going to initialize it to its default value. -- cgit v1.1