From 018e1ba581ec6f01f069a45ec4cf89f152b44d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 19 Mar 2025 15:41:36 +0100 Subject: remerge --- .../xsd-frontend/traversal/any-attribute.hxx | 21 ++ libxsd-frontend/xsd-frontend/traversal/any.hxx | 21 ++ .../xsd-frontend/traversal/attribute-group.cxx | 29 ++ .../xsd-frontend/traversal/attribute-group.hxx | 29 ++ .../xsd-frontend/traversal/attribute.cxx | 47 +++ .../xsd-frontend/traversal/attribute.hxx | 40 ++ libxsd-frontend/xsd-frontend/traversal/complex.cxx | 63 ++++ libxsd-frontend/xsd-frontend/traversal/complex.hxx | 44 +++ .../xsd-frontend/traversal/compositors.cxx | 164 ++++++++ .../xsd-frontend/traversal/compositors.hxx | 135 +++++++ .../xsd-frontend/traversal/element-group.cxx | 42 +++ .../xsd-frontend/traversal/element-group.hxx | 35 ++ libxsd-frontend/xsd-frontend/traversal/element.cxx | 47 +++ libxsd-frontend/xsd-frontend/traversal/element.hxx | 38 ++ .../xsd-frontend/traversal/elements.cxx | 76 ++++ .../xsd-frontend/traversal/elements.hxx | 411 +++++++++++++++++++++ .../xsd-frontend/traversal/elements.txx | 10 + .../xsd-frontend/traversal/enumeration.cxx | 90 +++++ .../xsd-frontend/traversal/enumeration.hxx | 59 +++ .../xsd-frontend/traversal/fundamental.cxx | 12 + .../xsd-frontend/traversal/fundamental.hxx | 233 ++++++++++++ libxsd-frontend/xsd-frontend/traversal/list.cxx | 47 +++ libxsd-frontend/xsd-frontend/traversal/list.hxx | 38 ++ .../xsd-frontend/traversal/namespace.cxx | 12 + .../xsd-frontend/traversal/namespace.hxx | 44 +++ .../xsd-frontend/traversal/particle.cxx | 30 ++ .../xsd-frontend/traversal/particle.hxx | 29 ++ libxsd-frontend/xsd-frontend/traversal/schema.cxx | 12 + libxsd-frontend/xsd-frontend/traversal/schema.hxx | 149 ++++++++ libxsd-frontend/xsd-frontend/traversal/union.cxx | 47 +++ libxsd-frontend/xsd-frontend/traversal/union.hxx | 38 ++ 31 files changed, 2092 insertions(+) create mode 100644 libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/any.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/attribute.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/attribute.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/complex.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/complex.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/compositors.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/compositors.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/element-group.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/element-group.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/element.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/element.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/elements.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/elements.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/elements.txx create mode 100644 libxsd-frontend/xsd-frontend/traversal/enumeration.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/enumeration.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/fundamental.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/fundamental.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/list.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/list.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/namespace.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/namespace.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/particle.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/particle.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/schema.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/schema.hxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/union.cxx create mode 100644 libxsd-frontend/xsd-frontend/traversal/union.hxx (limited to 'libxsd-frontend/xsd-frontend/traversal') 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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + typedef + Node + 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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + typedef + Node + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct AttributeGroup: ScopeTemplate + { + 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 + +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 + +#include + + +namespace XSDFrontend +{ + namespace Traversal + { + struct Attribute : Node + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct Complex : ScopeTemplate + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + // + // + struct ContainsParticle: Edge + { + ContainsParticle () + { + } + + ContainsParticle (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type&); + }; + + + // + // + struct ContainsCompositor: Edge + { + ContainsCompositor () + { + } + + ContainsCompositor (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type&); + }; + + // + // + struct Compositor : Node + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + contains (Type&); + + virtual void + contains (Type&, EdgeDispatcher&); + + virtual void + post (Type&); + }; + + + // + // + struct All : Node + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + contains (Type&); + + virtual void + contains (Type&, EdgeDispatcher&); + + virtual void + post (Type&); + }; + + + // + // + struct Choice : Node + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + contains (Type&); + + virtual void + contains (Type&, EdgeDispatcher&); + + virtual void + post (Type&); + }; + + + // + // + struct Sequence : Node + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct ElementGroup: ScopeTemplate + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct Element : Node + { + 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 + +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 + +#include +#include + +namespace XSDFrontend +{ + namespace Traversal + { + using namespace cutl; + + typedef compiler::dispatcher NodeDispatcher; + typedef compiler::dispatcher 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 + struct Node: compiler::traverser_impl, + virtual NodeBase + { + typedef T Type; + }; + + template + struct Edge: compiler::traverser_impl, + virtual EdgeBase + { + typedef T Type; + }; + + // + // Edges + // + + // + // + struct Names : Edge + { + Names () + { + } + + Names (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.named ()); + } + }; + + + // + // + struct Belongs : Edge + { + Belongs () + { + } + + Belongs (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.type ()); + } + }; + + // + // Nodes + // + + // + // + struct Nameable : Node + { + }; + + + // + // + template + struct ScopeTemplate : Node + { + public: + virtual void + traverse (T& s) + { + names (s); + } + + template + void + names (T& s, + EdgeDispatcher& d, + void (X::*pre_) (T&) = (void (ScopeTemplate::*)(T&)) (0), + void (X::*post_) (T&) = (void (ScopeTemplate::*)(T&)) (0), + void (X::*none_) (T&) = (void (ScopeTemplate::*)(T&)) (0), + void (X::*next_) (T&) = (void (ScopeTemplate::*)(T&)) (0)) + { + X* this_ (dynamic_cast (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 > (s, d); + } + + virtual void + names (T& s) + { + names (s, + *this, + &ScopeTemplate::names_pre, + &ScopeTemplate::names_post, + &ScopeTemplate::names_none, + &ScopeTemplate::names_next); + } + + virtual void + names_pre (T&) + { + } + + virtual void + names_next (T&) + { + } + + virtual void + names_post (T&) + { + } + + virtual void + names_none (T&) + { + } + }; + + + // + // + typedef + ScopeTemplate + Scope; + + + // + // + struct Type : Node + { + virtual void + traverse (SemanticGraph::Type&) = 0; + }; + + + // + // + struct Instance : Node + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + belongs (Type&, EdgeDispatcher&); + + virtual void + belongs (Type&); + + virtual void + post (Type&); + }; + + + // + // + struct Member : Node + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + belongs (Type&, EdgeDispatcher&); + + virtual void + belongs (Type&); + + virtual void + post (Type&); + }; + + + // + // + struct Inherits : Edge + { + Inherits () + { + } + + Inherits (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.base ()); + } + }; + + + // + // + struct Extends : Edge + { + Extends () + { + } + + Extends (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.base ()); + } + }; + + + // + // + struct Restricts : Edge + { + Restricts () + { + } + + Restricts (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.base ()); + } + }; + + + // + // + struct Argumented : Edge + { + Argumented () + { + } + + Argumented (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& a) + { + dispatch (a.type ()); + } + }; + + + /* + // + // + struct Contains : Edge + { + virtual void + traverse (Type& e) + { + dispatch (e.element ()); + } + }; + */ + + // + // + typedef + Node + AnyType; + + + // + // + typedef + Node + AnySimpleType; + } +} + +#include + +#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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct Enumeration : ScopeTemplate + { + 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 + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + namespace Fundamental + { + typedef + Node + Type; + + // Integers. + // + typedef + Node + Byte; + + typedef + Node + UnsignedByte; + + typedef + Node + Short; + + typedef + Node + UnsignedShort; + + typedef + Node + Int; + + typedef + Node + UnsignedInt; + + typedef + Node + Long; + + typedef + Node + UnsignedLong; + + typedef + Node + Integer; + + typedef + Node + NonPositiveInteger; + + typedef + Node + NonNegativeInteger; + + typedef + Node + PositiveInteger; + + typedef + Node + NegativeInteger; + + + // Boolean. + // + typedef + Node + Boolean; + + + // Floats. + // + typedef + Node + Float; + + typedef + Node + Double; + + typedef + Node + Decimal; + + + // Strings. + // + typedef + Node + String; + + typedef + Node + NormalizedString; + + typedef + Node + Token; + + typedef + Node + Name; + + typedef + Node + NameToken; + + typedef + Node + NameTokens; + + typedef + Node + NCName; + + typedef + Node + Language; + + + // Qualified name. + // + typedef + Node + QName; + + + // ID/IDREF. + // + typedef + Node + Id; + + typedef + Node + IdRef; + + typedef + Node + IdRefs; + + + // URI. + // + typedef + Node + AnyURI; + + + // Binary. + // + typedef + Node + Base64Binary; + + typedef + Node + HexBinary; + + + // Date/time. + // + typedef + Node + Date; + + typedef + Node + DateTime; + + typedef + Node + Duration; + + typedef + Node + Day; + + typedef + Node + Month; + + typedef + Node + MonthDay; + + typedef + Node + Year; + + typedef + Node + YearMonth; + + typedef + Node + Time; + + + // Entity. + // + typedef + Node + Entity; + + typedef + Node + Entities; + + + // Notation. + // + typedef + Node + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct List: Node + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct Namespace: ScopeTemplate + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct Particle : Node + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + // + // + struct Uses: Edge + { + Uses () + { + } + + Uses (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.schema ()); + } + }; + + // + // + struct Implies: Edge + { + Implies () + { + } + + Implies (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.schema ()); + } + }; + + + // + // + struct Sources: Edge + { + Sources () + { + } + + Sources (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.schema ()); + } + }; + + + // + // + struct Includes: Edge + { + Includes () + { + } + + Includes (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.schema ()); + } + }; + + + // + // + struct Imports: Edge + { + Imports () + { + } + + Imports (NodeBase& n) + { + node_traverser (n); + } + + virtual void + traverse (Type& e) + { + dispatch (e.schema ()); + } + }; + + + // + // + struct Schema: ScopeTemplate + { + 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 + +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 +#include + +namespace XSDFrontend +{ + namespace Traversal + { + struct Union: Node + { + 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 -- cgit v1.2.3