diff options
Diffstat (limited to 'xsde/cxx/serializer/serializer-header.cxx')
-rw-r--r-- | xsde/cxx/serializer/serializer-header.cxx | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/xsde/cxx/serializer/serializer-header.cxx b/xsde/cxx/serializer/serializer-header.cxx index 29b01a2..5459b51 100644 --- a/xsde/cxx/serializer/serializer-header.cxx +++ b/xsde/cxx/serializer/serializer-header.cxx @@ -1030,6 +1030,35 @@ namespace CXX names (c, names_test); } + Boolean facets (false); // Defines facets. + if (validation && restriction) + { + SemanticGraph::Type& ub (ultimate_base (c)); + + if (ub.is_a<SemanticGraph::Fundamental::Short> () || + ub.is_a<SemanticGraph::Fundamental::UnsignedByte> () || + ub.is_a<SemanticGraph::Fundamental::UnsignedShort> () || + ub.is_a<SemanticGraph::Fundamental::UnsignedInt> () || + ub.is_a<SemanticGraph::Fundamental::String> ()) + { + using SemanticGraph::Restricts; + Restricts& r (dynamic_cast<Restricts&> (c.inherits ())); + + if (!r.facet_empty ()) + { + Restricts::FacetIterator end (r.facet_end ()); + facets = + r.facet_find (L"length") != end || + r.facet_find (L"minLength") != end || + r.facet_find (L"maxLength") != end || + r.facet_find (L"minInclusive") != end || + r.facet_find (L"minExclusive") != end || + r.facet_find (L"maxInclusive") != end || + r.facet_find (L"maxExclusive") != end; + } + } + } + // // os << "class " << name << ": public "; @@ -1148,7 +1177,7 @@ namespace CXX // Default c-tor. // - if (tiein || (!restriction && (he || ha))) + if (tiein || facets || (!restriction && (he || ha))) { os << "// Constructor." << endl << "//" << endl; |