diff options
Diffstat (limited to 'libxsd-frontend/xsd-frontend/traversal')
31 files changed, 2092 insertions, 0 deletions
| diff --git a/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx b/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx new file mode 100644 index 0000000..50655dd --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx @@ -0,0 +1,21 @@ +// file      : xsd-frontend/traversal/any-attribute.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_ANY_ATTRIBUTE_HXX +#define XSD_FRONTEND_TRAVERSAL_ANY_ATTRIBUTE_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/any-attribute.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    typedef +    Node<SemanticGraph::AnyAttribute> +    AnyAttribute; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_ANY_ATTRIBUTE_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/any.hxx b/libxsd-frontend/xsd-frontend/traversal/any.hxx new file mode 100644 index 0000000..85a320d --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/any.hxx @@ -0,0 +1,21 @@ +// file      : xsd-frontend/traversal/any.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_ANY_HXX +#define XSD_FRONTEND_TRAVERSAL_ANY_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/any.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    typedef +    Node<SemanticGraph::Any> +    Any; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_ANY_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx b/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx new file mode 100644 index 0000000..a40afd7 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx @@ -0,0 +1,29 @@ +// file      : xsd-frontend/traversal/attribute-group.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/attribute-group.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    void AttributeGroup:: +    traverse (Type& g) +    { +      pre (g); +      names (g); +      post (g); +    } + +    void AttributeGroup:: +    pre (Type&) +    { +    } + +    void AttributeGroup:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx b/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx new file mode 100644 index 0000000..03fee14 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx @@ -0,0 +1,29 @@ +// file      : xsd-frontend/traversal/attribute-group.hxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_GROUP_HXX +#define XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_GROUP_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/attribute-group.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct AttributeGroup: ScopeTemplate<SemanticGraph::AttributeGroup> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_GROUP_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute.cxx b/libxsd-frontend/xsd-frontend/traversal/attribute.cxx new file mode 100644 index 0000000..e61eeb2 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/attribute.cxx @@ -0,0 +1,47 @@ +// file      : xsd-frontend/traversal/attribute.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/attribute.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    void Attribute:: +    traverse (Type& a) +    { +      pre (a); +      belongs (a); +      name (a); +      post (a); +    } + +    void Attribute:: +    pre (Type&) +    { +    } + +    void Attribute:: +    belongs (Type& a, EdgeDispatcher& d) +    { +      d.dispatch (a.belongs ()); +    } + +    void Attribute:: +    belongs (Type& a) +    { +      belongs (a, *this); +    } + +    void Attribute:: +    name (Type&) +    { +    } + +    void Attribute:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute.hxx b/libxsd-frontend/xsd-frontend/traversal/attribute.hxx new file mode 100644 index 0000000..f3962e4 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/attribute.hxx @@ -0,0 +1,40 @@ +// file      : xsd-frontend/traversal/attribute.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_HXX +#define XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_HXX + +#include <xsd-frontend/traversal/elements.hxx> + +#include <xsd-frontend/semantic-graph/attribute.hxx> + + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct Attribute : Node<SemanticGraph::Attribute> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      belongs (Type&, EdgeDispatcher&); + +      virtual void +      belongs (Type&); + +      virtual void +      name (Type&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/complex.cxx b/libxsd-frontend/xsd-frontend/traversal/complex.cxx new file mode 100644 index 0000000..6e936ab --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/complex.cxx @@ -0,0 +1,63 @@ +// file      : xsd-frontend/traversal/complex.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/complex.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    void Complex:: +    traverse (Type& c) +    { +      pre (c); +      name (c); +      inherits (c); +      names (c); +      contains_compositor (c); +      post (c); +    } + +    void Complex:: +    pre (Type&) +    { +    } + +    void Complex:: +    name (Type&) +    { +    } + +    void Complex:: +    inherits (Type& c) +    { +      inherits (c, *this); +    } + +    void Complex:: +    inherits (Type& c, EdgeDispatcher& d) +    { +      if (c.inherits_p ()) +        d.dispatch (c.inherits ()); +    } + +    void Complex:: +    contains_compositor (Type& c) +    { +      contains_compositor (c, *this); +    } + +    void Complex:: +    contains_compositor (Type& c, EdgeDispatcher& d) +    { +      if (c.contains_compositor_p ()) +        d.dispatch (c.contains_compositor ()); +    } + +    void Complex:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/complex.hxx b/libxsd-frontend/xsd-frontend/traversal/complex.hxx new file mode 100644 index 0000000..1f55730 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/complex.hxx @@ -0,0 +1,44 @@ +// file      : xsd-frontend/traversal/complex.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_COMPLEX_HXX +#define XSD_FRONTEND_TRAVERSAL_COMPLEX_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/complex.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct Complex : ScopeTemplate<SemanticGraph::Complex> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      name (Type&); + +      virtual void +      inherits (Type&); + +      void +      inherits (Type&, EdgeDispatcher&); + +      virtual void +      contains_compositor (Type&); + +      void +      contains_compositor (Type&, EdgeDispatcher&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_COMPLEX_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/compositors.cxx b/libxsd-frontend/xsd-frontend/traversal/compositors.cxx new file mode 100644 index 0000000..f2b3dcd --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/compositors.cxx @@ -0,0 +1,164 @@ +// file      : xsd-frontend/traversal/compositors.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/compositors.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    // ContainsParticle +    // +    void ContainsParticle:: +    traverse (Type& c) +    { +      dispatch (c.particle ()); +    } + + +    // ContainsCompositor +    // +    void ContainsCompositor:: +    traverse (Type& c) +    { +      dispatch (c.compositor ()); +    } + + +    // Compositor +    // +    void Compositor:: +    traverse (Type& c) +    { +      pre (c); +      contains (c); +      post (c); +    } + +    void Compositor:: +    pre (Type&) +    { +    } + +    void Compositor:: +    contains (Type& c) +    { +      iterate_and_dispatch ( +        c.contains_begin (), c.contains_end (), edge_traverser ()); +    } + +    void Compositor:: +    contains (Type& c, EdgeDispatcher& d) +    { +      iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); +    } + +    void Compositor:: +    post (Type&) +    { +    } + + +    // All +    // +    void All:: +    traverse (Type& c) +    { +      pre (c); +      contains (c); +      post (c); +    } + +    void All:: +    pre (Type&) +    { +    } + +    void All:: +    contains (Type& c) +    { +      iterate_and_dispatch ( +        c.contains_begin (), c.contains_end (), edge_traverser ()); +    } + +    void All:: +    contains (Type& c, EdgeDispatcher& d) +    { +      iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); +    } + +    void All:: +    post (Type&) +    { +    } + + +    // Choice +    // +    void Choice:: +    traverse (Type& c) +    { +      pre (c); +      contains (c); +      post (c); +    } + +    void Choice:: +    pre (Type&) +    { +    } + +    void Choice:: +    contains (Type& c) +    { +      iterate_and_dispatch ( +        c.contains_begin (), c.contains_end (), edge_traverser ()); +    } + +    void Choice:: +    contains (Type& c, EdgeDispatcher& d) +    { +      iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); +    } + +    void Choice:: +    post (Type&) +    { +    } + + +    // Sequence +    // +    void Sequence:: +    traverse (Type& c) +    { +      pre (c); +      contains (c); +      post (c); +    } + +    void Sequence:: +    pre (Type&) +    { +    } + +    void Sequence:: +    contains (Type& c) +    { +      iterate_and_dispatch ( +        c.contains_begin (), c.contains_end (), edge_traverser ()); +    } + +    void Sequence:: +    contains (Type& c, EdgeDispatcher& d) +    { +      iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); +    } + +    void Sequence:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/compositors.hxx b/libxsd-frontend/xsd-frontend/traversal/compositors.hxx new file mode 100644 index 0000000..4761b99 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/compositors.hxx @@ -0,0 +1,135 @@ +// file      : xsd-frontend/traversal/compositors.hxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_COMPOSITORS_HXX +#define XSD_FRONTEND_TRAVERSAL_COMPOSITORS_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/compositors.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    // +    // +    struct ContainsParticle: Edge<SemanticGraph::ContainsParticle> +    { +      ContainsParticle () +      { +      } + +      ContainsParticle (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type&); +    }; + + +    // +    // +    struct ContainsCompositor: Edge<SemanticGraph::ContainsCompositor> +    { +      ContainsCompositor () +      { +      } + +      ContainsCompositor (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type&); +    }; + +    // +    // +    struct Compositor : Node<SemanticGraph::Compositor> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      contains (Type&); + +      virtual void +      contains (Type&, EdgeDispatcher&); + +      virtual void +      post (Type&); +    }; + + +    // +    // +    struct All : Node<SemanticGraph::All> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      contains (Type&); + +      virtual void +      contains (Type&, EdgeDispatcher&); + +      virtual void +      post (Type&); +    }; + + +    // +    // +    struct Choice : Node<SemanticGraph::Choice> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      contains (Type&); + +      virtual void +      contains (Type&, EdgeDispatcher&); + +      virtual void +      post (Type&); +    }; + + +    // +    // +    struct Sequence : Node<SemanticGraph::Sequence> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      contains (Type&); + +      virtual void +      contains (Type&, EdgeDispatcher&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_COMPOSITORS_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/element-group.cxx b/libxsd-frontend/xsd-frontend/traversal/element-group.cxx new file mode 100644 index 0000000..0b253dd --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/element-group.cxx @@ -0,0 +1,42 @@ +// file      : xsd-frontend/traversal/element-group.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/element-group.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    void ElementGroup:: +    traverse (Type& g) +    { +      pre (g); +      names (g); +      contains_compositor (g); +      post (g); +    } + +    void ElementGroup:: +    pre (Type&) +    { +    } + +    void ElementGroup:: +    contains_compositor (Type& g, EdgeDispatcher& d) +    { +      d.dispatch (g.contains_compositor ()); +    } + +    void ElementGroup:: +    contains_compositor (Type& g) +    { +      contains_compositor (g, *this); +    } + +    void ElementGroup:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/element-group.hxx b/libxsd-frontend/xsd-frontend/traversal/element-group.hxx new file mode 100644 index 0000000..df13b26 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/element-group.hxx @@ -0,0 +1,35 @@ +// file      : xsd-frontend/traversal/element-group.hxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_ELEMENT_GROUP_HXX +#define XSD_FRONTEND_TRAVERSAL_ELEMENT_GROUP_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/element-group.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct ElementGroup: ScopeTemplate<SemanticGraph::ElementGroup> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      contains_compositor (Type&); + +      virtual void +      contains_compositor (Type&, EdgeDispatcher&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_ELEMENT_GROUP_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/element.cxx b/libxsd-frontend/xsd-frontend/traversal/element.cxx new file mode 100644 index 0000000..efdb0a6 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/element.cxx @@ -0,0 +1,47 @@ +// file      : xsd-frontend/traversal/element.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/element.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    void Element:: +    traverse (Type& m) +    { +      pre (m); +      belongs (m); +      name (m); +      post (m); +    } + +    void Element:: +    pre (Type&) +    { +    } + +    void Element:: +    belongs (Type& m, EdgeDispatcher& d) +    { +      d.dispatch (m.belongs ()); +    } + +    void Element:: +    belongs (Type& m) +    { +      belongs (m, edge_traverser ()); +    } + +    void Element:: +    name (Type&) +    { +    } + +    void Element:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/element.hxx b/libxsd-frontend/xsd-frontend/traversal/element.hxx new file mode 100644 index 0000000..e1af29a --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/element.hxx @@ -0,0 +1,38 @@ +// file      : xsd-frontend/traversal/element.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_ELEMENT_HXX +#define XSD_FRONTEND_TRAVERSAL_ELEMENT_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/element.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct Element : Node<SemanticGraph::Element> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      belongs (Type&, EdgeDispatcher&); + +      virtual void +      belongs (Type&); + +      virtual void +      name (Type&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_ELEMENT_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.cxx b/libxsd-frontend/xsd-frontend/traversal/elements.cxx new file mode 100644 index 0000000..e64e3b9 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/elements.cxx @@ -0,0 +1,76 @@ +// file      : xsd-frontend/traversal/elements.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/elements.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    // Instance +    // +    void Instance:: +    traverse (Type& a) +    { +      pre (a); +      belongs (a); +      post (a); +    } + +    void Instance:: +    pre (Type&) +    { +    } + +    void Instance:: +    belongs (Type& a, EdgeDispatcher& d) +    { +      d.dispatch (a.belongs ()); +    } + +    void Instance:: +    belongs (Type& a) +    { +      belongs (a, edge_traverser ()); +    } + +    void Instance:: +    post (Type&) +    { +    } + + +    // Member +    // +    void Member:: +    traverse (Type& a) +    { +      pre (a); +      belongs (a); +      post (a); +    } + +    void Member:: +    pre (Type&) +    { +    } + +    void Member:: +    belongs (Type& a, EdgeDispatcher& d) +    { +      d.dispatch (a.belongs ()); +    } + +    void Member:: +    belongs (Type& a) +    { +      belongs (a, edge_traverser ()); +    } + +    void Member:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.hxx b/libxsd-frontend/xsd-frontend/traversal/elements.hxx new file mode 100644 index 0000000..bd1dd70 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/elements.hxx @@ -0,0 +1,411 @@ +// file      : xsd-frontend/traversal/elements.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_ELEMENTS_HXX +#define XSD_FRONTEND_TRAVERSAL_ELEMENTS_HXX + +#include <cutl/compiler/traversal.hxx> + +#include <xsd-frontend/types.hxx> +#include <xsd-frontend/semantic-graph/elements.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    using namespace cutl; + +    typedef compiler::dispatcher<SemanticGraph::Node> NodeDispatcher; +    typedef compiler::dispatcher<SemanticGraph::Edge> EdgeDispatcher; + +    // +    // +    struct NodeBase: NodeDispatcher, EdgeDispatcher +    { +      void +      edge_traverser (EdgeDispatcher& d) +      { +        EdgeDispatcher::traverser (d); +      } + +      EdgeDispatcher& +      edge_traverser () +      { +        return *this; +      } + +      using NodeDispatcher::dispatch; +      using EdgeDispatcher::dispatch; + +      using EdgeDispatcher::iterate_and_dispatch; +    }; + +    struct EdgeBase: EdgeDispatcher, NodeDispatcher +    { +      void +      node_traverser (NodeDispatcher& d) +      { +        NodeDispatcher::traverser (d); +      } + +      NodeDispatcher& +      node_traverser () +      { +        return *this; +      } + +      using EdgeDispatcher::dispatch; +      using NodeDispatcher::dispatch; + +      using NodeDispatcher::iterate_and_dispatch; +    }; + +    inline EdgeBase& +    operator>> (NodeBase& n, EdgeBase& e) +    { +      n.edge_traverser (e); +      return e; +    } + +    inline NodeBase& +    operator>> (EdgeBase& e, NodeBase& n) +    { +      e.node_traverser (n); +      return n; +    } + +    // +    // +    template <typename T> +    struct Node: compiler::traverser_impl<T, SemanticGraph::Node>, +                 virtual NodeBase +    { +      typedef T Type; +    }; + +    template <typename T> +    struct Edge: compiler::traverser_impl<T, SemanticGraph::Edge>, +                 virtual EdgeBase +    { +      typedef T Type; +    }; + +    // +    // Edges +    // + +    // +    // +    struct Names : Edge<SemanticGraph::Names> +    { +      Names () +      { +      } + +      Names (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.named ()); +      } +    }; + + +    // +    // +    struct Belongs : Edge<SemanticGraph::Belongs> +    { +      Belongs () +      { +      } + +      Belongs (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.type ()); +      } +    }; + +    // +    // Nodes +    // + +    // +    // +    struct Nameable : Node<SemanticGraph::Nameable> +    { +    }; + + +    // +    // +    template <typename T> +    struct ScopeTemplate : Node<T> +    { +    public: +      virtual void +      traverse (T& s) +      { +        names (s); +      } + +      template<typename X> +      void +      names (T& s, +             EdgeDispatcher& d, +             void (X::*pre_) (T&) = (void (ScopeTemplate<T>::*)(T&)) (0), +             void (X::*post_) (T&) = (void (ScopeTemplate<T>::*)(T&)) (0), +             void (X::*none_) (T&) = (void (ScopeTemplate<T>::*)(T&)) (0), +             void (X::*next_) (T&) = (void (ScopeTemplate<T>::*)(T&)) (0)) +      { +        X* this_ (dynamic_cast<X*> (this)); + +        typename T::NamesIterator b (s.names_begin ()), e (s.names_end ()); + +        if (b != e) +        { +          if (pre_) +            (this_->*pre_) (s); + +          //iterate_and_dispatch (b, e, d, *this_, next_, s); + +          for (; b != s.names_end ();) +          { +            d.dispatch (*b); + +            if (++b != s.names_end () && next_ != 0) +              (this_->*next_) (s); +          } + +          if (post_) +            (this_->*post_) (s); +        } +        else +        { +          if (none_) +            (this_->*none_) (s); +        } +      } + +      virtual void +      names (T& s, EdgeDispatcher& d) +      { +        names<ScopeTemplate<T> > (s, d); +      } + +      virtual void +      names (T& s) +      { +        names (s, +               *this, +               &ScopeTemplate<T>::names_pre, +               &ScopeTemplate<T>::names_post, +               &ScopeTemplate<T>::names_none, +               &ScopeTemplate<T>::names_next); +      } + +      virtual void +      names_pre (T&) +      { +      } + +      virtual void +      names_next (T&) +      { +      } + +      virtual void +      names_post (T&) +      { +      } + +      virtual void +      names_none (T&) +      { +      } +    }; + + +    // +    // +    typedef +    ScopeTemplate<SemanticGraph::Scope> +    Scope; + + +    // +    // +    struct Type : Node<SemanticGraph::Type> +    { +      virtual void +      traverse (SemanticGraph::Type&) = 0; +    }; + + +    // +    // +    struct Instance : Node<SemanticGraph::Instance> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      belongs (Type&, EdgeDispatcher&); + +      virtual void +      belongs (Type&); + +      virtual void +      post (Type&); +    }; + + +    // +    // +    struct Member : Node<SemanticGraph::Member> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      belongs (Type&, EdgeDispatcher&); + +      virtual void +      belongs (Type&); + +      virtual void +      post (Type&); +    }; + + +    // +    // +    struct Inherits : Edge<SemanticGraph::Inherits> +    { +      Inherits () +      { +      } + +      Inherits (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.base ()); +      } +    }; + + +    // +    // +    struct Extends : Edge<SemanticGraph::Extends> +    { +      Extends () +      { +      } + +      Extends (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.base ()); +      } +    }; + + +    // +    // +    struct Restricts : Edge<SemanticGraph::Restricts> +    { +      Restricts () +      { +      } + +      Restricts (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.base ()); +      } +    }; + + +    // +    // +    struct Argumented : Edge<SemanticGraph::Arguments> +    { +      Argumented () +      { +      } + +      Argumented (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& a) +      { +        dispatch (a.type ()); +      } +    }; + + +    /* +    // +    // +    struct Contains : Edge<SemanticGraph::Contains> +    { +      virtual void +      traverse (Type& e) +      { +        dispatch (e.element ()); +      } +    }; +    */ + +    // +    // +    typedef +    Node<SemanticGraph::AnyType> +    AnyType; + + +    // +    // +    typedef +    Node<SemanticGraph::AnySimpleType> +    AnySimpleType; +  } +} + +#include <xsd-frontend/traversal/elements.txx> + +#endif  // XSD_FRONTEND_TRAVERSAL_ELEMENTS_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.txx b/libxsd-frontend/xsd-frontend/traversal/elements.txx new file mode 100644 index 0000000..5b1aec0 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/elements.txx @@ -0,0 +1,10 @@ +// file      : xsd-frontend/traversal/elements.txx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +namespace XSDFrontend +{ +  namespace Traversal +  { +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx b/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx new file mode 100644 index 0000000..124606f --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx @@ -0,0 +1,90 @@ +// file      : xsd-frontend/traversal/enumeration.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/enumeration.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    // Enumeration +    // +    void Enumeration:: +    traverse (Type& e) +    { +      pre (e); +      name (e); +      inherits (e); +      names (e); +      post (e); +    } + +    void Enumeration:: +    pre (Type&) +    { +    } + +    void Enumeration:: +    name (Type&) +    { +    } + +    void Enumeration:: +    inherits (Type& e) +    { +      inherits (e, *this); +    } + +    void Enumeration:: +    inherits (Type& e, EdgeDispatcher& d) +    { +      if (e.inherits_p ()) +        d.dispatch (e.inherits ()); +    } + +    void Enumeration:: +    post (Type&) +    { +    } + + +    // Enumerator +    // +    void Enumerator:: +    traverse (Type& e) +    { +      pre (e); +      belongs (e); +      name (e); +      post (e); +    } + +    void Enumerator:: +    pre (Type&) +    { +    } + +    void Enumerator:: +    belongs (Type& e, EdgeDispatcher& d) +    { +      d.dispatch (e.belongs ()); +    } + +    void Enumerator:: +    belongs (Type& e) +    { +      belongs (e, edge_traverser ()); +    } + +    void Enumerator:: +    name (Type&) +    { +    } + +    void Enumerator:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx b/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx new file mode 100644 index 0000000..960b11c --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx @@ -0,0 +1,59 @@ +// file      : xsd-frontend/traversal/enumeration.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_ENUMERATION_HXX +#define XSD_FRONTEND_TRAVERSAL_ENUMERATION_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/enumeration.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct Enumeration : ScopeTemplate<SemanticGraph::Enumeration> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      name (Type&); + +      virtual void +      inherits (Type&); + +      void +      inherits (Type&, EdgeDispatcher&); + +      virtual void +      post (Type&); +    }; + +    struct Enumerator : Node<SemanticGraph::Enumerator> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      belongs (Type&, EdgeDispatcher&); + +      virtual void +      belongs (Type&); + +      virtual void +      name (Type&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_ENUMERATION_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx b/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx new file mode 100644 index 0000000..5202adf --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx @@ -0,0 +1,12 @@ +// file      : xsd-frontend/traversal/fundamental.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/fundamental.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx b/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx new file mode 100644 index 0000000..0b771cd --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx @@ -0,0 +1,233 @@ +// file      : xsd-frontend/traversal/fundamental.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_FUNDAMENTAL_HXX +#define XSD_FRONTEND_TRAVERSAL_FUNDAMENTAL_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/fundamental.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    namespace Fundamental +    { +      typedef +      Node<SemanticGraph::Fundamental::Type> +      Type; + +      // Integers. +      // +      typedef +      Node<SemanticGraph::Fundamental::Byte> +      Byte; + +      typedef +      Node<SemanticGraph::Fundamental::UnsignedByte> +      UnsignedByte; + +      typedef +      Node<SemanticGraph::Fundamental::Short> +      Short; + +      typedef +      Node<SemanticGraph::Fundamental::UnsignedShort> +      UnsignedShort; + +      typedef +      Node<SemanticGraph::Fundamental::Int> +      Int; + +      typedef +      Node<SemanticGraph::Fundamental::UnsignedInt> +      UnsignedInt; + +      typedef +      Node<SemanticGraph::Fundamental::Long> +      Long; + +      typedef +      Node<SemanticGraph::Fundamental::UnsignedLong> +      UnsignedLong; + +      typedef +      Node<SemanticGraph::Fundamental::Integer> +      Integer; + +      typedef +      Node<SemanticGraph::Fundamental::NonPositiveInteger> +      NonPositiveInteger; + +      typedef +      Node<SemanticGraph::Fundamental::NonNegativeInteger> +      NonNegativeInteger; + +      typedef +      Node<SemanticGraph::Fundamental::PositiveInteger> +      PositiveInteger; + +      typedef +      Node<SemanticGraph::Fundamental::NegativeInteger> +      NegativeInteger; + + +      // Boolean. +      // +      typedef +      Node<SemanticGraph::Fundamental::Boolean> +      Boolean; + + +      // Floats. +      // +      typedef +      Node<SemanticGraph::Fundamental::Float> +      Float; + +      typedef +      Node<SemanticGraph::Fundamental::Double> +      Double; + +      typedef +      Node<SemanticGraph::Fundamental::Decimal> +      Decimal; + + +      // Strings. +      // +      typedef +      Node<SemanticGraph::Fundamental::String> +      String; + +      typedef +      Node<SemanticGraph::Fundamental::NormalizedString> +      NormalizedString; + +      typedef +      Node<SemanticGraph::Fundamental::Token> +      Token; + +      typedef +      Node<SemanticGraph::Fundamental::Name> +      Name; + +      typedef +      Node<SemanticGraph::Fundamental::NameToken> +      NameToken; + +      typedef +      Node<SemanticGraph::Fundamental::NameTokens> +      NameTokens; + +      typedef +      Node<SemanticGraph::Fundamental::NCName> +      NCName; + +      typedef +      Node<SemanticGraph::Fundamental::Language> +      Language; + + +      // Qualified name. +      // +      typedef +      Node<SemanticGraph::Fundamental::QName> +      QName; + + +      // ID/IDREF. +      // +      typedef +      Node<SemanticGraph::Fundamental::Id> +      Id; + +      typedef +      Node<SemanticGraph::Fundamental::IdRef> +      IdRef; + +      typedef +      Node<SemanticGraph::Fundamental::IdRefs> +      IdRefs; + + +      // URI. +      // +      typedef +      Node<SemanticGraph::Fundamental::AnyURI> +      AnyURI; + + +      // Binary. +      // +      typedef +      Node<SemanticGraph::Fundamental::Base64Binary> +      Base64Binary; + +      typedef +      Node<SemanticGraph::Fundamental::HexBinary> +      HexBinary; + + +      // Date/time. +      // +      typedef +      Node<SemanticGraph::Fundamental::Date> +      Date; + +      typedef +      Node<SemanticGraph::Fundamental::DateTime> +      DateTime; + +      typedef +      Node<SemanticGraph::Fundamental::Duration> +      Duration; + +      typedef +      Node<SemanticGraph::Fundamental::Day> +      Day; + +      typedef +      Node<SemanticGraph::Fundamental::Month> +      Month; + +      typedef +      Node<SemanticGraph::Fundamental::MonthDay> +      MonthDay; + +      typedef +      Node<SemanticGraph::Fundamental::Year> +      Year; + +      typedef +      Node<SemanticGraph::Fundamental::YearMonth> +      YearMonth; + +      typedef +      Node<SemanticGraph::Fundamental::Time> +      Time; + + +      // Entity. +      // +      typedef +      Node<SemanticGraph::Fundamental::Entity> +      Entity; + +      typedef +      Node<SemanticGraph::Fundamental::Entities> +      Entities; + + +      // Notation. +      // +      typedef +      Node<SemanticGraph::Fundamental::Notation> +      Notation; +    } +  } +} + + +#endif  // XSD_FRONTEND_TRAVERSAL_FUNDAMENTAL_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/list.cxx b/libxsd-frontend/xsd-frontend/traversal/list.cxx new file mode 100644 index 0000000..9241af1 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/list.cxx @@ -0,0 +1,47 @@ +// file      : xsd-frontend/traversal/list.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/list.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    void List:: +    traverse (Type& l) +    { +      pre (l); +      argumented (l); +      name (l); +      post (l); +    } + +    void List:: +    pre (Type&) +    { +    } + +    void List:: +    argumented (Type& l) +    { +      argumented (l, *this); +    } + +    void List:: +    argumented (Type& l, EdgeDispatcher& d) +    { +      d.dispatch (l.argumented ()); +    } + +    void List:: +    name (Type&) +    { +    } + +    void List:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/list.hxx b/libxsd-frontend/xsd-frontend/traversal/list.hxx new file mode 100644 index 0000000..06aa154 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/list.hxx @@ -0,0 +1,38 @@ +// file      : xsd-frontend/traversal/list.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_LIST_HXX +#define XSD_FRONTEND_TRAVERSAL_LIST_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/list.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct List: Node<SemanticGraph::List> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      argumented (Type&); + +      virtual void +      argumented (Type&, EdgeDispatcher& d); + +      virtual void +      name (Type&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_LIST_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/namespace.cxx b/libxsd-frontend/xsd-frontend/traversal/namespace.cxx new file mode 100644 index 0000000..fbf1105 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/namespace.cxx @@ -0,0 +1,12 @@ +// file      : xsd-frontend/traversal/namespace.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/namespace.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/namespace.hxx b/libxsd-frontend/xsd-frontend/traversal/namespace.hxx new file mode 100644 index 0000000..0dd0901 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/namespace.hxx @@ -0,0 +1,44 @@ +// file      : xsd-frontend/traversal/namespace.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_NAMESPACE_HXX +#define XSD_FRONTEND_TRAVERSAL_NAMESPACE_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/namespace.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct Namespace: ScopeTemplate<SemanticGraph::Namespace> +    { +      virtual void +      traverse (Type& m) +      { +        pre (m); +        name (m); +        names (m); +        post (m); +      } + +      virtual void +      pre (Type&) +      { +      } + +      virtual void +      name (Type&) +      { +      } + +      virtual void +      post (Type&) +      { +      } +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_NAMESPACE_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/particle.cxx b/libxsd-frontend/xsd-frontend/traversal/particle.cxx new file mode 100644 index 0000000..1dd0ce0 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/particle.cxx @@ -0,0 +1,30 @@ +// file      : xsd-frontend/traversal/particle.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/particle.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    // Particle +    // +    void Particle:: +    traverse (Type& c) +    { +      pre (c); +      post (c); +    } + +    void Particle:: +    pre (Type&) +    { +    } + +    void Particle:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/particle.hxx b/libxsd-frontend/xsd-frontend/traversal/particle.hxx new file mode 100644 index 0000000..5346ae9 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/particle.hxx @@ -0,0 +1,29 @@ +// file      : xsd-frontend/traversal/particle.hxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_PARTICLE_HXX +#define XSD_FRONTEND_TRAVERSAL_PARTICLE_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/particle.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct Particle : Node<SemanticGraph::Particle> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_PARTICLE_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/schema.cxx b/libxsd-frontend/xsd-frontend/traversal/schema.cxx new file mode 100644 index 0000000..090e964 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/schema.cxx @@ -0,0 +1,12 @@ +// file      : xsd-frontend/traversal/schema.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/schema.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/schema.hxx b/libxsd-frontend/xsd-frontend/traversal/schema.hxx new file mode 100644 index 0000000..a38ddfd --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/schema.hxx @@ -0,0 +1,149 @@ +// file      : xsd-frontend/traversal/schema.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_SCHEMA_HXX +#define XSD_FRONTEND_TRAVERSAL_SCHEMA_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/schema.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    // +    // +    struct Uses: Edge<SemanticGraph::Uses> +    { +      Uses () +      { +      } + +      Uses (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.schema ()); +      } +    }; + +    // +    // +    struct Implies: Edge<SemanticGraph::Implies> +    { +      Implies () +      { +      } + +      Implies (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.schema ()); +      } +    }; + + +    // +    // +    struct Sources: Edge<SemanticGraph::Sources> +    { +      Sources () +      { +      } + +      Sources (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.schema ()); +      } +    }; + + +    // +    // +    struct Includes: Edge<SemanticGraph::Includes> +    { +      Includes () +      { +      } + +      Includes (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.schema ()); +      } +    }; + + +    // +    // +    struct Imports: Edge<SemanticGraph::Imports> +    { +      Imports () +      { +      } + +      Imports (NodeBase& n) +      { +        node_traverser (n); +      } + +      virtual void +      traverse (Type& e) +      { +        dispatch (e.schema ()); +      } +    }; + + +    // +    // +    struct Schema: ScopeTemplate<SemanticGraph::Schema> +    { +      virtual void +      traverse (Type& s) +      { +        pre (s); + +        iterate_and_dispatch ( +          s.uses_begin (), s.uses_end (), edge_traverser ()); + +        names (s); + +        post (s); +      } + +      virtual void +      pre (Type&) +      { +      } + +      virtual void +      post (Type&) +      { +      } +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_SCHEMA_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/union.cxx b/libxsd-frontend/xsd-frontend/traversal/union.cxx new file mode 100644 index 0000000..fe8f7d0 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/union.cxx @@ -0,0 +1,47 @@ +// file      : xsd-frontend/traversal/union.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsd-frontend/traversal/union.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    void Union:: +    traverse (Type& u) +    { +      pre (u); +      argumented (u); +      name (u); +      post (u); +    } + +    void Union:: +    pre (Type&) +    { +    } + +    void Union:: +    argumented (Type& u) +    { +      argumented (u, *this); +    } + +    void Union:: +    argumented (Type& u, EdgeDispatcher& d) +    { +      iterate_and_dispatch (u.argumented_begin (), u.argumented_end (), d); +    } + +    void Union:: +    name (Type&) +    { +    } + +    void Union:: +    post (Type&) +    { +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/traversal/union.hxx b/libxsd-frontend/xsd-frontend/traversal/union.hxx new file mode 100644 index 0000000..8012036 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/traversal/union.hxx @@ -0,0 +1,38 @@ +// file      : xsd-frontend/traversal/union.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_TRAVERSAL_UNION_HXX +#define XSD_FRONTEND_TRAVERSAL_UNION_HXX + +#include <xsd-frontend/traversal/elements.hxx> +#include <xsd-frontend/semantic-graph/union.hxx> + +namespace XSDFrontend +{ +  namespace Traversal +  { +    struct Union: Node<SemanticGraph::Union> +    { +      virtual void +      traverse (Type&); + +      virtual void +      pre (Type&); + +      virtual void +      argumented (Type&); + +      virtual void +      argumented (Type&, EdgeDispatcher& d); + +      virtual void +      name (Type&); + +      virtual void +      post (Type&); +    }; +  } +} + +#endif  // XSD_FRONTEND_TRAVERSAL_UNION_HXX | 
