From e4f4f0bed9befbde2117af6f128d9323be3f1638 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 3 Mar 2010 19:21:50 +0200 Subject: Add union information to the semantics graph New test: union. --- xsd-frontend/semantic-graph/elements.hxx | 55 +++++++++++++++++++++++++++++--- xsd-frontend/semantic-graph/union.cxx | 2 +- xsd-frontend/semantic-graph/union.hxx | 2 +- 3 files changed, 52 insertions(+), 7 deletions(-) (limited to 'xsd-frontend/semantic-graph') diff --git a/xsd-frontend/semantic-graph/elements.hxx b/xsd-frontend/semantic-graph/elements.hxx index 58779fa..3d8991e 100644 --- a/xsd-frontend/semantic-graph/elements.hxx +++ b/xsd-frontend/semantic-graph/elements.hxx @@ -1081,26 +1081,71 @@ namespace XSDFrontend class Specialization: public virtual Type { + typedef + Cult::Containers::Vector + Argumented; + public: + typedef + Bits::PointerIterator + ArgumentedIterator; + + typedef + Bits::PointerIterator + ArgumentedConstIterator; + + ArgumentedIterator + argumented_begin () + { + return argumented_.begin (); + } + + ArgumentedConstIterator + argumented_begin () const + { + return argumented_.begin (); + } + + ArgumentedIterator + argumented_end () + { + return argumented_.end (); + } + + ArgumentedConstIterator + argumented_end () const + { + return argumented_.end (); + } + + // Shortcut for one-argument specializations. + // Arguments& argumented () const { - return *argumented_; + return *argumented_[0]; } protected: friend class Bits::Graph; - void + using Type::add_edge_right; + + Void add_edge_right (Arguments& a) { - argumented_ = &a; + argumented_.push_back (&a); } - using Type::add_edge_right; + public: + Void + add_edge_right (Arguments& a, ArgumentedIterator const& pos) + { + argumented_.insert (pos.base (), &a); + } private: - Arguments* argumented_; + Argumented argumented_; }; diff --git a/xsd-frontend/semantic-graph/union.cxx b/xsd-frontend/semantic-graph/union.cxx index 44f2ed3..b4b4cf0 100644 --- a/xsd-frontend/semantic-graph/union.cxx +++ b/xsd-frontend/semantic-graph/union.cxx @@ -21,7 +21,7 @@ namespace XSDFrontend UnionInit () { TypeInfo ti (typeid (Union)); - ti.add_base (Access::public_, true, typeid (Type)); + ti.add_base (Access::public_, true, typeid (Specialization)); RTTI::insert (ti); } diff --git a/xsd-frontend/semantic-graph/union.hxx b/xsd-frontend/semantic-graph/union.hxx index 42115d6..62df730 100644 --- a/xsd-frontend/semantic-graph/union.hxx +++ b/xsd-frontend/semantic-graph/union.hxx @@ -12,7 +12,7 @@ namespace XSDFrontend { namespace SemanticGraph { - class Union: public virtual Type + class Union: public virtual Specialization { protected: friend class Bits::Graph; -- cgit v1.1