summaryrefslogtreecommitdiff
path: root/xsd/cxx/tree/elements.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-12-15 13:09:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-12-15 13:09:25 +0200
commit4c408a85759eb42b6b84b8cdab81453df31cd289 (patch)
tree468d7a871442a8dcf98e475bc837d5c15c3a632e /xsd/cxx/tree/elements.cxx
parent9d8b6cd9492deff6747649e0c87f3b7df51b9965 (diff)
Register substituting anonymous types with polymorphic maps
Diffstat (limited to 'xsd/cxx/tree/elements.cxx')
-rw-r--r--xsd/cxx/tree/elements.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/xsd/cxx/tree/elements.cxx b/xsd/cxx/tree/elements.cxx
index 3c59e6a..0b69fff 100644
--- a/xsd/cxx/tree/elements.cxx
+++ b/xsd/cxx/tree/elements.cxx
@@ -622,6 +622,32 @@ namespace CXX
return t.context ().get<Boolean> ("polymorphic");
}
+ Boolean Context::
+ anonymous_substitutes_p (SemanticGraph::Type& t)
+ {
+ // ID/IDREF templates cannot match.
+ //
+ if (!t.named_p () &&
+ (t.is_a<SemanticGraph::Fundamental::Id> () ||
+ t.is_a<SemanticGraph::Fundamental::IdRef> ()))
+ return false;
+
+ // See which elements this type classifies.
+ //
+ for (SemanticGraph::Type::ClassifiesIterator i (t.classifies_begin ()),
+ e (t.classifies_end ()); i != e; ++i)
+ {
+ if (SemanticGraph::Element* e =
+ dynamic_cast<SemanticGraph::Element*> (&i->instance ()))
+ {
+ if (e->substitutes_p ())
+ return true;
+ }
+ }
+
+ return false;
+ }
+
// GenerateDefautCtor
//
GenerateDefaultCtor::