aboutsummaryrefslogtreecommitdiff
path: root/xsd/cxx/tree/elements.cxx
diff options
context:
space:
mode:
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::