summaryrefslogtreecommitdiff
path: root/libxsd-frontend/xsd-frontend
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:25:44 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:25:44 +0200
commit8286ac511144e4f17d34eac9affb97e50646344a (patch)
treef1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /libxsd-frontend/xsd-frontend
parenta15cf65c44d5c224169c32ef5495b68c758134b7 (diff)
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'libxsd-frontend/xsd-frontend')
-rw-r--r--libxsd-frontend/xsd-frontend/generators/dependencies.cxx70
-rw-r--r--libxsd-frontend/xsd-frontend/generators/dependencies.hxx32
-rw-r--r--libxsd-frontend/xsd-frontend/makefile37
-rw-r--r--libxsd-frontend/xsd-frontend/parser.cxx1224
-rw-r--r--libxsd-frontend/xsd-frontend/parser.hxx38
-rw-r--r--libxsd-frontend/xsd-frontend/schema-dom-parser.cxx25
-rw-r--r--libxsd-frontend/xsd-frontend/schema-dom-parser.hxx17
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph.hxx3
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx25
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx46
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx57
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx29
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/any.cxx59
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/any.hxx29
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx31
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx11
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx43
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx21
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx43
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx53
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx120
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx119
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx30
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx15
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/element.cxx60
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/element.hxx37
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx193
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx536
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx58
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx15
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx1143
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m455
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx516
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m432
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m43
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/list.cxx29
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/list.hxx9
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx29
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx15
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx57
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx37
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx121
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx152
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/union.cxx29
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/union.hxx9
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/anonymous.cxx377
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/anonymous.hxx21
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx20
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx9
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/restriction.cxx56
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/restriction.hxx9
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx148
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx23
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/simplifier.cxx23
-rw-r--r--libxsd-frontend/xsd-frontend/transformations/simplifier.hxx9
-rw-r--r--libxsd-frontend/xsd-frontend/traversal.hxx3
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx3
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/any.hxx3
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx9
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx9
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/attribute.cxx17
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/attribute.hxx17
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/complex.cxx23
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/complex.hxx23
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/compositors.cxx55
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/compositors.hxx55
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/element-group.cxx15
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/element-group.hxx15
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/element.cxx17
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/element.hxx17
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/elements.cxx27
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/elements.hxx221
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/elements.txx3
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/enumeration.cxx31
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/enumeration.hxx31
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/fundamental.cxx3
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/fundamental.hxx3
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/list.cxx17
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/list.hxx17
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/namespace.cxx3
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/namespace.hxx11
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/particle.cxx9
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/particle.hxx9
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/schema.cxx3
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/schema.hxx19
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/union.cxx17
-rw-r--r--libxsd-frontend/xsd-frontend/traversal/union.hxx17
-rw-r--r--libxsd-frontend/xsd-frontend/types.cxx61
-rw-r--r--libxsd-frontend/xsd-frontend/types.hxx242
-rw-r--r--libxsd-frontend/xsd-frontend/version.hxx14
-rw-r--r--libxsd-frontend/xsd-frontend/xml.hxx86
91 files changed, 4408 insertions, 2724 deletions
diff --git a/libxsd-frontend/xsd-frontend/generators/dependencies.cxx b/libxsd-frontend/xsd-frontend/generators/dependencies.cxx
new file mode 100644
index 0000000..55e7ae8
--- /dev/null
+++ b/libxsd-frontend/xsd-frontend/generators/dependencies.cxx
@@ -0,0 +1,70 @@
+// file : xsd-frontend/generators/dependencies.cxx
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include <xsd-frontend/semantic-graph.hxx>
+#include <xsd-frontend/traversal.hxx>
+
+#include <xsd-frontend/generators/dependencies.hxx>
+
+namespace XSDFrontend
+{
+ typedef std::vector<SemanticGraph::Path> Paths;
+
+ namespace
+ {
+ // Go into included/imported (but not implied) schemas while making
+ // sure we don't process the same stuff more than once.
+ //
+ struct Uses: Traversal::Uses
+ {
+ Uses (Paths& p): paths_ (p) {}
+
+ virtual void
+ traverse (Type& u)
+ {
+ if (u.is_a<SemanticGraph::Implies> ())
+ return;
+
+ SemanticGraph::Schema& s (u.schema ());
+
+ if (!s.context ().count ("xsd-frontend-dependencies-seen"))
+ {
+ s.context ().set ("xsd-frontend-dependencies-seen", true);
+
+ // While the edge contains the exact path that was found in the
+ // schema, the schema node itself has the reative to the including
+ // or importing schema path, which is what we want.
+ //
+ paths_.push_back (s.file ());
+ Traversal::Uses::traverse (u);
+ }
+ }
+
+ private:
+ Paths& paths_;
+ };
+ }
+
+ namespace Generators
+ {
+ Paths Dependencies::
+ generate (SemanticGraph::Schema& s, SemanticGraph::Path const& p)
+ {
+ Paths r;
+ r.push_back (p);
+
+ Traversal::Schema schema;
+ Uses uses (r);
+
+ schema >> uses >> schema;
+
+ // Some twisted schemas do recusive inclusions.
+ //
+ s.context ().set ("xsd-frontend-dependencies-seen", true);
+
+ schema.dispatch (s);
+ return r;
+ }
+ }
+}
diff --git a/libxsd-frontend/xsd-frontend/generators/dependencies.hxx b/libxsd-frontend/xsd-frontend/generators/dependencies.hxx
new file mode 100644
index 0000000..5a7624f
--- /dev/null
+++ b/libxsd-frontend/xsd-frontend/generators/dependencies.hxx
@@ -0,0 +1,32 @@
+// file : xsd-frontend/generators/dependencies.hxx
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef XSD_FRONTEND_GENERATORS_DEPENDENCIES_HXX
+#define XSD_FRONTEND_GENERATORS_DEPENDENCIES_HXX
+
+#include <vector>
+
+#include <xsd-frontend/types.hxx>
+
+#include <xsd-frontend/semantic-graph/elements.hxx> // Path
+#include <xsd-frontend/semantic-graph/schema.hxx>
+
+namespace XSDFrontend
+{
+ namespace Generators
+ {
+ // Return the list of included/imported schema paths (transitively and
+ // including the main schema file) which can then be used to produce
+ // make dependencies, etc.
+ //
+ class Dependencies
+ {
+ public:
+ std::vector<SemanticGraph::Path>
+ generate (SemanticGraph::Schema&, SemanticGraph::Path const&);
+ };
+ }
+}
+
+#endif // XSD_FRONTEND_GENERATORS_DEPENDENCIES_HXX
diff --git a/libxsd-frontend/xsd-frontend/makefile b/libxsd-frontend/xsd-frontend/makefile
index abf6565..4dbffcd 100644
--- a/libxsd-frontend/xsd-frontend/makefile
+++ b/libxsd-frontend/xsd-frontend/makefile
@@ -1,6 +1,5 @@
# file : xsd-frontend/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
@@ -44,7 +43,9 @@ cxx_tun += transformations/anonymous.cxx \
transformations/schema-per-type.cxx \
transformations/simplifier.cxx
-cxx_tun += parser.cxx schema-dom-parser.cxx
+cxx_tun += generators/dependencies.cxx
+
+cxx_tun += types.cxx parser.cxx schema-dom-parser.cxx
cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
@@ -57,34 +58,21 @@ xsd_frontend.l.cpp-options := $(out_base)/xsd-frontend.l.cpp-options
clean := $(out_base)/.clean
-# Import.
-#
-$(call import,\
- $(scf_root)/import/libboost/filesystem/stub.make,\
- l: fs.l,cpp-options: fs.l.cpp-options)
-
$(call import,\
$(scf_root)/import/libxerces-c/stub.make,\
l: xerces_c.l,cpp-options: xerces_c.l.cpp-options)
$(call import,\
- $(scf_root)/import/libcult/stub.make,\
- l: cult.l,cpp-options: cult.l.cpp-options)
+ $(scf_root)/import/libcutl/stub.make,\
+ l: cutl.l,cpp-options: cutl.l.cpp-options)
-$(call import,\
- $(scf_root)/import/libfrontend-elements/stub.make,\
- l: fe.l,cpp-options: fe.l.cpp-options)
-
-# what to build
+# What to build.
#
-$(xsd_frontend.l): $(cxx_obj) $(fe.l) $(cult.l) $(xerces_c.l) $(fs.l)
+$(xsd_frontend.l): $(cxx_obj) $(cutl.l) $(xerces_c.l)
$(xsd_frontend.l.cpp-options): prefix := xsd-frontend/ $(out_root)/
$(xsd_frontend.l.cpp-options): value := -I$(src_root) -I$(out_root)
-$(xsd_frontend.l.cpp-options): \
- $(fs.l.cpp-options) \
- $(fe.l.cpp-options) \
- $(cult.l.cpp-options)
+$(xsd_frontend.l.cpp-options): $(cutl.l.cpp-options)
#@@ This can be further optimized since only parser depends on xerces.
#
@@ -104,8 +92,11 @@ $(out_base)/: $(xsd_frontend.l)
$(clean): $(xsd_frontend.l).o.clean \
$(xsd_frontend.l.cpp-options).clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od)) \
- $(addsuffix .m4.clean,$(m4_cxx))
+ $(addsuffix .cxx.clean,$(cxx_od))
+
+ifneq ($(libxsd_frontend_clean_gen),n)
+$(clean): $(addsuffix .m4.clean,$(m4_cxx))
+endif
# Generated .gitignore.
#
diff --git a/libxsd-frontend/xsd-frontend/parser.cxx b/libxsd-frontend/xsd-frontend/parser.cxx
index 901a8d3..6b582ab 100644
--- a/libxsd-frontend/xsd-frontend/parser.cxx
+++ b/libxsd-frontend/xsd-frontend/parser.cxx
@@ -1,21 +1,23 @@
// file : xsd-frontend/parser.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <xsd-frontend/types.hxx>
-#include <xsd-frontend/parser.hxx>
+#include <map>
+#include <stack>
+#include <vector>
+#include <iostream>
+#include <sstream>
+
+#include <cutl/compiler/type-id.hxx>
+
+#include <xsd-frontend/version.hxx> // Check Xerces-C++ version.
#include <xsd-frontend/xml.hxx>
+#include <xsd-frontend/parser.hxx>
#include <xsd-frontend/schema-dom-parser.hxx>
#include <xsd-frontend/semantic-graph.hxx>
#include <xsd-frontend/traversal.hxx>
-#include <cult/containers/map.hxx>
-#include <cult/containers/stack.hxx>
-#include <cult/containers/vector.hxx>
-#include <cult/rtti/type-id.hxx>
-
//@@ Do i need this?
//
#include <xercesc/dom/DOM.hpp>
@@ -38,15 +40,9 @@
#include <xercesc/framework/LocalFileInputSource.hpp>
#include <xercesc/framework/Wrapper4InputSource.hpp>
-#include <iostream>
-#include <sstream>
-#include <memory> // std::auto_ptr
-
-using std::wcout;
-using std::wcerr;
-using std::endl;
+using namespace std;
-using Cult::RTTI::TypeId;
+using cutl::compiler::type_id;
namespace XSDFrontend
{
@@ -55,7 +51,7 @@ namespace XSDFrontend
//@@ Port to tracing facility.
//
- Boolean trace_ = false;
+ bool trace_ = false;
String const xsd = L"http://www.w3.org/2001/XMLSchema";
String const xse = L"http://www.codesynthesis.com/xmlns/xml-schema-extension";
@@ -107,6 +103,43 @@ namespace XSDFrontend
String name_;
};
+ // Trim leading and trailing whitespaces.
+ //
+ template <typename C>
+ StringTemplate<C>
+ trim (StringTemplate<C> const& s)
+ {
+ typedef StringTemplate<C> String;
+
+ size_t size (s.size ());
+
+ if (size == 0)
+ return s;
+
+ C const* f (s.c_str ());
+ C const* l (f + size);
+
+ C const* of (f);
+
+ while (f < l &&
+ (*f == C (0x20) || *f == C (0x0A) ||
+ *f == C (0x0D) || *f == C (0x09)))
+ ++f;
+
+ --l;
+
+ C const* ol (l);
+
+ while (l > f &&
+ (*l == C (0x20) || *l == C (0x0A) ||
+ *l == C (0x0D) || *l == C (0x09)))
+ --l;
+
+ if (f != of || l != ol)
+ return f <= l ? String (f, l - f + 1) : String ();
+ else
+ return s;
+ }
// Name cache. We only support maximum two nodes with the same
// name in the cache (e.g., element and type). For (rare) cases
@@ -120,9 +153,9 @@ namespace XSDFrontend
Nameable* second;
};
- typedef Cult::Containers::Map<String, CacheNodes> NodeMap;
- typedef Cult::Containers::Map<String, NodeMap> NamespaceMap;
- typedef Cult::Containers::Vector<SemanticGraph::Member*> DefaultValues;
+ typedef std::map<String, CacheNodes> NodeMap;
+ typedef std::map<String, NodeMap> NamespaceMap;
+ typedef std::vector<SemanticGraph::Member*> DefaultValues;
template <typename X>
X&
@@ -133,11 +166,11 @@ namespace XSDFrontend
{
// First check the cache.
//
- NamespaceMap::Iterator i (cache.find (ns_name));
+ NamespaceMap::iterator i (cache.find (ns_name));
if (i != cache.end ())
{
- NodeMap::Iterator j (i->second.find (uq_name));
+ NodeMap::iterator j (i->second.find (uq_name));
if (j != i->second.end ())
{
@@ -188,12 +221,12 @@ namespace XSDFrontend
//
//
- typedef Cult::Containers::Map<String, String> Facets;
+ typedef std::map<String, String> Facets;
- Void
+ void
copy_facets (Restricts& r, Facets const& f)
{
- for (Facets::ConstIterator i (f.begin ()), e (f.end ()); i != e; ++i)
+ for (Facets::const_iterator i (f.begin ()), e (f.end ()); i != e; ++i)
r.facet_insert (i->first, i->second);
}
@@ -210,14 +243,14 @@ namespace XSDFrontend
String uq_name;
};
- typedef Cult::Containers::Vector<UnionMemberType> UnionMemberTypes;
+ typedef std::vector<UnionMemberType> UnionMemberTypes;
//
//
struct ElementGroupRef
{
ElementGroupRef (String const& uq_name_, String const& ns_name_,
- UnsignedLong min_, UnsignedLong max_,
+ unsigned long min_, unsigned long max_,
Compositor& compositor, Scope& scope)
: uq_name (uq_name_), ns_name (ns_name_),
min (min_), max (max_)
@@ -232,7 +265,7 @@ namespace XSDFrontend
}
ElementGroupRef (String const& uq_name_, String const& ns_name_,
- UnsignedLong min_, UnsignedLong max_,
+ unsigned long min_, unsigned long max_,
Scope& scope)
: uq_name (uq_name_), ns_name (ns_name_),
min (min_), max (max_)
@@ -244,13 +277,12 @@ namespace XSDFrontend
String uq_name;
String ns_name;
- UnsignedLong min, max;
+ unsigned long min, max;
Compositor::ContainsIterator contains_pos;
Scope::NamesIterator names_pos;
};
- typedef Cult::Containers::Vector<ElementGroupRef> ElementGroupRefs;
-
+ typedef std::vector<ElementGroupRef> ElementGroupRefs;
//
//
@@ -271,7 +303,7 @@ namespace XSDFrontend
Scope::NamesIterator names_pos;
};
- typedef Cult::Containers::Vector<AttributeGroupRef> AttributeGroupRefs;
+ typedef std::vector<AttributeGroupRef> AttributeGroupRefs;
//
@@ -290,14 +322,14 @@ namespace XSDFrontend
}
template <typename E>
- Void
+ void
add_edge_left (E& e)
{
node_.add_edge_left (e, arg_);
}
template <typename E>
- Void
+ void
add_edge_right (E& e)
{
node_.add_edge_right (e, arg_);
@@ -324,7 +356,7 @@ namespace XSDFrontend
Traversal::Compositor
{
Resolver (Schema& s,
- Boolean& valid,
+ bool& valid,
NamespaceMap& cache,
DefaultValues& default_values)
: s_ (s),
@@ -335,7 +367,7 @@ namespace XSDFrontend
*this >> contains_compositor >> *this;
}
- Void
+ void
traverse (SemanticGraph::Attribute& a)
{
// Avoid traversing attribute more than once.
@@ -348,13 +380,13 @@ namespace XSDFrontend
}
}
- Void
+ void
traverse (SemanticGraph::Element& e)
{
resolve_element (e);
}
- Void
+ void
resolve_element (SemanticGraph::Element& e)
{
// Avoid resolving element more than once.
@@ -383,6 +415,15 @@ namespace XSDFrontend
resolve<SemanticGraph::Element> (ns_name, uq_name, s_, cache_));
s_.new_edge<Substitutes> (e, root);
+
+ // See if we need to derive the type of this element from the
+ // one it substitutes.
+ //
+ if (!e.typed_p ())
+ {
+ resolve_member (root); // Make sure the type is resolved.
+ s_.new_edge<Belongs> (e, root.type ());
+ }
}
catch (NotNamespace const& ex)
{
@@ -405,7 +446,7 @@ namespace XSDFrontend
}
}
- Void
+ void
resolve_member (SemanticGraph::Member& m)
{
using SemanticGraph::Member;
@@ -437,8 +478,15 @@ namespace XSDFrontend
m.context ().remove ("instance-ns-name");
m.context ().remove ("instance-uq-name");
-
- Member& ref (resolve<Member> (ns_name, uq_name, s_, cache_));
+ // Resolve the name to the same type. It is legal to have
+ // an element and an attribute with the same name.
+ //
+ Member& ref (
+ m.is_a<Element> ()
+ ? static_cast<Member&> (
+ resolve<Element> (ns_name, uq_name, s_, cache_))
+ : static_cast<Member&> (
+ resolve<Attribute> (ns_name, uq_name, s_, cache_)));
// Make sure the referenced member is fully resolved.
// @@ Substitutes edge won't be resolved.
@@ -509,19 +557,10 @@ namespace XSDFrontend
if (!m.annotated_p () && ref.annotated_p ())
s_.new_edge<Annotates> (ref.annotation (), m);
- // Type info.
+ // Type info. Can be missing for a substitution group member.
//
if (ref.typed_p ())
s_.new_edge<Belongs> (m, ref.type ());
- else
- {
- if (valid_)
- {
- wcerr << "ice: referenced instance '" << ns_name << "#"
- << uq_name << "' is not typed" << endl;
- abort ();
- }
- }
}
}
catch (NotNamespace const& ex)
@@ -544,19 +583,19 @@ namespace XSDFrontend
}
}
- Void
+ void
traverse (SemanticGraph::Fundamental::IdRef& i)
{
ref_type (i);
}
- Void
+ void
traverse (SemanticGraph::Fundamental::IdRefs& i)
{
ref_type (i);
}
- Void
+ void
ref_type (SemanticGraph::Specialization& s)
{
if (s.context ().count ("type-ns-name"))
@@ -584,7 +623,7 @@ namespace XSDFrontend
}
}
- Void
+ void
traverse (SemanticGraph::List& l)
{
if (l.context ().count ("type-ns-name"))
@@ -614,7 +653,7 @@ namespace XSDFrontend
Traversal::List::traverse (l);
}
- Void
+ void
traverse (SemanticGraph::Union& u)
{
using SemanticGraph::Union;
@@ -627,7 +666,7 @@ namespace XSDFrontend
// Process it backwards so that we can just insert each
// edge in the front.
//
- for (UnionMemberTypes::ConstReverseIterator i (m.rbegin ());
+ for (UnionMemberTypes::const_reverse_iterator i (m.rbegin ());
i != m.rend (); i++)
{
try
@@ -655,7 +694,7 @@ namespace XSDFrontend
Traversal::Union::traverse (u);
}
- Void
+ void
traverse (SemanticGraph::Complex& c)
{
// Avoid traversing complex type more than once.
@@ -669,11 +708,9 @@ namespace XSDFrontend
//
if (c.context ().count ("type-ns-name"))
{
- using Cult::RTTI::TypeId;
-
String ns_name (c.context ().get<String> ("type-ns-name"));
String uq_name (c.context ().get<String> ("type-uq-name"));
- TypeId edge_id (c.context ().get<TypeId> ("edge-type-id"));
+ type_id edge_id (c.context ().get<type_id> ("edge-type-id"));
c.context ().remove ("type-ns-name");
c.context ().remove ("type-uq-name");
@@ -725,7 +762,7 @@ namespace XSDFrontend
// Handle refs from last to first so that multiple insertions
// to an empty list (always front) end up in proper order.
//
- for (AttributeGroupRefs::ReverseIterator i (refs.rbegin ());
+ for (AttributeGroupRefs::reverse_iterator i (refs.rbegin ());
i != refs.rend (); ++i)
{
clone_attribute_group_content (*i, c);
@@ -756,7 +793,7 @@ namespace XSDFrontend
Traversal::Complex::traverse (c);
}
- Void
+ void
traverse (SemanticGraph::Enumeration& e)
{
// Resolve base type if any.
@@ -797,7 +834,7 @@ namespace XSDFrontend
Traversal::Enumeration::traverse (e);
}
- Void
+ void
traverse (SemanticGraph::ElementGroup& g)
{
// Avoid traversing groups more than once.
@@ -818,7 +855,7 @@ namespace XSDFrontend
// We need a "shallow" resolve to break possible recursing:
// group->element->complexType->group.
//
- Void
+ void
resolve_element_group (SemanticGraph::ElementGroup& g)
{
using SemanticGraph::Scope;
@@ -841,7 +878,7 @@ namespace XSDFrontend
}
}
- Void
+ void
traverse (SemanticGraph::AttributeGroup& g)
{
// Avoid traversing groups more than once.
@@ -861,7 +898,7 @@ namespace XSDFrontend
// Handle refs from last to first so that multiple insertions
// to an empty list (always front) end up in proper order.
//
- for (AttributeGroupRefs::ReverseIterator i (refs.rbegin ());
+ for (AttributeGroupRefs::reverse_iterator i (refs.rbegin ());
i != refs.rend (); ++i)
{
clone_attribute_group_content (*i, g);
@@ -873,7 +910,7 @@ namespace XSDFrontend
Traversal::AttributeGroup::traverse (g);
}
- Void
+ void
traverse (SemanticGraph::Compositor& c)
{
using SemanticGraph::Compositor;
@@ -890,7 +927,7 @@ namespace XSDFrontend
// Handle refs from last to first so that multiple insertions
// to an empty list (always front) end up in proper order.
//
- for (ElementGroupRefs::ReverseIterator i (refs.rbegin ());
+ for (ElementGroupRefs::reverse_iterator i (refs.rbegin ());
i != refs.rend (); ++i)
{
// Find our scope.
@@ -1051,8 +1088,8 @@ namespace XSDFrontend
// order to put it into the scope. Note that we cannot reuse
// the name from the prototype.
- UnsignedLong count;
- FrontendElements::Context& ctx (scope.context ());
+ unsigned long count;
+ SemanticGraph::Context& ctx (scope.context ());
if (!ctx.count ("any-name-count"))
{
@@ -1060,9 +1097,9 @@ namespace XSDFrontend
ctx.set ("any-name-count", count);
}
else
- count = ++(ctx.get<UnsignedLong> ("any-name-count"));
+ count = ++(ctx.get<unsigned long> ("any-name-count"));
- std::basic_ostringstream<WideChar> os;
+ std::basic_ostringstream<wchar_t> os;
os << "any #" << count;
NodeArgs<Scope, Scope::NamesIterator> na (scope, pos);
@@ -1126,7 +1163,7 @@ namespace XSDFrontend
return copy;
}
- Void
+ void
clone_attribute_group_content (AttributeGroupRef& ref,
SemanticGraph::Scope& s)
{
@@ -1213,8 +1250,8 @@ namespace XSDFrontend
// one in order to put it into the scope. Note that we cannot
// reuse the name from the attribute group.
- UnsignedLong count;
- FrontendElements::Context& ctx (s.context ());
+ unsigned long count;
+ SemanticGraph::Context& ctx (s.context ());
if (!ctx.count ("any-attribute-name-count"))
{
@@ -1222,9 +1259,9 @@ namespace XSDFrontend
ctx.set ("any-attribute-name-count", count);
}
else
- count = ++(ctx.get<UnsignedLong> ("any-attribute-name-count"));
+ count = ++(ctx.get<unsigned long> ("any-attribute-name-count"));
- std::basic_ostringstream<WideChar> os;
+ std::basic_ostringstream<wchar_t> os;
os << "any-attribute #" << count;
NodeArgs<Scope, Scope::NamesIterator> na (s, pos);
@@ -1256,7 +1293,7 @@ namespace XSDFrontend
private:
Schema& s_;
- Boolean& valid_;
+ bool& valid_;
NamespaceMap& cache_;
DefaultValues& default_values_;
@@ -1266,67 +1303,54 @@ namespace XSDFrontend
};
}
- //
- //
- struct FilePathComparator
- {
- Boolean
- operator () (SemanticGraph::Path const& x,
- SemanticGraph::Path const& y) const
- {
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- return x.native_file_string () < y.native_file_string ();
-#else
- return x.string () < y.string ();
-#endif
- }
- };
-
// Parser::Impl
//
- class Parser::Impl: public NonCopyable
+ class Parser::Impl
{
+ Impl (Impl const&);
+ Impl& operator= (Impl const&);
+
public:
~Impl ();
- Impl (Boolean proper_restriction,
- Boolean multiple_imports,
- Boolean full_schema_check,
+ Impl (bool proper_restriction,
+ bool multiple_imports,
+ bool full_schema_check,
LocationTranslator*,
const WarningSet*);
- Evptr<Schema>
+ auto_ptr<Schema>
parse (Path const&);
- Evptr<Schema>
+ auto_ptr<Schema>
parse (Paths const&);
- Evptr<Schema>
+ auto_ptr<Schema>
xml_schema (Path const&);
private:
- Void
+ void
fill_xml_schema (Schema&, Path const&);
private:
XML::AutoPtr<Xerces::DOMDocument>
- dom (SemanticGraph::Path const&, Boolean validate);
+ dom (SemanticGraph::Path const&, bool validate);
- Void
+ void
schema (XML::Element const&);
SemanticGraph::Annotation*
- annotation (Boolean process);
+ annotation (bool process);
- Void
+ void
import (XML::Element const&);
- Void
+ void
include (XML::Element const&);
- Void
- element_group (XML::Element const&, Boolean in_compositor);
+ void
+ element_group (XML::Element const&, bool in_compositor);
SemanticGraph::Type*
simple_type (XML::Element const&);
@@ -1340,7 +1364,7 @@ namespace XSDFrontend
SemanticGraph::Type*
restriction (XML::Element const& r, XML::Element const& type);
- Void
+ void
enumeration (XML::Element const&);
SemanticGraph::Type*
@@ -1350,47 +1374,47 @@ namespace XSDFrontend
all (XML::Element const&);
Choice*
- choice (XML::Element const&, Boolean in_compositor);
+ choice (XML::Element const&, bool in_compositor);
Sequence*
- sequence (XML::Element const&, Boolean in_compositor);
+ sequence (XML::Element const&, bool in_compositor);
- Void
+ void
simple_content (XML::Element const&);
- Void
+ void
complex_content (XML::Element const&, Complex&);
- Void
+ void
simple_content_extension (XML::Element const&);
- Void
+ void
simple_content_restriction (XML::Element const&);
- Void
+ void
complex_content_extension (XML::Element const&, Complex&);
- Void
+ void
complex_content_restriction (XML::Element const&, Complex&);
- Void
- element (XML::Element const&, Boolean global);
+ void
+ element (XML::Element const&, bool global);
- Void
- attribute (XML::Element const&, Boolean global);
+ void
+ attribute (XML::Element const&, bool global);
- Void
+ void
attribute_group (XML::Element const&);
- Void
+ void
any (XML::Element const&);
- Void
+ void
any_attribute (XML::Element const&);
private:
- Boolean
- is_disabled (Char const* warning)
+ bool
+ is_disabled (char const* warning)
{
return disabled_warnings_all_ ||
(disabled_warnings_ &&
@@ -1398,10 +1422,10 @@ namespace XSDFrontend
}
private:
- Boolean
+ bool
more () const
{
- Iterator const& it (iteration_state_.top ());
+ iterator const& it (iteration_state_.top ());
return it.l_->getLength () > it.i_;
}
@@ -1409,41 +1433,41 @@ namespace XSDFrontend
XML::Element
next ()
{
- Iterator& it (iteration_state_.top ());
+ iterator& it (iteration_state_.top ());
return XML::Element (
dynamic_cast<Xerces::DOMElement*> (it.l_->item (it.i_++)));
}
- Void
+ void
prev ()
{
- Iterator& it (iteration_state_.top ());
+ iterator& it (iteration_state_.top ());
if (it.i_)
--it.i_;
}
- Void
+ void
push (XML::Element const& e)
{
iteration_state_.push (e.dom_element ());
}
- Void
+ void
pop ()
{
iteration_state_.pop ();
}
private:
- Void
+ void
push_scope (SemanticGraph::Scope& s)
{
scope_stack_.push (&s);
}
- Void
+ void
pop_scope ()
{
scope_stack_.pop ();
@@ -1456,13 +1480,13 @@ namespace XSDFrontend
}
private:
- Void
+ void
push_compositor (SemanticGraph::Compositor& c)
{
compositor_stack_.push (&c);
}
- Void
+ void
pop_compositor ()
{
assert (!compositor_stack_.empty ());
@@ -1477,30 +1501,32 @@ namespace XSDFrontend
}
private:
- UnsignedLong
+ static unsigned long const unbounded = ~static_cast<unsigned long> (0);
+
+ unsigned long
parse_min (String const& m)
{
if (m.empty ())
return 1;
- UnsignedLong v;
- std::basic_istringstream<WideChar> is (m);
+ unsigned long v;
+ std::basic_istringstream<wchar_t> is (m);
is >> v;
return v;
}
- UnsignedLong
+ unsigned long
parse_max (String const& m)
{
if (m.empty ())
return 1;
if (m == L"unbounded")
- return 0;
+ return unbounded;
- UnsignedLong v;
- std::basic_istringstream<WideChar> is (m);
+ unsigned long v;
+ std::basic_istringstream<wchar_t> is (m);
is >> v;
return v;
@@ -1590,32 +1616,32 @@ namespace XSDFrontend
private:
XML::PtrVector<Xerces::DOMDocument>* dom_docs_;
- struct Iterator
+ struct iterator
{
- Iterator (Xerces::DOMElement* e)
+ iterator (Xerces::DOMElement* e)
: l_ (e->getChildNodes ()), i_ (0)
{
}
Xerces::DOMNodeList* l_;
- Size i_;
+ size_t i_;
};
- Cult::Containers::Stack<Iterator> iteration_state_;
+ std::stack<iterator> iteration_state_;
SemanticGraph::Schema* s_; // root schema file
SemanticGraph::Schema* cur_; // current schema file
- Boolean cur_chameleon_; // whethere cur_ is chameleon
+ bool cur_chameleon_; // whethere cur_ is chameleon
SemanticGraph::Schema* xml_schema_; // XML Schema file
SemanticGraph::Path xml_schema_path_;
//
//
- Cult::Containers::Stack<SemanticGraph::Scope*> scope_stack_;
+ std::stack<SemanticGraph::Scope*> scope_stack_;
//
//
- Cult::Containers::Stack<SemanticGraph::Compositor*> compositor_stack_;
+ std::stack<SemanticGraph::Compositor*> compositor_stack_;
// Map of absolute file path and namespace pair to a Schema node.
@@ -1628,18 +1654,10 @@ namespace XSDFrontend
}
- friend Boolean
+ friend bool
operator< (SchemaId const& x, SchemaId const& y)
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- return x.path_.native_file_string () < y.path_.native_file_string ()
- || (x.path_.native_file_string () == y.path_.native_file_string ()
- && x.ns_ < y.ns_);
-#else
- return x.path_.string () < y.path_.string ()
- || (x.path_.string () == y.path_.string ()
- && x.ns_ < y.ns_);
-#endif
+ return x.path_ < y.path_ || (x.path_ == y.path_ && x.ns_ < y.ns_);
}
private:
@@ -1648,20 +1666,33 @@ namespace XSDFrontend
};
- typedef
- Cult::Containers::Map<SchemaId, SemanticGraph::Schema*>
- SchemaMap;
-
+ typedef std::map<SchemaId, SemanticGraph::Schema*> SchemaMap;
SchemaMap schema_map_;
// Path stack for diagnostic.
//
- Cult::Containers::Stack<SemanticGraph::Path> file_stack_;
+ struct PathPair
+ {
+ PathPair (SemanticGraph::Path const& r, SemanticGraph::Path const& a)
+ : rel (r), abs (a)
+ {
+ }
+
+ SemanticGraph::Path rel, abs;
+ };
+
+ std::stack<PathPair> file_stack_;
SemanticGraph::Path const&
file ()
{
- return file_stack_.top ();
+ return file_stack_.top ().rel;
+ }
+
+ SemanticGraph::Path const&
+ abs_file ()
+ {
+ return file_stack_.top ().abs;
}
// Members with default/fixed values (needed for QName handling).
@@ -1669,26 +1700,26 @@ namespace XSDFrontend
DefaultValues default_values_;
private:
- Boolean qualify_attribute_;
- Boolean qualify_element_;
+ bool qualify_attribute_;
+ bool qualify_element_;
- Boolean valid_;
+ bool valid_;
- Boolean proper_restriction_;
- Boolean multiple_imports_;
- Boolean full_schema_check_;
+ bool proper_restriction_;
+ bool multiple_imports_;
+ bool full_schema_check_;
LocationTranslator* loc_translator_;
const WarningSet* disabled_warnings_;
- Boolean disabled_warnings_all_;
+ bool disabled_warnings_all_;
NamespaceMap* cache_;
};
Parser::Impl::
- Impl (Boolean proper_restriction,
- Boolean multiple_imports,
- Boolean full_schema_check,
+ Impl (bool proper_restriction,
+ bool multiple_imports,
+ bool full_schema_check,
LocationTranslator* t,
const WarningSet* dw)
: s_ (0),
@@ -1730,7 +1761,7 @@ namespace XSDFrontend
return node;
}
- Void Parser::Impl::
+ void Parser::Impl::
fill_xml_schema (Schema& s, Path const& path)
{
Namespace& ns (s.new_node<Namespace> (path, 1, 1));
@@ -1829,12 +1860,12 @@ namespace XSDFrontend
}
- Evptr<Schema> Parser::Impl::
+ auto_ptr<Schema> Parser::Impl::
xml_schema (Path const& tu)
{
valid_ = true;
- Evptr<Schema> rs (new Schema (tu, 1, 1));
+ auto_ptr<Schema> rs (new Schema (tu, 1, 1));
fill_xml_schema (*rs, tu);
if (!valid_)
@@ -1842,7 +1873,7 @@ namespace XSDFrontend
return rs;
}
- Evptr<Schema> Parser::Impl::
+ auto_ptr<Schema> Parser::Impl::
parse (Path const& tu)
{
valid_ = true;
@@ -1861,12 +1892,12 @@ namespace XSDFrontend
throw InvalidSchema ();
XML::Element root (d->getDocumentElement ());
- String ns (root["targetNamespace"]);
+ String ns (trim (root["targetNamespace"]));
if (trace_)
wcout << "target namespace: " << ns << endl;
- Evptr<Schema> rs (new Schema (tu, root.line (), root.column ()));
+ auto_ptr<Schema> rs (new Schema (tu, root.line (), root.column ()));
// Implied schema with fundamental types.
//
@@ -1878,16 +1909,18 @@ namespace XSDFrontend
// Parse.
//
{
- // Enter the file into schema_map_.
+ // Enter the file into schema_map_. Do normalize() before
+ // complete() to avoid hitting system path limits with '..'
+ // directories.
//
- Path abs_path (system_complete (tu));
- abs_path.normalize ();
+ Path abs_path (tu);
+ abs_path.normalize ().complete ();
schema_map_[SchemaId (abs_path, ns)] = rs.get ();
rs->context ().set ("absolute-path", abs_path);
s_ = cur_ = rs.get ();
{
- file_stack_.push (tu);
+ file_stack_.push (PathPair (tu, abs_path));
{
push_scope (
@@ -1919,7 +1952,7 @@ namespace XSDFrontend
struct Uses: Traversal::Uses
{
- virtual Void
+ virtual void
traverse (Type& u)
{
Schema& s (u.schema ());
@@ -1945,24 +1978,24 @@ namespace XSDFrontend
Traversal::Element,
Traversal::Member
{
- AnonymousMember (Traversal::NodeDispatcherBase& d)
+ AnonymousMember (Traversal::NodeDispatcher& d)
{
belongs_.node_traverser (d);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Attribute& a)
{
traverse_member (a);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Element& e)
{
traverse_member (e);
}
- Void
+ void
traverse_member (SemanticGraph::Member& m)
{
if (m.typed_p () &&
@@ -1983,12 +2016,12 @@ namespace XSDFrontend
struct AnonymousBase: Traversal::Type
{
- AnonymousBase (Traversal::NodeDispatcherBase& d)
+ AnonymousBase (Traversal::NodeDispatcher& d)
: base_ (d)
{
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Type& t)
{
if (!t.named_p ())
@@ -1996,7 +2029,7 @@ namespace XSDFrontend
}
private:
- Traversal::NodeDispatcherBase& base_;
+ Traversal::NodeDispatcher& base_;
} anonymous_base (resolver);
ns_names >> resolver;
@@ -2020,7 +2053,7 @@ namespace XSDFrontend
//
if (valid_)
{
- for (DefaultValues::ConstIterator i (default_values_.begin ()),
+ for (DefaultValues::const_iterator i (default_values_.begin ()),
e (default_values_.end ()); i != e; ++i)
{
SemanticGraph::Member& m (**i);
@@ -2068,7 +2101,7 @@ namespace XSDFrontend
return rs;
}
- Evptr<Schema> Parser::Impl::
+ auto_ptr<Schema> Parser::Impl::
parse (Paths const& paths)
{
valid_ = true;
@@ -2081,7 +2114,7 @@ namespace XSDFrontend
NamespaceMap cache;
cache_ = &cache;
- Evptr<Schema> rs (new Schema ("", 0, 0));
+ auto_ptr<Schema> rs (new Schema (Path (), 0, 0));
// Implied schema with fundamental types.
//
@@ -2094,7 +2127,7 @@ namespace XSDFrontend
//
s_ = rs.get ();
- for (Paths::ConstIterator i (paths.begin ()); i != paths.end (); ++i)
+ for (Paths::const_iterator i (paths.begin ()); i != paths.end (); ++i)
{
Path const& tu (*i);
XML::AutoPtr<Xerces::DOMDocument> d (dom (tu, true));
@@ -2103,15 +2136,17 @@ namespace XSDFrontend
throw InvalidSchema ();
XML::Element root (d->getDocumentElement ());
- String ns (root["targetNamespace"]);
+ String ns (trim (root["targetNamespace"]));
if (trace_)
wcout << "target namespace: " << ns << endl;
- // Check if we already have this schema.
+ // Check if we already have this schema. Do normalize() before
+ // complete() to avoid hitting system path limits with '..'
+ // directories.
//
- Path abs_path (system_complete (tu));
- abs_path.normalize ();
+ Path abs_path (tu);
+ abs_path.normalize ().complete ();
SchemaId schema_id (abs_path, ns);
if (schema_map_.find (schema_id) != schema_map_.end ())
@@ -2129,7 +2164,7 @@ namespace XSDFrontend
cur_ = &s;
{
- file_stack_.push (tu);
+ file_stack_.push (PathPair (tu, abs_path));
{
push_scope (
@@ -2166,7 +2201,7 @@ namespace XSDFrontend
struct Uses: Traversal::Uses
{
- virtual Void
+ virtual void
traverse (Type& u)
{
Schema& s (u.schema ());
@@ -2192,24 +2227,24 @@ namespace XSDFrontend
Traversal::Element,
Traversal::Member
{
- AnonymousMember (Traversal::NodeDispatcherBase& d)
+ AnonymousMember (Traversal::NodeDispatcher& d)
{
belongs_.node_traverser (d);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Attribute& a)
{
traverse_member (a);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Element& e)
{
traverse_member (e);
}
- virtual Void
+ virtual void
traverse_member (SemanticGraph::Member& m)
{
if (m.typed_p () &&
@@ -2230,12 +2265,12 @@ namespace XSDFrontend
struct AnonymousBase: Traversal::Type
{
- AnonymousBase (Traversal::NodeDispatcherBase& d)
+ AnonymousBase (Traversal::NodeDispatcher& d)
: base_ (d)
{
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Type& t)
{
if (!t.named_p ())
@@ -2243,7 +2278,7 @@ namespace XSDFrontend
}
private:
- Traversal::NodeDispatcherBase& base_;
+ Traversal::NodeDispatcher& base_;
} anonymous_base (resolver);
ns_names >> resolver;
@@ -2267,7 +2302,7 @@ namespace XSDFrontend
//
if (valid_)
{
- for (DefaultValues::ConstIterator i (default_values_.begin ()),
+ for (DefaultValues::const_iterator i (default_values_.begin ()),
e (default_values_.end ()); i != e; ++i)
{
SemanticGraph::Member& m (**i);
@@ -2315,17 +2350,21 @@ namespace XSDFrontend
return rs;
}
- Void Parser::Impl::
+ void Parser::Impl::
schema (XML::Element const& s)
{
- Boolean old_qa (qualify_attribute_);
- Boolean old_qe (qualify_element_);
+ bool old_qa (qualify_attribute_);
+ bool old_qe (qualify_element_);
- if (String af = s["attributeFormDefault"])
+ if (String af = trim (s["attributeFormDefault"]))
qualify_attribute_ = af == L"qualified";
+ else
+ qualify_attribute_ = false;
- if (String ef = s["elementFormDefault"])
+ if (String ef = trim (s["elementFormDefault"]))
qualify_element_ = ef == L"qualified";
+ else
+ qualify_element_ = false;
push (s);
@@ -2367,52 +2406,43 @@ namespace XSDFrontend
qualify_element_ = old_qe;
}
- Void Parser::Impl::
+ void Parser::Impl::
import (XML::Element const& i)
{
NarrowString loc (
- XML::transcode_to_narrow (
- i.dom_element ()->getAttribute (
- XML::XMLChString ("schemaLocation").c_str ())));
+ trim (
+ XML::transcode_to_narrow (
+ i.dom_element ()->getAttribute (
+ XML::XMLChString ("schemaLocation").c_str ()))));
if (loc_translator_)
loc = loc_translator_->translate (loc);
+ String ins (trim (i["namespace"]));
+
// Ignore empty <import>.
//
- if (!loc && !i["namespace"])
+ if (!loc && !ins)
return;
Path path, rel_path, abs_path;
try
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- try
- {
- path = Path (loc);
- }
- catch (InvalidPath const&)
- {
- // Retry as a native path.
- //
- path = Path (loc, boost::filesystem::native);
- }
-#else
- // The new ABI does not have a fallback native representation
- path = Path (loc.c_str());
-#endif
+ path = Path (loc);
- if (path.is_complete ())
+ if (path.absolute ())
{
abs_path = rel_path = path;
+ abs_path.normalize ();
}
else
{
- rel_path = file ().branch_path () / path;
- abs_path = system_complete (rel_path);
+ // Do normalize() before complete() to avoid hitting system path
+ // limits with '..' directories.
+ //
+ abs_path = rel_path = file ().directory () / path;
+ abs_path.normalize ().complete ();
}
-
- abs_path.normalize ();
}
catch (InvalidPath const&)
{
@@ -2424,7 +2454,7 @@ namespace XSDFrontend
return;
}
- SchemaId schema_id (abs_path, i["namespace"]);
+ SchemaId schema_id (abs_path, ins);
if (schema_map_.find (schema_id) != schema_map_.end ())
{
@@ -2438,7 +2468,7 @@ namespace XSDFrontend
if (XML::AutoPtr<Xerces::DOMDocument> d = dom (abs_path, false))
{
XML::Element r (d->getDocumentElement ());
- String ns (r["targetNamespace"]);
+ String ns (trim (r["targetNamespace"]));
if (trace_)
wcout << "target namespace: " << ns << endl;
@@ -2451,12 +2481,12 @@ namespace XSDFrontend
s.context ().set ("absolute-path", abs_path);
Schema* old_cur (cur_);
- Boolean old_cur_chameleon (cur_chameleon_);
+ bool old_cur_chameleon (cur_chameleon_);
cur_ = &s;
cur_chameleon_ = false;
{
- file_stack_.push (rel_path);
+ file_stack_.push (PathPair (rel_path, abs_path));
{
push_scope (
@@ -2480,13 +2510,14 @@ namespace XSDFrontend
}
}
- Void Parser::Impl::
+ void Parser::Impl::
include (XML::Element const& i)
{
NarrowString loc (
- XML::transcode_to_narrow (
- i.dom_element ()->getAttribute (
- XML::XMLChString ("schemaLocation").c_str ())));
+ trim (
+ XML::transcode_to_narrow (
+ i.dom_element ()->getAttribute (
+ XML::XMLChString ("schemaLocation").c_str ()))));
if (loc_translator_)
loc = loc_translator_->translate (loc);
@@ -2494,33 +2525,21 @@ namespace XSDFrontend
Path path, rel_path, abs_path;
try
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- try
- {
- path = Path (loc);
- }
- catch (InvalidPath const&)
- {
- // Retry as a native path.
- //
- path = Path (loc, boost::filesystem::native);
- }
-#else
- // The new API does not have a fallback native representation.
- path = Path (loc.c_str());
-#endif
+ path = Path (loc);
- if (path.is_complete ())
+ if (path.absolute ())
{
abs_path = rel_path = path;
+ abs_path.normalize ();
}
else
{
- rel_path = file ().branch_path () / path;
- abs_path = system_complete (rel_path);
+ // Do normalize() before complete() to avoid hitting system path
+ // limits with '..' directories.
+ //
+ abs_path = rel_path = file ().directory () / path;
+ abs_path.normalize ().complete ();
}
-
- abs_path.normalize ();
}
catch (InvalidPath const&)
{
@@ -2559,7 +2578,7 @@ namespace XSDFrontend
if (XML::AutoPtr<Xerces::DOMDocument> d = dom (abs_path, false))
{
XML::Element r (d->getDocumentElement ());
- String ns (r["targetNamespace"]), cur_ns;
+ String ns (trim (r["targetNamespace"])), cur_ns;
Schema& s (s_->new_node<Schema> (rel_path, r.line (), r.column ()));
s_->new_edge<Implies> (s, *xml_schema_, xml_schema_path_);
@@ -2567,7 +2586,7 @@ namespace XSDFrontend
schema_map_[schema_id] = &s;
s.context ().set ("absolute-path", abs_path);
- Boolean chameleon (false);
+ bool chameleon (false);
if (ns.empty () && !(cur_ns = (cur_->names_begin ())->name ()).empty ())
{
@@ -2587,12 +2606,12 @@ namespace XSDFrontend
wcout << "target namespace: " << ns << endl;
Schema* old_cur (cur_);
- Boolean old_cur_chameleon (cur_chameleon_);
+ bool old_cur_chameleon (cur_chameleon_);
cur_ = &s;
cur_chameleon_ = chameleon;
{
- file_stack_.push (rel_path);
+ file_stack_.push (PathPair (rel_path, abs_path));
{
push_scope (
@@ -2616,10 +2635,10 @@ namespace XSDFrontend
}
}
- Void Parser::Impl::
- element_group (XML::Element const& g, Boolean in_compositor)
+ void Parser::Impl::
+ element_group (XML::Element const& g, bool in_compositor)
{
- if (String name = g["name"])
+ if (String name = trim (g["name"]))
{
ElementGroup& group (
s_->new_node<ElementGroup> (file (), g.line (), g.column ()));
@@ -2659,7 +2678,7 @@ namespace XSDFrontend
pop ();
pop_scope ();
}
- else if (String ref = g["ref"])
+ else if (String ref = trim (g["ref"]))
{
if (trace_)
wcout << "element-group-ref " << ref << endl;
@@ -2681,10 +2700,15 @@ namespace XSDFrontend
{
Compositor& c (compositor ());
+ unsigned long min (parse_min (trim (g["minOccurs"])));
+ unsigned long max (parse_max (trim (g["maxOccurs"])));
+
ElementGroupRef ref (
uq_name, ns_name,
- parse_min (g["minOccurs"]), parse_max (g["maxOccurs"]),
- c, scope ());
+ min,
+ max == unbounded ? 0 : max,
+ c,
+ scope ());
if (!c.context ().count ("element-group-refs"))
c.context ().set ("element-group-refs", ElementGroupRefs ());
@@ -2699,10 +2723,11 @@ namespace XSDFrontend
Scope& s (scope ());
+ unsigned long min (parse_min (trim (g["minOccurs"])));
+ unsigned long max (parse_max (trim (g["maxOccurs"])));
+
ElementGroupRef ref (
- uq_name, ns_name,
- parse_min (g["minOccurs"]), parse_max (g["maxOccurs"]),
- s);
+ uq_name, ns_name, min, max == unbounded ? 0 : max, s);
s.context ().set ("element-group-ref", ref);
}
@@ -2782,7 +2807,7 @@ namespace XSDFrontend
List& node (s_->new_node<List> (file (), t.line (), t.column ()));
- if (String item_type = l["itemType"])
+ if (String item_type = trim (l["itemType"]))
{
if (trace_)
wcout << "item type: " << fq_name (l, item_type) << endl;
@@ -2832,7 +2857,7 @@ namespace XSDFrontend
pop ();
}
- if (String name = t["name"])
+ if (String name = trim (t["name"]))
s_->new_edge<Names> (scope (), node, name);
return &node;
@@ -2846,8 +2871,8 @@ namespace XSDFrontend
// Find first non-space character.
//
- Size
- find_ns (const WideChar* s, Size size, Size pos)
+ size_t
+ find_ns (const wchar_t* s, size_t size, size_t pos)
{
while (pos < size &&
(s[pos] == 0x20 || // space
@@ -2861,8 +2886,8 @@ namespace XSDFrontend
// Find first space character.
//
- Size
- find_s (const WideChar* s, Size size, Size pos)
+ size_t
+ find_s (const wchar_t* s, size_t size, size_t pos)
{
while (pos < size &&
s[pos] != 0x20 && // space
@@ -2883,26 +2908,26 @@ namespace XSDFrontend
Union& node (s_->new_node<Union> (file (), t.line (), t.column ()));
- Boolean has_members (false);
+ bool has_members (false);
- if (String members = u["memberTypes"])
+ if (String members = trim (u["memberTypes"]))
{
// Don't bother trying to resolve member types at this point
// since the order is important so we would have to insert
// the late resolutions into specific places. It is simpler
// to just do the whole resolution later.
//
- const WideChar* data (members.c_str ());
- Size size (members.size ());
+ const wchar_t* data (members.c_str ());
+ size_t size (members.size ());
UnionMemberTypes* m (0);
// Traverse the type list while logically collapsing spaces.
//
- for (Size i (find_ns (data, size, 0)); i != String::npos;)
+ for (size_t i (find_ns (data, size, 0)); i != String::npos;)
{
String s;
- Size j (find_s (data, size, i));
+ size_t j (find_s (data, size, i));
if (j != String::npos)
{
@@ -2985,7 +3010,7 @@ namespace XSDFrontend
valid_ = false;
}
- if (String name = t["name"])
+ if (String name = trim (t["name"]))
s_->new_edge<Names> (scope (), node, name);
return &node;
@@ -2994,7 +3019,7 @@ namespace XSDFrontend
Type* Parser::Impl::
restriction (XML::Element const& r, XML::Element const& t)
{
- String base (r["base"]);
+ String base (trim (r["base"]));
Type* base_type (0);
if (base)
@@ -3009,7 +3034,7 @@ namespace XSDFrontend
annotation (false);
- Boolean enum_ (false);
+ bool enum_ (false);
if (!base)
{
@@ -3051,6 +3076,7 @@ namespace XSDFrontend
Facets facets;
Restricts* restricts (0);
+ String pattern;
while (more ())
{
@@ -3077,7 +3103,7 @@ namespace XSDFrontend
else
restricts = set_type<Restricts> (base, r, node);
- if (String name = t["name"])
+ if (String name = trim (t["name"]))
s_->new_edge<Names> (scope (), static_cast<Nameable&> (node), name);
rv = &node;
@@ -3094,10 +3120,16 @@ namespace XSDFrontend
name == L"length" ||
name == L"minLength" ||
name == L"maxLength" ||
- name == L"whiteSpace" ||
- name == L"pattern")
+ name == L"whiteSpace")
+ {
+ facets[name] = trim (e["value"]);
+ }
+ else if (name == L"pattern")
{
- facets[name] = e["value"];
+ if (pattern)
+ pattern += L'|';
+
+ pattern += e["value"];
}
else
{
@@ -3109,6 +3141,9 @@ namespace XSDFrontend
}
}
+ if (pattern)
+ facets[L"pattern"] = pattern;
+
if (enum_)
pop_scope ();
else
@@ -3120,7 +3155,7 @@ namespace XSDFrontend
else
restricts = set_type<Restricts> (base, r, node);
- if (String name = t["name"])
+ if (String name = trim (t["name"]))
s_->new_edge<Names> (scope (), node, name);
rv = &node;
@@ -3139,7 +3174,7 @@ namespace XSDFrontend
return rv;
}
- Void Parser::Impl::
+ void Parser::Impl::
enumeration (XML::Element const& e)
{
String value (e["value"]);
@@ -3169,9 +3204,10 @@ namespace XSDFrontend
Complex& node (s_->new_node<Complex> (file (), t.line (), t.column ()));
- node.mixed_p (t["mixed"] == L"true" || t["mixed"] == L"1");
+ if (String m = trim (t["mixed"]))
+ node.mixed_p (m == L"true" || m == L"1");
- if (String name = t["name"])
+ if (String name = trim (t["name"]))
s_->new_edge<Names> (scope (), node, name);
r = &node;
@@ -3211,8 +3247,14 @@ namespace XSDFrontend
}
if (c)
- s_->new_edge<ContainsCompositor> (
- node, *c, parse_min (e["minOccurs"]), parse_max (e["maxOccurs"]));
+ {
+ unsigned long min (parse_min (trim (e["minOccurs"])));
+ unsigned long max (parse_max (trim (e["maxOccurs"])));
+
+ if (!(min == 0 && max == 0))
+ s_->new_edge<ContainsCompositor> (
+ node, *c, min, max == unbounded ? 0 : max);
+ }
while (more ())
{
@@ -3277,15 +3319,18 @@ namespace XSDFrontend
}
Choice* Parser::Impl::
- choice (XML::Element const& c, Boolean in_compositor)
+ choice (XML::Element const& c, bool in_compositor)
{
Choice& node (s_->new_node<Choice> (file (), c.line (), c.column ()));
if (in_compositor)
{
- s_->new_edge<ContainsParticle> (
- compositor (), node,
- parse_min (c["minOccurs"]), parse_max (c["maxOccurs"]));
+ unsigned long min (parse_min (trim (c["minOccurs"])));
+ unsigned long max (parse_max (trim (c["maxOccurs"])));
+
+ if (!(min == 0 && max == 0))
+ s_->new_edge<ContainsParticle> (
+ compositor (), node, min, max == unbounded ? 0 : max);
}
push_compositor (node);
@@ -3321,15 +3366,18 @@ namespace XSDFrontend
}
Sequence* Parser::Impl::
- sequence (XML::Element const& s, Boolean in_compositor)
+ sequence (XML::Element const& s, bool in_compositor)
{
Sequence& node (s_->new_node<Sequence> (file (), s.line (), s.column ()));
if (in_compositor)
{
- s_->new_edge<ContainsParticle> (
- compositor (), node,
- parse_min (s["minOccurs"]), parse_max (s["maxOccurs"]));
+ unsigned long min (parse_min (trim (s["minOccurs"])));
+ unsigned long max (parse_max (trim (s["maxOccurs"])));
+
+ if (!(min == 0 && max == 0))
+ s_->new_edge<ContainsParticle> (
+ compositor (), node, min, max == unbounded ? 0 : max);
}
push_compositor (node);
@@ -3364,7 +3412,7 @@ namespace XSDFrontend
return &node;
}
- Void Parser::Impl::
+ void Parser::Impl::
simple_content (XML::Element const& c)
{
push (c);
@@ -3387,13 +3435,11 @@ namespace XSDFrontend
pop ();
}
- Void Parser::Impl::
+ void Parser::Impl::
complex_content (XML::Element const& c, Complex& type)
{
- if (c.attribute_p ("mixed"))
- {
- type.mixed_p (c["mixed"] == L"true" || c["mixed"] == L"1");
- }
+ if (String m = trim (c["mixed"]))
+ type.mixed_p (m == L"true" || m == L"1");
push (c);
@@ -3415,13 +3461,13 @@ namespace XSDFrontend
pop ();
}
- Void Parser::Impl::
+ void Parser::Impl::
simple_content_extension (XML::Element const& e)
{
if (trace_)
wcout << "extension base: " << fq_name (e, e["base"]) << endl;
- set_type<Extends> (e["base"], e, dynamic_cast<Complex&> (scope ()));
+ set_type<Extends> (trim (e["base"]), e, dynamic_cast<Complex&> (scope ()));
push (e);
@@ -3447,11 +3493,10 @@ namespace XSDFrontend
pop ();
}
- Void Parser::Impl::
+ void Parser::Impl::
simple_content_restriction (XML::Element const& r)
{
- String base (r["base"]);
- Type* base_type (0);
+ String base (trim (r["base"]));
if (trace_ && base)
wcout << "restriction base: " << fq_name (r, base) << endl;
@@ -3471,7 +3516,7 @@ namespace XSDFrontend
if (trace_)
wcout << name << endl;
- if (name == L"simpleType") base_type = simple_type (e); else
+ if (name == L"simpleType") simple_type (e); else
{
wcerr << file () << ":" << e.line () << ":" << e.column () << ": "
<< "error: expected 'simpleType' instead of "
@@ -3497,6 +3542,7 @@ namespace XSDFrontend
}
Facets facets;
+ String pattern;
while (more ())
{
@@ -3532,10 +3578,16 @@ namespace XSDFrontend
name == L"length" ||
name == L"minLength" ||
name == L"maxLength" ||
- name == L"whiteSpace" ||
- name == L"pattern")
+ name == L"whiteSpace")
+ {
+ facets[name] = trim (e["value"]);
+ }
+ else if (name == L"pattern")
{
- facets[name] = e["value"];
+ if (pattern)
+ pattern += L'|';
+
+ pattern += e["value"];
}
else if (name == L"attribute")
{
@@ -3562,6 +3614,9 @@ namespace XSDFrontend
}
}
+ if (pattern)
+ facets[L"pattern"] = pattern;
+
Complex& type (dynamic_cast<Complex&> (scope ()));
Restricts* restricts = set_type<Restricts> (base, r, type);
@@ -3576,13 +3631,13 @@ namespace XSDFrontend
pop ();
}
- Void Parser::Impl::
+ void Parser::Impl::
complex_content_extension (XML::Element const& e, Complex& type)
{
if (trace_)
wcout << "extension base: " << fq_name (e, e["base"]) << endl;
- set_type<Extends> (e["base"], e, dynamic_cast<Complex&> (scope ()));
+ set_type<Extends> (trim (e["base"]), e, dynamic_cast<Complex&> (scope ()));
push (e);
@@ -3609,8 +3664,14 @@ namespace XSDFrontend
}
if (c)
- s_->new_edge<ContainsCompositor> (
- type, *c, parse_min (e["minOccurs"]), parse_max (e["maxOccurs"]));
+ {
+ unsigned long min (parse_min (trim (e["minOccurs"])));
+ unsigned long max (parse_max (trim (e["maxOccurs"])));
+
+ if (!(min == 0 && max == 0))
+ s_->new_edge<ContainsCompositor> (
+ type, *c, min, max == unbounded ? 0 : max);
+ }
while (more ())
{
@@ -3633,13 +3694,16 @@ namespace XSDFrontend
pop ();
}
- Void Parser::Impl::
+ void Parser::Impl::
complex_content_restriction (XML::Element const& e, Complex& type)
{
if (trace_)
wcout << "restriction base: " << fq_name (e, e["base"]) << endl;
- set_type<Restricts> (e["base"], e, dynamic_cast<Complex&> (scope ()));
+ set_type<Restricts> (
+ trim (e["base"]),
+ e,
+ dynamic_cast<Complex&> (scope ()));
// @@
// For now we simply skip the contents unless the base is anyType
@@ -3650,7 +3714,7 @@ namespace XSDFrontend
//
if (!proper_restriction_)
{
- String base (e["base"]);
+ String base (trim (e["base"]));
String uq_name (unqualified_name (base));
String ns_name (namespace_name (e, base));
@@ -3683,8 +3747,14 @@ namespace XSDFrontend
}
if (c)
- s_->new_edge<ContainsCompositor> (
- type, *c, parse_min (e["minOccurs"]), parse_max (e["maxOccurs"]));
+ {
+ unsigned long min (parse_min (trim (e["minOccurs"])));
+ unsigned long max (parse_max (trim (e["maxOccurs"])));
+
+ if (!(min == 0 && max == 0))
+ s_->new_edge<ContainsCompositor> (
+ type, *c, min, max == unbounded ? 0 : max);
+ }
while (more ())
{
@@ -3707,18 +3777,18 @@ namespace XSDFrontend
pop ();
}
- Void Parser::Impl::
- element (XML::Element const& e, Boolean global)
+ void Parser::Impl::
+ element (XML::Element const& e, bool global)
{
- Boolean qualified (global ? true : qualify_element_);
+ bool qualified (global ? true : qualify_element_);
- if (String form = e["form"])
+ if (String form = trim (e["form"]))
qualified = form == L"qualified";
if (trace_)
wcout << "element qualified: " << qualified << endl;
- if (String name = e["name"])
+ if (String name = trim (e["name"]))
{
if (trace_)
wcout << "element name '" << name << "'" << endl;
@@ -3727,17 +3797,24 @@ namespace XSDFrontend
s_->new_node<Element> (
file (), e.line (), e.column (), global, qualified));
- s_->new_edge<Names> (scope (), node, name);
-
- if (qualified)
- s_->new_edge<BelongsToNamespace> (node, cur_ns ());
-
if (!global)
{
- s_->new_edge<ContainsParticle> (
- compositor (), node,
- parse_min (e["minOccurs"]), parse_max (e["maxOccurs"]));
+ unsigned long min (parse_min (trim (e["minOccurs"])));
+ unsigned long max (parse_max (trim (e["maxOccurs"])));
+
+ if (!(min == 0 && max == 0))
+ {
+ s_->new_edge<Names> (scope (), node, name);
+
+ s_->new_edge<ContainsParticle> (
+ compositor (), node, min, max == unbounded ? 0 : max);
+ }
}
+ else
+ s_->new_edge<Names> (scope (), node, name);
+
+ if (qualified)
+ s_->new_edge<BelongsToNamespace> (node, cur_ns ());
// Default and fixed values are mutually exclusive.
//
@@ -3752,13 +3829,16 @@ namespace XSDFrontend
default_values_.push_back (&node);
}
+ bool subst (false);
if (global)
{
- if (String sg = e["substitutionGroup"])
+ if (String sg = trim (e["substitutionGroup"]))
{
if (trace_)
wcout << "substitutes " << sg << endl;
+ subst = true;
+
try
{
String uq_name (unqualified_name (sg));
@@ -3778,7 +3858,7 @@ namespace XSDFrontend
}
}
- if (String type = e["type"])
+ if (String type = trim (e["type"]))
{
if (trace_)
wcout << "element type " << fq_name (e, type) << endl;
@@ -3827,10 +3907,12 @@ namespace XSDFrontend
if (t)
s_->new_edge<Belongs> (node, *t);
}
- else
+ // By default the type is anyType unless this element is a
+ // member of a substitution group, in which case it has the
+ // same type as the element it substiutes.
+ //
+ else if (!subst)
{
- // anyType
- //
if (!is_disabled ("F001"))
{
wcerr << file () << ":" << e.line () << ":" << e.column () << ": "
@@ -3851,18 +3933,14 @@ namespace XSDFrontend
pop ();
}
}
- else if (String ref = e["ref"])
+ else if (String ref = trim (e["ref"]))
{
Element& node (
s_->new_node<Element> (
file (), e.line (), e.column (), true, true));
- // Ref can only be in compositor.
- //
- s_->new_edge<ContainsParticle> (
- compositor (), node,
- parse_min (e["minOccurs"]), parse_max (e["maxOccurs"]));
-
+ unsigned long min (parse_min (trim (e["minOccurs"])));
+ unsigned long max (parse_max (trim (e["maxOccurs"])));
// Default and fixed values are mutually exclusive.
//
@@ -3886,119 +3964,127 @@ namespace XSDFrontend
pop ();
- // Try to resolve the prototype.
- //
- try
+ if (!(min == 0 && max == 0))
{
- String uq_name (unqualified_name (ref));
- String ns_name (namespace_name (e, ref));
-
- s_->new_edge<Names> (scope (), node, uq_name);
-
- Element& prot (resolve<Element> (ns_name, uq_name, *s_, *cache_));
- s_->new_edge<BelongsToNamespace> (node, prot.namespace_ ());
+ // Ref can only be in compositor.
+ //
+ s_->new_edge<ContainsParticle> (
+ compositor (), node, min, max == unbounded ? 0 : max);
- // Copy substitution group information if any.
+ // Try to resolve the prototype.
//
- if (prot.context ().count ("substitution-ns-name"))
+ try
{
- node.context ().set (
- "substitution-ns-name",
- prot.context ().get<String> ("substitution-ns-name"));
+ String uq_name (unqualified_name (ref));
+ String ns_name (namespace_name (e, ref));
- node.context ().set (
- "substitution-uq-name",
- prot.context ().get<String> ("substitution-uq-name"));
- }
+ s_->new_edge<Names> (scope (), node, uq_name);
- // Transfer default and fixed values if the ref declaration hasn't
- // defined its own.
- //
- if (!node.default_p ())
- {
- if (prot.fixed_p ())
- node.fixed (prot.value ());
- else if (prot.default_p ())
- node.default_ (prot.value ());
+ Element& prot (resolve<Element> (ns_name, uq_name, *s_, *cache_));
+ s_->new_edge<BelongsToNamespace> (node, prot.namespace_ ());
- if (node.default_p ())
+ // Copy substitution group information if any.
+ //
+ if (prot.context ().count ("substitution-ns-name"))
{
node.context ().set (
- "dom-node",
- prot.context ().get<Xerces::DOMElement*> ("dom-node"));
- default_values_.push_back (&node);
+ "substitution-ns-name",
+ prot.context ().get<String> ("substitution-ns-name"));
+
+ node.context ().set (
+ "substitution-uq-name",
+ prot.context ().get<String> ("substitution-uq-name"));
}
- }
- // Transfer annotation if the ref declaration hasn't defined its own.
- //
- if (!node.annotated_p () && prot.annotated_p ())
- s_->new_edge<Annotates> (prot.annotation (), node);
+ // Transfer default and fixed values if the ref declaration hasn't
+ // defined its own.
+ //
+ if (!node.default_p ())
+ {
+ if (prot.fixed_p ())
+ node.fixed (prot.value ());
+ else if (prot.default_p ())
+ node.default_ (prot.value ());
- // Set type information.
- //
- if (prot.typed_p ())
- {
- s_->new_edge<Belongs> (node, prot.type ());
+ if (node.default_p ())
+ {
+ node.context ().set (
+ "dom-node",
+ prot.context ().get<Xerces::DOMElement*> ("dom-node"));
+ default_values_.push_back (&node);
+ }
+ }
+
+ // Transfer annotation if the ref declaration hasn't defined its own.
+ //
+ if (!node.annotated_p () && prot.annotated_p ())
+ s_->new_edge<Annotates> (prot.annotation (), node);
+
+ // Set type information.
+ //
+ if (prot.typed_p ())
+ {
+ s_->new_edge<Belongs> (node, prot.type ());
+ }
+ else if (prot.context ().count ("type-ns-name"))
+ {
+ String ns_name (prot.context ().get<String> ("type-ns-name"));
+ String uq_name (prot.context ().get<String> ("type-uq-name"));
+
+ node.context ().set ("type-ns-name", ns_name);
+ node.context ().set ("type-uq-name", uq_name);
+ node.context ().set ("edge-type-id", type_id (typeid (Belongs)));
+
+ if (trace_)
+ wcout << "element '" << ref << "' is not typed" << endl
+ << "deferring resolution until later" << endl;
+ }
+ else
+ {
+ // This could be a recursive reference to an element who's
+ // (anonymous) type is being defined. We are going to let
+ // resolver sort out this case.
+ //
+ node.context ().set ("instance-ns-name", ns_name);
+ node.context ().set ("instance-uq-name", uq_name);
+
+ if (trace_)
+ wcout << "looks like a recursive reference to an element '"
+ << ns_name << "#" << uq_name << "' which is being "
+ << "defined" << endl
+ << "deferring resolution until later" << endl;
+ }
}
- else if (prot.context ().count ("type-ns-name"))
+ catch (NotNamespace const& ex)
{
- String ns_name (prot.context ().get<String> ("type-ns-name"));
- String uq_name (prot.context ().get<String> ("type-uq-name"));
-
- node.context ().set ("type-ns-name", ns_name);
- node.context ().set ("type-uq-name", uq_name);
- node.context ().set ("edge-type-id", TypeId (typeid (Belongs)));
+ if (valid_)
+ {
+ wcerr << file () << ":" << e.line () << ":" << e.column () << ": "
+ << "ice: unable to resolve namespace '" << ex.ns () << "'"
+ << endl;
- if (trace_)
- wcout << "element '" << ref << "' is not typed" << endl
- << "deferring resolution until later" << endl;
+ abort ();
+ }
}
- else
+ catch (NotName const& ex)
{
- // This could be a recursive reference to an element who's
- // (anonymous) type is being defined. We are going to let
- // resolver sort out this case.
- //
- node.context ().set ("instance-ns-name", ns_name);
- node.context ().set ("instance-uq-name", uq_name);
+ node.context ().set ("instance-ns-name", ex.ns ());
+ node.context ().set ("instance-uq-name", ex.name ());
if (trace_)
- wcout << "looks like a recursive reference to an element '"
- << ns_name << "#" << uq_name << "' which is being "
- << "defined" << endl
+ wcout << "unable to resolve name '" << ex.name ()
+ << "' inside namespace '" << ex.ns () << "'" << endl
<< "deferring resolution until later" << endl;
}
- }
- catch (NotNamespace const& ex)
- {
- if (valid_)
+ catch (XML::NoMapping const& ex)
{
wcerr << file () << ":" << e.line () << ":" << e.column () << ": "
- << "ice: unable to resolve namespace '" << ex.ns () << "'"
- << endl;
+ << "error: unable to resolve namespace prefix '"
+ << ex.prefix () << "' in '" << ref << "'" << endl;
- abort ();
+ valid_ = false;
}
}
- catch (NotName const& ex)
- {
- node.context ().set ("instance-ns-name", ex.ns ());
- node.context ().set ("instance-uq-name", ex.name ());
-
- if (trace_)
- wcout << "unable to resolve name '" << ex.name ()
- << "' inside namespace '" << ex.ns () << "'" << endl
- << "deferring resolution until later" << endl;
- }
- catch (XML::NoMapping const& ex)
- {
- wcerr << file () << ":" << e.line () << ":" << e.column () << ": "
- << "error: unable to resolve namespace prefix '"
- << ex.prefix () << "' in '" << ref << "'" << endl;
-
- valid_ = false;
- }
}
else
{
@@ -4012,7 +4098,7 @@ namespace XSDFrontend
}
SemanticGraph::Annotation* Parser::Impl::
- annotation (Boolean process)
+ annotation (bool process)
{
Annotation* r (0);
@@ -4039,7 +4125,7 @@ namespace XSDFrontend
// Use first non-structured (text only) documentation element.
//
String text;
- Boolean struc (false);
+ bool struc (false);
DOMElement* de (doc.dom_element());
for (DOMNode* n (de->getFirstChild ());
@@ -4085,24 +4171,24 @@ namespace XSDFrontend
}
- Void Parser::Impl::
- attribute (XML::Element const& a, Boolean global)
+ void Parser::Impl::
+ attribute (XML::Element const& a, bool global)
{
- Boolean optional (true);
+ bool optional (true);
- String use (a["use"]);
+ String use (trim (a["use"]));
if (use == L"prohibited")
return;
else if (use == L"required")
optional = false;
- Boolean qualified (global ? true : qualify_attribute_);
+ bool qualified (global ? true : qualify_attribute_);
- if (String form = a["form"])
+ if (String form = trim (a["form"]))
qualified = form == L"qualified";
- if (String name = a["name"])
+ if (String name = trim (a["name"]))
{
if (trace_)
wcout << "attribute '" << name << "'" << endl;
@@ -4130,7 +4216,7 @@ namespace XSDFrontend
default_values_.push_back (&node);
}
- if (String type = a["type"])
+ if (String type = trim (a["type"]))
{
if (trace_)
wcout << "attribute type: '" << fq_name (a, type) << "'" << endl;
@@ -4202,7 +4288,7 @@ namespace XSDFrontend
pop ();
}
}
- else if (String ref = a["ref"])
+ else if (String ref = trim (a["ref"]))
{
Attribute& node (
s_->new_node<Attribute> (
@@ -4280,7 +4366,7 @@ namespace XSDFrontend
node.context ().set ("type-ns-name", ns_name);
node.context ().set ("type-uq-name", uq_name);
- node.context ().set ("edge-type-id", TypeId (typeid (Belongs)));
+ node.context ().set ("edge-type-id", type_id (typeid (Belongs)));
if (trace_)
wcout << "attribute '" << ref << "' is not typed" << endl
@@ -4342,10 +4428,10 @@ namespace XSDFrontend
}
}
- Void Parser::Impl::
+ void Parser::Impl::
attribute_group (XML::Element const& g)
{
- if (String name = g["name"])
+ if (String name = trim (g["name"]))
{
// Global definition.
//
@@ -4384,7 +4470,7 @@ namespace XSDFrontend
pop ();
pop_scope ();
}
- else if (String ref = g["ref"])
+ else if (String ref = trim (g["ref"]))
{
if (trace_)
wcout << "attribute-group-ref " << ref << endl;
@@ -4441,20 +4527,22 @@ namespace XSDFrontend
}
}
- Void Parser::Impl::
+ void Parser::Impl::
any (XML::Element const& a)
{
if (trace_)
wcout << "any" << endl;
- String namespaces (a["namespace"] ? a["namespace"] : L"##any");
+ String namespaces (trim (a["namespace"]));
+
+ if (!namespaces)
+ namespaces = L"##any";
Any& any (
s_->new_node<Any> (file (), a.line (), a.column (), namespaces));
- s_->new_edge<ContainsParticle> (
- compositor (), any,
- parse_min (a["minOccurs"]), parse_max (a["maxOccurs"]));
+ unsigned long min (parse_min (trim (a["minOccurs"])));
+ unsigned long max (parse_max (trim (a["maxOccurs"])));
// Parse annotation.
//
@@ -4465,33 +4553,42 @@ namespace XSDFrontend
pop ();
- // Any has no name so we have to come up with a fake one in order to
- // put it into the scope.
- //
- UnsignedLong count;
- FrontendElements::Context& ctx (scope ().context ());
-
- if (!ctx.count ("any-name-count"))
+ if (!(min == 0 && max == 0))
{
- count = 0;
- ctx.set ("any-name-count", count);
- }
- else
- count = ++(ctx.get<UnsignedLong> ("any-name-count"));
+ s_->new_edge<ContainsParticle> (
+ compositor (), any, min, max == unbounded ? 0 : max);
- std::basic_ostringstream<WideChar> os;
- os << "any #" << count;
+ // Any has no name so we have to come up with a fake one in order to
+ // put it into the scope.
+ //
+ unsigned long count;
+ SemanticGraph::Context& ctx (scope ().context ());
- s_->new_edge<Names> (scope (), any, os.str ());
+ if (!ctx.count ("any-name-count"))
+ {
+ count = 0;
+ ctx.set ("any-name-count", count);
+ }
+ else
+ count = ++(ctx.get<unsigned long> ("any-name-count"));
+
+ std::basic_ostringstream<wchar_t> os;
+ os << "any #" << count;
+
+ s_->new_edge<Names> (scope (), any, os.str ());
+ }
}
- Void Parser::Impl::
+ void Parser::Impl::
any_attribute (XML::Element const& a)
{
if (trace_)
wcout << "anyAttribute" << endl;
- String namespaces (a["namespace"] ? a["namespace"] : L"##any");
+ String namespaces (trim (a["namespace"]));
+
+ if (!namespaces)
+ namespaces = L"##any";
AnyAttribute& any (
s_->new_node<AnyAttribute> (
@@ -4510,8 +4607,8 @@ namespace XSDFrontend
// in order to put it into the scope.
//
- UnsignedLong count;
- FrontendElements::Context& ctx (scope ().context ());
+ unsigned long count;
+ SemanticGraph::Context& ctx (scope ().context ());
if (!ctx.count ("any-attribute-name-count"))
{
@@ -4519,9 +4616,9 @@ namespace XSDFrontend
ctx.set ("any-attribute-name-count", count);
}
else
- count = ++(ctx.get<UnsignedLong> ("any-attribute-name-count"));
+ count = ++(ctx.get<unsigned long> ("any-attribute-name-count"));
- std::basic_ostringstream<WideChar> os;
+ std::basic_ostringstream<wchar_t> os;
os << "any-attribute #" << count;
s_->new_edge<Names> (scope (), any, os.str ());
@@ -4573,7 +4670,7 @@ namespace XSDFrontend
{
// See if we've got 'xse:refType' attribute.
//
- if (String ref_type = e.attribute (xse, "refType"))
+ if (String ref_type = trim (e.attribute (xse, "refType")))
{
if (trace_)
wcout << "found refType attribute '" << ref_type << "'" << endl;
@@ -4618,7 +4715,7 @@ namespace XSDFrontend
{
node.context ().set ("type-ns-name", ex.ns ());
node.context ().set ("type-uq-name", ex.name ());
- node.context ().set ("edge-type-id", TypeId (typeid (Edge)));
+ node.context ().set ("edge-type-id", type_id (typeid (Edge)));
if (trace_)
wcout << "unable to resolve name '" << ex.name ()
@@ -4641,14 +4738,16 @@ namespace XSDFrontend
// that can later be used in diagnostics. Unfortunately, it doesn't
// work. So we will have to keep our own track.
//
- struct Context: public NonCopyable
+ struct Context
{
+ Context () {}
+
// File map for diagnostic.
//
Path const&
file (Path const& abs) const
{
- FileMap::ConstIterator i (file_map_.find (abs));
+ FileMap::const_iterator i (file_map_.find (abs));
if (i != file_map_.end ())
{
@@ -4660,14 +4759,18 @@ namespace XSDFrontend
}
}
- Void
+ void
map_file (Path const& abs, Path const& rel)
{
file_map_[abs] = rel;
}
private:
- typedef Cult::Containers::Map<Path, Path, FilePathComparator> FileMap;
+ Context (Context const&);
+ Context& operator= (Context const&);
+
+ private:
+ typedef std::map<Path, Path> FileMap;
FileMap file_map_;
};
@@ -4676,13 +4779,13 @@ namespace XSDFrontend
class ErrorHandler : public Xerces::DOMErrorHandler
{
public:
- ErrorHandler (Boolean& valid, XSDFrontend::Context const& ctx)
+ ErrorHandler (bool& valid, XSDFrontend::Context const& ctx)
: valid_ (valid),
ctx_ (ctx)
{
}
- virtual Boolean
+ virtual bool
handleError (Xerces::DOMError const& e)
{
// Xerces likes to say "Fatal error encountered during schema scan".
@@ -4694,14 +4797,8 @@ namespace XSDFrontend
return true;
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- XSDFrontend::SemanticGraph::Path abs_path (
- XML::transcode_to_narrow (e.getLocation ()->getURI ()),
- boost::filesystem::native);
-#else
XSDFrontend::SemanticGraph::Path abs_path (
- XML::transcode_to_narrow (e.getLocation ()->getURI ()).c_str());
-#endif
+ XML::transcode_to_narrow (e.getLocation ()->getURI ()));
XSDFrontend::SemanticGraph::Path rel_path (ctx_.file (abs_path));
@@ -4730,7 +4827,7 @@ namespace XSDFrontend
}
private:
- Boolean& valid_;
+ bool& valid_;
XSDFrontend::Context const& ctx_;
};
@@ -4754,12 +4851,7 @@ namespace XSDFrontend
base_ (base),
ctx_ (ctx)
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- setSystemId (XML::XMLChString (
- String (abs_.native_file_string ())).c_str ());
-#else
setSystemId (XML::XMLChString (String (abs_.string ())).c_str ());
-#endif
}
virtual Xerces::BinInputStream*
@@ -4794,11 +4886,7 @@ namespace XSDFrontend
class EntityResolver: public Xerces::XMemory,
-#if _XERCES_VERSION >= 30000
public Xerces::DOMLSResourceResolver
-#else
- public Xerces::DOMEntityResolver
-#endif
{
public:
EntityResolver (XSDFrontend::Context& ctx, LocationTranslator* t)
@@ -4806,19 +4894,12 @@ namespace XSDFrontend
{
}
-#if _XERCES_VERSION >= 30000
virtual Xerces::DOMLSInput*
resolveResource(XMLCh const* const,
XMLCh const* const,
XMLCh const* const /*pub_id*/,
XMLCh const* const prv_id,
XMLCh const* const base_uri)
-#else
- virtual Xerces::DOMInputSource*
- resolveEntity (XMLCh const* const /*pub_id*/,
- XMLCh const* const prv_id,
- XMLCh const* const base_uri)
-#endif
{
/*
XMLCh empty[1];
@@ -4832,12 +4913,7 @@ namespace XSDFrontend
// base_uri should be a valid path by now.
//
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- Path base (XML::transcode_to_narrow (base_uri),
- boost::filesystem::native);
-#else
- Path base (XML::transcode_to_narrow (base_uri).c_str());
-#endif
+ Path base (XML::transcode_to_narrow (base_uri));
if (prv_id == 0)
{
@@ -4861,36 +4937,19 @@ namespace XSDFrontend
try
{
- Path path;
-
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- try
- {
- path = Path (path_str);
- }
- catch (InvalidPath const&)
- {
- // Retry as a native path.
- //
- path = Path (path_str, boost::filesystem::native);
- }
-#else
- // The new ABI does not have a fallback native representation
- path = Path (path_str.c_str());
-#endif
-
- Path base_dir (base.branch_path ());
+ Path path (path_str);
+ Path base_dir (base.directory ());
Path abs_path, rel_path;
- if (path.is_complete ())
+ if (path.absolute ())
{
abs_path = rel_path = path;
}
else
{
abs_path = base_dir / path;
- rel_path = ctx_.file (base).branch_path () / path;
+ rel_path = ctx_.file (base).directory () / path;
}
abs_path.normalize ();
@@ -4928,7 +4987,7 @@ namespace XSDFrontend
XML::AutoPtr<Xerces::DOMDocument> Parser::Impl::
- dom (Path const& tu, Boolean validate)
+ dom (Path const& tu, bool validate)
{
using namespace Xerces;
@@ -4936,8 +4995,11 @@ namespace XSDFrontend
{
XSDFrontend::Context ctx;
- Path abs_path (system_complete (tu));
- abs_path.normalize ();
+ // Do normalize() before complete() to avoid hitting system path
+ // limits with '..' directories.
+ //
+ Path abs_path (tu);
+ abs_path.normalize ().complete ();
ctx.map_file (abs_path, tu);
InputSource input_source (abs_path, tu, abs_path, ctx);
@@ -4958,7 +5020,6 @@ namespace XSDFrontend
// Create a DOMBuilder.
//
-#if _XERCES_VERSION >= 30000
XML::AutoPtr<DOMLSParser> parser (
impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
@@ -4990,29 +5051,6 @@ namespace XSDFrontend
Wrapper4InputSource wrap (&input_source, false);
parser->loadGrammar (&wrap, Grammar::SchemaGrammarType);
-#else
- XML::AutoPtr<DOMBuilder> parser (
- impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
-
- parser->setFeature (XMLUni::fgDOMComments, false);
- parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true);
- parser->setFeature (XMLUni::fgDOMEntities, false);
- parser->setFeature (XMLUni::fgDOMNamespaces, true);
- parser->setFeature (XMLUni::fgDOMValidation, true);
- parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false);
- parser->setFeature (XMLUni::fgXercesSchema, true);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, full_schema_check_);
- parser->setFeature (XMLUni::fgXercesValidationErrorAsFatal, true);
-
- ErrorHandler eh (valid_, ctx);
- parser->setErrorHandler (&eh);
-
- EntityResolver er (ctx, loc_translator_);
- parser->setEntityResolver (&er);
-
- Wrapper4InputSource wrap (&input_source, false);
- parser->loadGrammar (wrap, Grammar::SchemaGrammarType);
-#endif
}
if (!valid_)
@@ -5038,7 +5076,7 @@ namespace XSDFrontend
}
catch (Xerces::DOMException const& e)
{
- Size const size = 2047;
+ size_t const size = 2047;
XMLCh text[size + 1];
wcerr << tu << ": ice: Xerces::DOMException: ";
@@ -5081,9 +5119,9 @@ namespace XSDFrontend
}
Parser::
- Parser (Boolean proper_restriction,
- Boolean multiple_imports,
- Boolean full_schema_check)
+ Parser (bool proper_restriction,
+ bool multiple_imports,
+ bool full_schema_check)
: impl_ (new Impl (proper_restriction,
multiple_imports,
full_schema_check,
@@ -5093,9 +5131,9 @@ namespace XSDFrontend
}
Parser::
- Parser (Boolean proper_restriction,
- Boolean multiple_imports,
- Boolean full_schema_check,
+ Parser (bool proper_restriction,
+ bool multiple_imports,
+ bool full_schema_check,
LocationTranslator& t,
const WarningSet& d)
: impl_ (new Impl (proper_restriction,
@@ -5106,19 +5144,19 @@ namespace XSDFrontend
{
}
- Evptr<SemanticGraph::Schema> Parser::
+ auto_ptr<SemanticGraph::Schema> Parser::
parse (SemanticGraph::Path const& path)
{
return impl_->parse (path);
}
- Evptr<SemanticGraph::Schema> Parser::
+ auto_ptr<SemanticGraph::Schema> Parser::
parse (SemanticGraph::Paths const& paths)
{
return impl_->parse (paths);
}
- Evptr<SemanticGraph::Schema> Parser::
+ auto_ptr<SemanticGraph::Schema> Parser::
xml_schema (SemanticGraph::Path const& path)
{
return impl_->xml_schema (path);
diff --git a/libxsd-frontend/xsd-frontend/parser.hxx b/libxsd-frontend/xsd-frontend/parser.hxx
index ac0ff4d..746aa97 100644
--- a/libxsd-frontend/xsd-frontend/parser.hxx
+++ b/libxsd-frontend/xsd-frontend/parser.hxx
@@ -1,20 +1,18 @@
// file : xsd-frontend/parser.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_PARSER_HXX
#define XSD_FRONTEND_PARSER_HXX
-#include <cult/types.hxx>
-#include <cult/containers/set.hxx>
+#include <set>
+#include <memory> // std::auto_ptr
+#include <xsd-frontend/types.hxx>
#include <xsd-frontend/semantic-graph/schema.hxx>
namespace XSDFrontend
{
- using namespace Cult::Types;
-
struct InvalidSchema {};
class LocationTranslator
@@ -30,46 +28,50 @@ namespace XSDFrontend
// Set of disabled warning IDs. Special ID "all" disables all
// warnings.
//
- typedef Cult::Containers::Set<NarrowString> WarningSet;
+ typedef std::set<NarrowString> WarningSet;
- class Parser: public NonCopyable
+ class Parser
{
public:
~Parser ();
- Parser (Boolean proper_restriction,
- Boolean multiple_imports,
- Boolean full_schema_check);
+ Parser (bool proper_restriction,
+ bool multiple_imports,
+ bool full_schema_check);
- Parser (Boolean proper_restriction,
- Boolean multiple_imports,
- Boolean full_schema_check,
+ Parser (bool proper_restriction,
+ bool multiple_imports,
+ bool full_schema_check,
LocationTranslator&,
const WarningSet& disabled);
+ private:
+ Parser (Parser const&);
+ Parser& operator= (Parser const&);
+
public:
// Parse a schema file. Throws InvalidSchema in case of a failure.
//
- Evptr<SemanticGraph::Schema>
+ std::auto_ptr<SemanticGraph::Schema>
parse (SemanticGraph::Path const&);
// Parse a number of schema files all into one semantic graph.
// Each schema file is imported from an unnamed root translation
// unit. Throws InvalidSchema in case of a failure.
//
- Evptr<SemanticGraph::Schema>
+ std::auto_ptr<SemanticGraph::Schema>
parse (SemanticGraph::Paths const&);
// Returns a schema graph that corresponds to the XML Schema
// namespace with built-in type definitions. The path is fake
// and is only used as a lable.
//
- Evptr<SemanticGraph::Schema>
+ std::auto_ptr<SemanticGraph::Schema>
xml_schema (SemanticGraph::Path const&);
private:
class Impl;
- Evptr<Impl> impl_;
+ std::auto_ptr<Impl> impl_;
};
}
diff --git a/libxsd-frontend/xsd-frontend/schema-dom-parser.cxx b/libxsd-frontend/xsd-frontend/schema-dom-parser.cxx
index 452980c..73a0f83 100644
--- a/libxsd-frontend/xsd-frontend/schema-dom-parser.cxx
+++ b/libxsd-frontend/xsd-frontend/schema-dom-parser.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/schema-dom-parser.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/schema-dom-parser.hxx>
@@ -44,11 +43,7 @@ namespace XSDFrontend
const unsigned int url_id,
const XMLCh* const prefix,
const RefVectorOf<XMLAttr>& attributes,
-#if _XERCES_VERSION >= 30000
const XMLSize_t attr_count,
-#else
- const unsigned int attr_count,
-#endif
const bool empty,
const bool root)
{
@@ -77,18 +72,8 @@ namespace XSDFrontend
ReaderMgr::LastExtEntityInfo info;
((ReaderMgr*) fScanner->getLocator())->getLastExtEntityInfo(info);
-#if _XERCES_VERSION >= 30000
unsigned long l (static_cast<unsigned long> (info.lineNumber));
unsigned long c (static_cast<unsigned long> (info.colNumber));
-#else
- unsigned long l (info.lineNumber == -1
- ? 0UL
- : static_cast<unsigned long> (info.lineNumber));
-
- unsigned long c (info.colNumber == -1
- ? 0UL
- : static_cast<unsigned long> (info.colNumber));
-#endif
fCurrentNode->setUserData (line_key, reinterpret_cast<void*> (l), 0);
fCurrentNode->setUserData (column_key, reinterpret_cast<void*> (c), 0);
@@ -124,11 +109,7 @@ namespace XSDFrontend
void SchemaDOMParser::
docCharacters (const XMLCh* const s,
-#if _XERCES_VERSION >= 30000
const XMLSize_t length,
-#else
- const unsigned int length,
-#endif
const bool cdata)
{
// Ignore chars outside of content.
@@ -177,11 +158,7 @@ namespace XSDFrontend
void SchemaDOMParser::
ignorableWhitespace (const XMLCh* const s,
-#if _XERCES_VERSION >= 30000
const XMLSize_t length,
-#else
- const unsigned int length,
-#endif
const bool cdata)
{
// Ignore chars before the root element.
diff --git a/libxsd-frontend/xsd-frontend/schema-dom-parser.hxx b/libxsd-frontend/xsd-frontend/schema-dom-parser.hxx
index 7571677..344065a 100644
--- a/libxsd-frontend/xsd-frontend/schema-dom-parser.hxx
+++ b/libxsd-frontend/xsd-frontend/schema-dom-parser.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/schema-dom-parser.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SCHEMA_DOM_PARSER_HXX
@@ -13,6 +12,8 @@
#include <xercesc/validators/schema/XSDLocator.hpp>
#include <xercesc/validators/schema/XSDErrorReporter.hpp>
+#include <xsd-frontend/version.hxx> // Check Xerces-C++ version.
+
namespace XSDFrontend
{
namespace XML
@@ -35,11 +36,7 @@ namespace XSDFrontend
const unsigned int url_id,
const XMLCh* const prefix,
const Xerces::RefVectorOf<Xerces::XMLAttr>& attributes,
-#if _XERCES_VERSION >= 30000
const XMLSize_t attribute_count,
-#else
- const unsigned int attribute_count,
-#endif
const bool empty,
const bool root);
@@ -51,11 +48,7 @@ namespace XSDFrontend
virtual void
docCharacters (const XMLCh* const,
-#if _XERCES_VERSION >= 30000
const XMLSize_t length,
-#else
- const unsigned int length,
-#endif
const bool cdata);
virtual void
@@ -69,11 +62,7 @@ namespace XSDFrontend
virtual void
ignorableWhitespace (const XMLCh* const,
-#if _XERCES_VERSION >= 30000
const XMLSize_t length,
-#else
- const unsigned int length,
-#endif
const bool cdata);
private:
SchemaDOMParser (SchemaDOMParser const&);
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph.hxx b/libxsd-frontend/xsd-frontend/semantic-graph.hxx
index bee17fc..36d42c3 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_HXX
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx
index 22793f7..17a0f03 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx
@@ -1,19 +1,16 @@
// file : xsd-frontend/semantic-graph/annotation.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/annotation.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
+ using compiler::type_info;
// Annotates
//
@@ -23,11 +20,10 @@ namespace XSDFrontend
{
AnnotatesInit ()
{
- TypeInfo ti (typeid (Annotates));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Annotates));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} annotates_init_;
}
@@ -39,11 +35,10 @@ namespace XSDFrontend
{
AnnotationInit ()
{
- TypeInfo ti (typeid (Annotation));
- ti.add_base (Access::public_, true, typeid (Node));
- RTTI::insert (ti);
+ type_info ti (typeid (Annotation));
+ ti.add_base (typeid (Node));
+ insert (ti);
}
-
} annotation_init_;
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx
index 661ac72..0464f4f 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/annotation.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANNOTATION_HXX
@@ -25,29 +24,20 @@ namespace XSDFrontend
return *annotation_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Annotates ()
- : annotation_ (0)
- {
- }
+ public:
+ Annotates (): annotation_ (0) {}
- Void
+ void
set_left_node (Annotation& a)
{
annotation_ = &a;
}
- Void
- set_right_node (Node&)
- {
- }
+ void
+ set_right_node (Node&) {}
- Void
- set_right_node (Edge&)
- {
- }
+ void
+ set_right_node (Edge&) {}
private:
Annotation* annotation_;
@@ -58,30 +48,26 @@ namespace XSDFrontend
class Annotation: public virtual Node
{
public:
- WideString const&
+ String const&
documentation () const
{
return documentation_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
Annotation (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- WideString const& documentation)
+ unsigned long line,
+ unsigned long column,
+ String const& documentation)
: Node (file, line, column), documentation_ (documentation)
{
}
- Void
- add_edge_left (Annotates&)
- {
- }
+ void
+ add_edge_left (Annotates&) {}
private:
- WideString documentation_;
+ String documentation_;
};
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx
index e25e742..19b9df2 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx
@@ -1,8 +1,9 @@
// file : xsd-frontend/semantic-graph/any-attribute.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/any-attribute.hxx>
#include <xsd-frontend/semantic-graph/compositors.hxx>
@@ -10,30 +11,11 @@ namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
- namespace
- {
- struct AnyAttributeInit
- {
- AnyAttributeInit ()
- {
- TypeInfo ti (typeid (AnyAttribute));
- ti.add_base (Access::public_, true, typeid (Nameable));
- RTTI::insert (ti);
- }
-
- } any_attribute_init_;
- }
-
AnyAttribute::
AnyAttribute (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- WideString const& namespaces)
+ unsigned long line,
+ unsigned long column,
+ String const& namespaces)
: Node (file, line, column),
prototype_ (0)
{
@@ -41,11 +23,11 @@ namespace XSDFrontend
// chararcter.
//
- for (Size i (0), j (namespaces.find (L' '));;)
+ for (size_t i (0), j (namespaces.find (L' '));;)
{
- if (j != WideString::npos)
+ if (j != String::npos)
{
- namespaces_.push_back (WideString (namespaces, i, j - i));
+ namespaces_.push_back (String (namespaces, i, j - i));
i = j + 1;
j = namespaces.find (L' ', i);
@@ -54,7 +36,7 @@ namespace XSDFrontend
{
// Last element.
//
- namespaces_.push_back (WideString (namespaces, i));
+ namespaces_.push_back (String (namespaces, i));
break;
}
}
@@ -62,8 +44,8 @@ namespace XSDFrontend
AnyAttribute::
AnyAttribute (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
+ unsigned long line,
+ unsigned long column,
NamespaceIterator begin,
NamespaceIterator end)
: Node (file, line, column),
@@ -110,5 +92,20 @@ namespace XSDFrontend
return namespace_ (scope ());
}
+
+ namespace
+ {
+ using compiler::type_info;
+
+ struct AnyAttributeInit
+ {
+ AnyAttributeInit ()
+ {
+ type_info ti (typeid (AnyAttribute));
+ ti.add_base (typeid (Nameable));
+ insert (ti);
+ }
+ } any_attribute_init_;
+ }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx
index bc8c512..bb3d761 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx
@@ -1,12 +1,11 @@
// file : xsd-frontend/semantic-graph/any-attribute.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANY_ATTRIBUTE_HXX
#define XSD_FRONTEND_SEMANTIC_GRAPH_ANY_ATTRIBUTE_HXX
-#include <cult/containers/vector.hxx>
+#include <vector>
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/namespace.hxx>
@@ -17,12 +16,10 @@ namespace XSDFrontend
{
class AnyAttribute: public virtual Nameable
{
- typedef
- Cult::Containers::Vector<WideString>
- Namespaces;
+ typedef std::vector<String> Namespaces;
public:
- typedef Namespaces::ConstIterator NamespaceIterator;
+ typedef Namespaces::const_iterator NamespaceIterator;
NamespaceIterator
namespace_begin () const
@@ -37,7 +34,7 @@ namespace XSDFrontend
}
public:
- Boolean
+ bool
prototype_p ()
{
return prototype_ != 0;
@@ -50,7 +47,7 @@ namespace XSDFrontend
return *prototype_;
}
- Void
+ void
prototype (AnyAttribute& a)
{
assert (prototype_ == 0);
@@ -61,17 +58,15 @@ namespace XSDFrontend
Namespace&
definition_namespace ();
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
AnyAttribute (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- WideString const& namespaces);
+ unsigned long line,
+ unsigned long column,
+ String const& namespaces);
AnyAttribute (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
+ unsigned long line,
+ unsigned long column,
NamespaceIterator begin,
NamespaceIterator end);
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx
index a6c9e72..c8ebc93 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx
@@ -1,8 +1,9 @@
// file : xsd-frontend/semantic-graph/any.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/any.hxx>
#include <xsd-frontend/semantic-graph/compositors.hxx>
@@ -10,31 +11,11 @@ namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
- namespace
- {
- struct AnyInit
- {
- AnyInit ()
- {
- TypeInfo ti (typeid (Any));
- ti.add_base (Access::public_, true, typeid (Nameable));
- ti.add_base (Access::public_, true, typeid (Particle));
- RTTI::insert (ti);
- }
-
- } any_init_;
- }
-
Any::
Any (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- WideString const& namespaces)
+ unsigned long line,
+ unsigned long column,
+ String const& namespaces)
: Node (file, line, column),
prototype_ (0)
{
@@ -42,11 +23,11 @@ namespace XSDFrontend
// chararcter.
//
- for (Size i (0), j (namespaces.find (L' '));;)
+ for (size_t i (0), j (namespaces.find (L' '));;)
{
- if (j != WideString::npos)
+ if (j != String::npos)
{
- namespaces_.push_back (WideString (namespaces, i, j - i));
+ namespaces_.push_back (String (namespaces, i, j - i));
i = j + 1;
j = namespaces.find (L' ', i);
@@ -55,7 +36,7 @@ namespace XSDFrontend
{
// Last element.
//
- namespaces_.push_back (WideString (namespaces, i));
+ namespaces_.push_back (String (namespaces, i));
break;
}
}
@@ -63,8 +44,8 @@ namespace XSDFrontend
Any::
Any (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
+ unsigned long line,
+ unsigned long column,
NamespaceIterator begin,
NamespaceIterator end)
: Node (file, line, column),
@@ -121,5 +102,21 @@ namespace XSDFrontend
return namespace_ (scope);
}
+
+ namespace
+ {
+ using compiler::type_info;
+
+ struct AnyInit
+ {
+ AnyInit ()
+ {
+ type_info ti (typeid (Any));
+ ti.add_base (typeid (Nameable));
+ ti.add_base (typeid (Particle));
+ insert (ti);
+ }
+ } any_init_;
+ }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx
index ded9bd8..8e42762 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx
@@ -1,12 +1,11 @@
// file : xsd-frontend/semantic-graph/any.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANY_HXX
#define XSD_FRONTEND_SEMANTIC_GRAPH_ANY_HXX
-#include <cult/containers/vector.hxx>
+#include <vector>
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/particle.hxx>
@@ -19,12 +18,10 @@ namespace XSDFrontend
class Any: public virtual Nameable,
public virtual Particle
{
- typedef
- Cult::Containers::Vector<WideString>
- Namespaces;
+ typedef std::vector<String> Namespaces;
public:
- typedef Namespaces::ConstIterator NamespaceIterator;
+ typedef Namespaces::const_iterator NamespaceIterator;
NamespaceIterator
namespace_begin () const
@@ -39,7 +36,7 @@ namespace XSDFrontend
}
public:
- Boolean
+ bool
prototype_p ()
{
return prototype_ != 0;
@@ -52,7 +49,7 @@ namespace XSDFrontend
return *prototype_;
}
- Void
+ void
prototype (Any& a)
{
assert (prototype_ == 0);
@@ -63,17 +60,15 @@ namespace XSDFrontend
Namespace&
definition_namespace ();
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
Any (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- WideString const& namespaces);
+ unsigned long line,
+ unsigned long column,
+ String const& namespaces);
Any (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
+ unsigned long line,
+ unsigned long column,
NamespaceIterator begin,
NamespaceIterator end);
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx
index 54bb5df..f61fa39 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx
@@ -1,39 +1,34 @@
// file : xsd-frontend/semantic-graph/attribute-group.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/attribute-group.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
+ AttributeGroup::
+ AttributeGroup (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
namespace
{
+ using compiler::type_info;
+
struct AttributeGroupInit
{
AttributeGroupInit ()
{
- TypeInfo ti (typeid (AttributeGroup));
- ti.add_base (Access::public_, true, typeid (Scope));
- RTTI::insert (ti);
+ type_info ti (typeid (AttributeGroup));
+ ti.add_base (typeid (Scope));
+ insert (ti);
}
-
} attribute_group_init_;
}
-
- AttributeGroup::
- AttributeGroup (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
-
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx
index 44739f2..62a1f81 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/attribute-group.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ATTRIBUTE_GROUP_HXX
@@ -14,12 +13,10 @@ namespace XSDFrontend
{
class AttributeGroup: public virtual Scope
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
AttributeGroup (Path const& file,
- UnsignedLong line,
- UnsignedLong column);
+ unsigned long line,
+ unsigned long column);
};
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx
index 2e30d4e..624b16a 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx
@@ -1,44 +1,41 @@
// file : xsd-frontend/semantic-graph/attribute.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/attribute.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
+ Attribute::
+ Attribute (Path const& file,
+ unsigned long line,
+ unsigned long column,
+ bool optional,
+ bool global,
+ bool qualified)
+ : Node (file, line, column),
+ Member (global, qualified),
+ optional_ (optional)
+ {
+ }
namespace
{
+ using compiler::type_info;
+
struct AttributeInit
{
AttributeInit ()
{
- TypeInfo ti (typeid (Attribute));
- ti.add_base (Access::public_, true, typeid (Member));
- RTTI::insert (ti);
+ type_info ti (typeid (Attribute));
+ ti.add_base (typeid (Member));
+ insert (ti);
}
-
} attribute_init_;
}
-
- Attribute::
- Attribute (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- Boolean optional,
- Boolean global,
- Boolean qualified)
- : Node (file, line, column),
- Member (global, qualified),
- optional_ (optional)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx
index f7a516d..9d9b0fb 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/attribute.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ATTRIBUTE_HXX
@@ -15,23 +14,21 @@ namespace XSDFrontend
class Attribute: public virtual Member
{
public:
- Boolean
+ bool
optional_p () const
{
return optional_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
Attribute (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- Boolean optional,
- Boolean global,
- Boolean qualified);
+ unsigned long line,
+ unsigned long column,
+ bool optional,
+ bool global,
+ bool qualified);
private:
- Boolean optional_;
+ bool optional_;
};
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx
index 0cc265f..8433a0e 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx
@@ -1,34 +1,15 @@
// file : xsd-frontend/semantic-graph/complex.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/complex.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
- namespace
- {
- struct ComplexInit
- {
- ComplexInit ()
- {
- TypeInfo ti (typeid (Complex));
- ti.add_base (Access::public_, true, typeid (Type));
- ti.add_base (Access::public_, true, typeid (Scope));
- RTTI::insert (ti);
- }
-
- } complex_init_;
- }
-
Complex::
Complex ()
: mixed_ (false), contains_compositor_ (0)
@@ -36,10 +17,26 @@ namespace XSDFrontend
}
Complex::
- Complex (Path const& file, UnsignedLong line, UnsignedLong column)
+ Complex (Path const& file, unsigned long line, unsigned long column)
: Node (file, line, column),
mixed_ (false), contains_compositor_ (0)
{
}
+
+ namespace
+ {
+ using compiler::type_info;
+
+ struct ComplexInit
+ {
+ ComplexInit ()
+ {
+ type_info ti (typeid (Complex));
+ ti.add_base (typeid (Type));
+ ti.add_base (typeid (Scope));
+ insert (ti);
+ }
+ } complex_init_;
+ }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx
index 40327bc..ac47810 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/complex.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_COMPLEX_HXX
@@ -9,8 +8,6 @@
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/compositors.hxx>
-#include <cult/containers/vector.hxx>
-
namespace XSDFrontend
{
namespace SemanticGraph
@@ -18,15 +15,27 @@ namespace XSDFrontend
class Complex: public virtual Type, public virtual Scope
{
public:
- Boolean
+ bool
mixed_p () const
{
- return mixed_;
+ if (mixed_)
+ return true;
+
+ // If we have empty content, then we have the same content
+ // type as our base.
+ //
+ if (!contains_compositor_p () && inherits_p ())
+ {
+ if (Complex* b = dynamic_cast<Complex*> (&inherits ().base ()))
+ return b->mixed_p ();
+ }
+
+ return false;
}
public:
- Boolean
- contains_compositor_p ()
+ bool
+ contains_compositor_p () const
{
return contains_compositor_ != 0;
}
@@ -39,37 +48,37 @@ namespace XSDFrontend
}
public:
- Void
- mixed_p (Boolean m)
+ void
+ mixed_p (bool m)
{
mixed_ = m;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Complex (); // Virtual inheritance (Enumeration).
- Complex (Path const& file, UnsignedLong line, UnsignedLong column);
-
- using Type::add_edge_right;
- using Type::add_edge_left;
- using Scope::add_edge_left;
+ public:
+ Complex (Path const& file, unsigned long line, unsigned long column);
- Void
+ void
add_edge_left (ContainsCompositor& e)
{
contains_compositor_ = &e;
}
- Void
+ void
remove_edge_left (ContainsCompositor& e)
{
assert (contains_compositor_ == &e);
contains_compositor_ = 0;
}
+ using Type::add_edge_right;
+ using Type::add_edge_left;
+ using Scope::add_edge_left;
+
+ protected:
+ Complex (); // For virtual inheritance (Enumeration).
+
private:
- Boolean mixed_;
+ bool mixed_;
ContainsCompositor* contains_compositor_;
};
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx
index 08953bc..dd65e56 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx
@@ -1,124 +1,100 @@
// file : xsd-frontend/semantic-graph/compositor.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/compositors.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
+ // ContainsCompositor
+ //
+ ContainsCompositor::
+ ContainsCompositor (unsigned long min, unsigned long max)
+ : compositor_ (0), container_ (0), min_ (min), max_ (max)
+ {
+ }
- using RTTI::Access;
- using RTTI::TypeInfo;
+ // All
+ //
+ All::
+ All (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+ // Choice
+ //
+ Choice::
+ Choice (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
- // ContainsCompositor
+ // Sequence
//
+ Sequence::
+ Sequence (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
namespace
{
+ using compiler::type_info;
+
struct ContainsCompositorInit
{
ContainsCompositorInit ()
{
- TypeInfo ti (typeid (ContainsCompositor));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (ContainsCompositor));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} contains_compositor_init_;
- }
- ContainsCompositor::
- ContainsCompositor (UnsignedLong min, UnsignedLong max)
- : compositor_ (0), container_ (0), min_ (min), max_ (max)
- {
- }
-
- // Compositor
- //
- namespace
- {
struct CompositorInit
{
CompositorInit ()
{
- TypeInfo ti (typeid (Compositor));
- ti.add_base (Access::public_, true, typeid (Particle));
- RTTI::insert (ti);
+ type_info ti (typeid (Compositor));
+ ti.add_base (typeid (Particle));
+ insert (ti);
}
-
} compositor_init_;
- }
-
- // All
- //
- namespace
- {
struct AllInit
{
AllInit ()
{
- TypeInfo ti (typeid (All));
- ti.add_base (Access::public_, true, typeid (Compositor));
- RTTI::insert (ti);
+ type_info ti (typeid (All));
+ ti.add_base (typeid (Compositor));
+ insert (ti);
}
-
} all_init_;
- }
- All::
- All (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
-
-
- // Choice
- //
- namespace
- {
struct ChoiceInit
{
ChoiceInit ()
{
- TypeInfo ti (typeid (Choice));
- ti.add_base (Access::public_, true, typeid (Compositor));
- RTTI::insert (ti);
+ type_info ti (typeid (Choice));
+ ti.add_base (typeid (Compositor));
+ insert (ti);
}
-
} choice_init_;
- }
- Choice::
- Choice (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
-
- // Sequence
- //
- namespace
- {
struct SequenceInit
{
SequenceInit ()
{
- TypeInfo ti (typeid (Sequence));
- ti.add_base (Access::public_, true, typeid (Compositor));
- RTTI::insert (ti);
+ type_info ti (typeid (Sequence));
+ ti.add_base (typeid (Compositor));
+ insert (ti);
}
-
} sequence_init_;
}
-
- Sequence::
- Sequence (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx
index c82d8a4..3573c24 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx
@@ -1,12 +1,11 @@
// file : xsd-frontend/semantic-graph/compositors.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_COMPOSITORS_HXX
#define XSD_FRONTEND_SEMANTIC_GRAPH_COMPOSITORS_HXX
-#include <cult/containers/list.hxx>
+#include <list>
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/particle.hxx>
@@ -33,43 +32,41 @@ namespace XSDFrontend
}
public:
- UnsignedLong
+ unsigned long
min () const
{
return min_;
}
- UnsignedLong
+ unsigned long
max () const
{
return max_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- ContainsCompositor (UnsignedLong min, UnsignedLong max);
+ public:
+ ContainsCompositor (unsigned long min, unsigned long max);
- Void
+ void
set_left_node (Node& n)
{
container_ = &n;
}
- Void
+ void
set_right_node (Compositor& n)
{
compositor_ = &n;
}
- Void
+ void
clear_left_node (Node& n)
{
assert (container_ == &n);
container_ = 0;
}
- Void
+ void
clear_right_node (Compositor& n)
{
assert (compositor_ == &n);
@@ -79,25 +76,19 @@ namespace XSDFrontend
private:
Compositor* compositor_;
Node* container_;
- UnsignedLong min_, max_;
+ unsigned long min_, max_;
};
-
//
//
class Compositor: public virtual Particle
{
- typedef
- Cult::Containers::List<ContainsParticle*>
- ContainsList;
+ typedef std::list<ContainsParticle*> ContainsList;
public:
+ typedef pointer_iterator<ContainsList::iterator> ContainsIterator;
typedef
- Bits::PointerIterator<ContainsList::Iterator>
- ContainsIterator;
-
- typedef
- Bits::PointerIterator<ContainsList::ConstIterator>
+ pointer_iterator<ContainsList::const_iterator>
ContainsConstIterator;
ContainsIterator
@@ -125,7 +116,7 @@ namespace XSDFrontend
}
public:
- Boolean
+ bool
contained_compositor_p ()
{
return contained_compositor_ != 0;
@@ -139,7 +130,7 @@ namespace XSDFrontend
}
public:
- UnsignedLong
+ unsigned long
min () const
{
if (contained_compositor_ != 0)
@@ -148,7 +139,7 @@ namespace XSDFrontend
return Particle::min ();
}
- UnsignedLong
+ unsigned long
max () const
{
if (contained_compositor_ != 0)
@@ -157,24 +148,31 @@ namespace XSDFrontend
return Particle::max ();
}
- protected:
- friend class Bits::Graph<Node, Edge>;
+ public:
+ Compositor (): contained_compositor_ (0) {}
- Compositor ()
- : contained_compositor_ (0)
+ void
+ add_edge_left (ContainsParticle& e)
{
+ contains_.push_back (&e);
}
- Void
- add_edge_left (ContainsParticle& e)
+ void
+ add_edge_left (ContainsParticle& e, ContainsIterator const& after)
{
- contains_.push_back (&e);
+ if (after.base () == contains_.end ())
+ contains_.push_front (&e);
+ else
+ {
+ ContainsList::iterator i (after.base ());
+ contains_.insert (++i, &e);
+ }
}
- Void
+ void
remove_edge_left (ContainsParticle& e)
{
- for (ContainsList::Iterator i (contains_.begin ());
+ for (ContainsList::iterator i (contains_.begin ());
i != contains_.end (); ++i)
{
if (*i == &e)
@@ -185,77 +183,50 @@ namespace XSDFrontend
}
}
- //@@ Ideally should be protected but then NodeArg has no way to
- // access it. Maybe when (if) I move NodeArg into Grpah I can
- // resolve this.
- //
- public:
- Void
- add_edge_left (ContainsParticle& e, ContainsIterator const& after)
- {
- if (after.base () == contains_.end ())
- contains_.push_front (&e);
- else
- {
- ContainsList::Iterator i (after.base ());
- contains_.insert (++i, &e);
- }
- }
-
- protected:
- using Node::add_edge_right;
- using Particle::add_edge_right;
- using Particle::remove_edge_right;
-
- Void
+ void
add_edge_right (ContainsCompositor& e)
{
contained_compositor_ = &e;
}
- Void
+ void
remove_edge_right (ContainsCompositor& e)
{
assert (contained_compositor_ == &e);
contained_compositor_ = 0;
}
+ using Node::add_edge_right;
+ using Particle::add_edge_right;
+ using Particle::remove_edge_right;
+
private:
ContainsList contains_;
ContainsCompositor* contained_compositor_;
};
-
//
//
class All: public virtual Compositor
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- All (Path const& file, UnsignedLong line, UnsignedLong column);
+ public:
+ All (Path const& file, unsigned long line, unsigned long column);
};
-
//
//
class Choice: public virtual Compositor
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Choice (Path const& file, UnsignedLong line, UnsignedLong column);
+ public:
+ Choice (Path const& file, unsigned long line, unsigned long column);
};
-
//
//
class Sequence: public virtual Compositor
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Sequence (Path const& file, UnsignedLong line, UnsignedLong column);
+ public:
+ Sequence (Path const& file, unsigned long line, unsigned long column);
};
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx
index 0e71aa6..a02d751 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx
@@ -1,38 +1,34 @@
// file : xsd-frontend/semantic-graph/element-group.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/element-group.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
+ ElementGroup::
+ ElementGroup (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column), contains_compositor_ (0)
+ {
+ }
namespace
{
+ using compiler::type_info;
+
struct ElementGroupInit
{
ElementGroupInit ()
{
- TypeInfo ti (typeid (ElementGroup));
- ti.add_base (Access::public_, true, typeid (Scope));
- RTTI::insert (ti);
+ type_info ti (typeid (ElementGroup));
+ ti.add_base (typeid (Scope));
+ insert (ti);
}
-
} element_group_init_;
}
-
- ElementGroup::
- ElementGroup (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column), contains_compositor_ (0)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx
index 23514b5..ee7772c 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/element-group.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_GROUP_HXX
@@ -23,19 +22,17 @@ namespace XSDFrontend
return *contains_compositor_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- ElementGroup (Path const& file, UnsignedLong line, UnsignedLong column);
-
- using Scope::add_edge_left;
+ public:
+ ElementGroup (Path const& file, unsigned long line, unsigned long column);
- Void
+ void
add_edge_left (ContainsCompositor& e)
{
contains_compositor_ = &e;
}
+ using Scope::add_edge_left;
+
private:
ContainsCompositor* contains_compositor_;
};
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx
index 1d8cda5..fb7d3a7 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx
@@ -1,63 +1,53 @@
// file : xsd-frontend/semantic-graph/element.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/element.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
-
- // Substitutes
+ // Element
//
+ Element::
+ Element (Path const& file,
+ unsigned long line,
+ unsigned long column,
+ bool global,
+ bool qualified)
+ : Node (file, line, column),
+ Member (global, qualified),
+ substitutes_ (0)
+ {
+ }
+
namespace
{
+ using compiler::type_info;
+
struct SubstitutesInit
{
SubstitutesInit ()
{
- TypeInfo ti (typeid (Substitutes));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Substitutes));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} substitutes_init_;
- }
- // Element
- //
- namespace
- {
struct ElementInit
{
ElementInit ()
{
- TypeInfo ti (typeid (Element));
- ti.add_base (Access::public_, true, typeid (Member));
- ti.add_base (Access::public_, true, typeid (Particle));
- RTTI::insert (ti);
+ type_info ti (typeid (Element));
+ ti.add_base (typeid (Member));
+ ti.add_base (typeid (Particle));
+ insert (ti);
}
-
} element_init_;
}
-
- Element::
- Element (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- Boolean global,
- Boolean qualified)
- : Node (file, line, column),
- Member (global, qualified),
- substitutes_ (0)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx
index e7046e4..0af164e 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/element.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_HXX
@@ -30,20 +29,14 @@ namespace XSDFrontend
return *root_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Substitutes ()
- {
- }
-
- Void
+ public:
+ void
set_left_node (Element& n)
{
substitution_ = &n;
}
- Void
+ void
set_right_node (Element& n)
{
root_ = &n;
@@ -59,7 +52,7 @@ namespace XSDFrontend
public virtual Particle
{
public:
- Boolean
+ bool
substitutes_p () const
{
return substitutes_ != 0;
@@ -72,25 +65,21 @@ namespace XSDFrontend
return *substitutes_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
Element (Path const& file,
- UnsignedLong line,
- UnsignedLong column,
- Boolean global,
- Boolean qualified);
+ unsigned long line,
+ unsigned long column,
+ bool global,
+ bool qualified);
- Void
+ void
add_edge_left (Substitutes& e)
{
substitutes_ = &e;
}
- Void
- add_edge_right (Substitutes&)
- {
- }
+ void
+ add_edge_right (Substitutes&) {}
using Member::add_edge_left;
using Member::add_edge_right;
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx
index 6a2addf..fa48a9a 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx
@@ -1,10 +1,11 @@
// file : xsd-frontend/semantic-graph/elements.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <algorithm>
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/annotation.hxx>
@@ -24,32 +25,29 @@ namespace XSDFrontend
// Type
//
- Void Type::
+ void Type::
remove_edge_left (Arguments& a)
{
- ArgumentsSet::Iterator i (arguments_.find (&a));
+ ArgumentsSet::iterator i (arguments_.find (&a));
assert (i != arguments_.end ());
arguments_.erase (i);
}
// Specialization
//
- Void Specialization::
+ void Specialization::
remove_edge_right (Arguments& a)
{
// The number of entries should be small so linear search will do.
//
- Argumented::Iterator i (
+ Argumented::iterator i (
std::find (argumented_.begin (), argumented_.end (), &a));
assert (i != argumented_.end ());
argumented_.erase (i);
}
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
+ using compiler::type_info;
namespace
{
@@ -59,209 +57,178 @@ namespace XSDFrontend
{
EdgeInit ()
{
- TypeInfo ti (typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Edge));
+ insert (ti);
}
-
} edge_init_;
-
// Node
//
struct NodeInit
{
NodeInit ()
{
- TypeInfo ti (typeid (Node));
- RTTI::insert (ti);
+ type_info ti (typeid (Node));
+ insert (ti);
}
-
} node_init_;
-
// Names
//
struct NamesInit
{
NamesInit ()
{
- TypeInfo ti (typeid (Names));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Names));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} names_init_;
-
// Nameable
//
struct NameableInit
{
NameableInit ()
{
- TypeInfo ti (typeid (Nameable));
- ti.add_base (Access::public_, true, typeid (Node));
- RTTI::insert (ti);
+ type_info ti (typeid (Nameable));
+ ti.add_base (typeid (Node));
+ insert (ti);
}
-
} nameable_init_;
-
// Scope
//
struct ScopeInit
{
ScopeInit ()
{
- TypeInfo ti (typeid (Scope));
- ti.add_base (Access::public_, true, typeid (Nameable));
- RTTI::insert (ti);
+ type_info ti (typeid (Scope));
+ ti.add_base (typeid (Nameable));
+ insert (ti);
}
-
} scope_init_;
-
// Type
//
struct TypeInit
{
TypeInit ()
{
- TypeInfo ti (typeid (Type));
- ti.add_base (Access::public_, true, typeid (Nameable));
- RTTI::insert (ti);
+ type_info ti (typeid (Type));
+ ti.add_base (typeid (Nameable));
+ insert (ti);
}
-
} type_init_;
-
// Instance
//
struct InstanceInit
{
InstanceInit ()
{
- TypeInfo ti (typeid (Instance));
- ti.add_base (Access::public_, true, typeid (Nameable));
- RTTI::insert (ti);
+ type_info ti (typeid (Instance));
+ ti.add_base (typeid (Nameable));
+ insert (ti);
}
-
} instance_init_;
-
// Belongs
//
struct BelongsInit
{
BelongsInit ()
{
- TypeInfo ti (typeid (Belongs));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Belongs));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} belongs_init_;
-
-
// Inherits
//
struct InheritsInit
{
InheritsInit ()
{
- TypeInfo ti (typeid (Inherits));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Inherits));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} inherits_init_;
-
// Extends
//
struct ExtendsInit
{
ExtendsInit ()
{
- TypeInfo ti (typeid (Extends));
- ti.add_base (Access::public_, true, typeid (Inherits));
- RTTI::insert (ti);
+ type_info ti (typeid (Extends));
+ ti.add_base (typeid (Inherits));
+ insert (ti);
}
-
} extends_init_;
-
// Restricts
//
struct RestrictsInit
{
RestrictsInit ()
{
- TypeInfo ti (typeid (Restricts));
- ti.add_base (Access::public_, true, typeid (Inherits));
- RTTI::insert (ti);
+ type_info ti (typeid (Restricts));
+ ti.add_base (typeid (Inherits));
+ insert (ti);
}
-
} restricts_init_;
-
// BelongsToNamespace
//
struct BelongsToNamespaceInit
{
BelongsToNamespaceInit ()
{
- TypeInfo ti (typeid (BelongsToNamespace));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (BelongsToNamespace));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} belongs_to_namespace_init_;
-
// Member
//
struct MemberInit
{
MemberInit ()
{
- TypeInfo ti (typeid (Member));
- ti.add_base (Access::public_, true, typeid (Instance));
- RTTI::insert (ti);
+ type_info ti (typeid (Member));
+ ti.add_base (typeid (Instance));
+ insert (ti);
}
-
} member_init_;
-
// Specialization
//
struct SpecializationInit
{
SpecializationInit ()
{
- TypeInfo ti (typeid (Specialization));
- ti.add_base (Access::public_, true, typeid (Type));
- RTTI::insert (ti);
+ type_info ti (typeid (Specialization));
+ ti.add_base (typeid (Type));
+ insert (ti);
}
-
} specialization_init_;
-
// Arguments
//
struct ArgumentsInit
{
ArgumentsInit ()
{
- TypeInfo ti (typeid (Arguments));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Arguments));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} arguments_init_;
-
/*
// Contains
//
@@ -269,64 +236,50 @@ namespace XSDFrontend
{
ContainsInit ()
{
- TypeInfo ti (typeid (Contains));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Contains));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} contains_init_;
-
// Container
//
struct ContainerInit
{
ContainerInit ()
{
- TypeInfo ti (typeid (Container));
- ti.add_base (Access::public_, true, typeid (Node));
- RTTI::insert (ti);
+ type_info ti (typeid (Container));
+ ti.add_base (typeid (Node));
+ insert (ti);
}
-
} container_init_;
*/
-
// AnyType
//
- namespace
+ struct AnyTypeInit
{
- struct AnyTypeInit
+ AnyTypeInit ()
{
- AnyTypeInit ()
- {
- TypeInfo ti (typeid (AnyType));
- ti.add_base (Access::public_, true, typeid (SemanticGraph::Type));
- RTTI::insert (ti);
- }
-
- } any_type_init_;
- }
-
+ type_info ti (typeid (AnyType));
+ ti.add_base (typeid (SemanticGraph::Type));
+ insert (ti);
+ }
+ } any_type_init_;
// AnySimpleType
//
- namespace
+ struct AnySimpleTypeInit
{
- struct AnySimpleTypeInit
+ AnySimpleTypeInit ()
{
- AnySimpleTypeInit ()
- {
- TypeInfo ti (typeid (AnySimpleType));
- ti.add_base (Access::public_, true, typeid (Type));
- RTTI::insert (ti);
- }
-
- } any_simple_type_init_;
- }
+ type_info ti (typeid (AnySimpleType));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+ } any_simple_type_init_;
}
-
// Instance
//
Type& Instance::
@@ -342,9 +295,5 @@ namespace XSDFrontend
std::wostream&
operator<< (std::wostream& os, XSDFrontend::SemanticGraph::Path const& path)
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- return os << path.native_file_string ().c_str ();
-#else
return os << path.string ().c_str ();
-#endif
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx
index 78b6615..98fb180 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx
@@ -1,171 +1,41 @@
// file : xsd-frontend/semantic-graph/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENTS_HXX
#define XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENTS_HXX
+#include <set>
+#include <map>
+#include <list>
+#include <vector>
#include <iosfwd>
+#include <utility> // std::pair
+#include <cstdlib> // abort
+#include <cassert>
-#include <boost/filesystem/path.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/exception.hpp>
+#include <cutl/container/graph.hxx>
+#include <cutl/container/pointer-iterator.hxx>
+#include <cutl/compiler/context.hxx>
+#include <cutl/fs/path.hxx>
-#include <cult/types.hxx>
-
-#include <cult/rtti/type-info.hxx>
-
-#include <cult/containers/set.hxx>
-#include <cult/containers/map.hxx>
-#include <cult/containers/list.hxx>
-#include <cult/containers/pair.hxx>
-#include <cult/containers/graph.hxx>
-#include <cult/containers/vector.hxx>
-
-#include <frontend-elements/context.hxx>
+#include <xsd-frontend/types.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- using namespace Cult::Types;
-
- namespace Bits
- {
- using Cult::Containers::Graph;
-
- //@@ Should end up in Cult::Meta
- //
- template <typename X>
- struct strip_pointer
- {
- typedef X Type;
- };
-
- template <typename X>
- struct strip_pointer<X*>
- {
- typedef X Type;
- };
-
- template <typename I>
- struct PointerIterator
- {
- typedef
- typename strip_pointer<typename I::Value>::Type
- Value;
-
- typedef I BaseIterator;
- typedef Value& Reference;
- typedef Value* Pointer;
-
- PointerIterator ()
- : i_ () // i_ can be of a pointer type.
- {
- }
-
- PointerIterator (I const& i)
- : i_ (i)
- {
- }
-
- public:
- Reference
- operator* () const
- {
- return **i_;
- }
-
- Pointer
- operator-> () const
- {
- return *i_;
- }
-
- I const&
- base () const
- {
- return i_;
- }
-
- public:
- PointerIterator&
- operator++ ()
- {
- ++i_;
- return *this;
- }
-
- PointerIterator
- operator++ (Int)
- {
- PointerIterator r (*this);
- ++i_;
- return r;
- }
-
- PointerIterator&
- operator-- ()
- {
- --i_;
- return *this;
- }
+ using namespace cutl;
- PointerIterator
- operator-- (Int)
- {
- PointerIterator r (*this);
- --i_;
- return r;
- }
-
- private:
- I i_;
- };
-
- template <typename I>
- inline
- Boolean
- operator== (PointerIterator<I> const& a, PointerIterator<I> const& b)
- {
- return a.base () == b.base ();
- }
-
- template <typename I>
- inline
- Boolean
- operator!= (PointerIterator<I> const& a, PointerIterator<I> const& b)
- {
- return a.base () != b.base ();
- }
-
- template <typename I>
- inline
- typename PointerIterator<I>::BaseIterator::difference_type
- operator- (PointerIterator<I> const& a, PointerIterator<I> const& b)
- {
- return a.base () - b.base ();
- }
- }
+ using container::pointer_iterator;
//
//
- typedef
- boost::filesystem::filesystem_error
- InvalidPath;
-
- typedef
- boost::filesystem::path
- Path;
+ typedef fs::path Path;
+ typedef fs::invalid_path InvalidPath;
+ typedef std::vector<Path> Paths;
- typedef
- Cult::Containers::Vector<Path>
- Paths;
-
- typedef
- FrontendElements::Context
- Context;
+ typedef compiler::context Context;
//
//
@@ -195,24 +65,17 @@ namespace XSDFrontend
public:
template <typename X>
- Boolean
+ bool
is_a () const
{
return dynamic_cast<X const*> (this) != 0;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Edge ()
- {
- }
-
private:
mutable Context context_;
};
- inline Boolean
+ inline bool
operator== (Edge const& x, Edge const& y)
{
return &x == &y;
@@ -237,20 +100,20 @@ namespace XSDFrontend
return file_;
}
- UnsignedLong
+ unsigned long
line () const
{
return line_;
}
- UnsignedLong
+ unsigned long
column () const
{
return column_;
}
public:
- Boolean
+ bool
annotated_p () const
{
return annotates_ != 0;
@@ -267,56 +130,54 @@ namespace XSDFrontend
public:
template <typename X>
- Boolean
+ bool
is_a () const
{
return dynamic_cast<X const*> (this) != 0;
}
public:
-
virtual
- ~Node ()
- {
- }
+ ~Node () {}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Node (Path const& file, UnsignedLong line, UnsignedLong column)
+ Node (Path const& file, unsigned long line, unsigned long column)
: annotates_ (0), file_ (file), line_ (line), column_ (column)
{
}
- Node () // For virtual inheritance.
+ void
+ add_edge_right (Annotates& a)
{
- abort (); // Told you so!
+ annotates_ = &a;
}
- Void
- add_edge_right (Annotates& a)
+ protected:
+ Node () // For virtual inheritance.
{
- annotates_ = &a;
+ abort (); // Told you so!
}
private:
mutable Context context_;
Annotates* annotates_;
Path file_;
- UnsignedLong line_;
- UnsignedLong column_;
+ unsigned long line_;
+ unsigned long column_;
};
- inline Boolean
+ inline bool
operator== (Node const& x, Node const& y)
{
return &x == &y;
}
+ //
+ //
+ typedef container::graph<Node, Edge> graph;
//
//
- typedef WideString Name;
+ typedef String Name;
//
@@ -348,34 +209,29 @@ namespace XSDFrontend
return *named_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Names (Name const& name)
- : name_ (name)
- {
- }
+ public:
+ Names (Name const& name): name_ (name) {}
- Void
+ void
set_left_node (Scope& n)
{
scope_ = &n;
}
- Void
+ void
set_right_node (Nameable& n)
{
named_ = &n;
}
- Void
+ void
clear_left_node (Scope& n)
{
assert (scope_ == &n);
scope_ = 0;
}
- Void
+ void
clear_right_node (Nameable& n)
{
assert (named_ == &n);
@@ -392,7 +248,7 @@ namespace XSDFrontend
class Nameable: public virtual Node
{
public:
- Boolean
+ bool
named_p () const
{
return named_ != 0;
@@ -419,21 +275,16 @@ namespace XSDFrontend
return *named_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Nameable ()
- : named_ (0)
- {
- }
+ public:
+ Nameable (): named_ (0) {}
- Void
+ void
add_edge_right (Names& e)
{
named_ = &e;
}
- Void
+ void
remove_edge_right (Names& e)
{
assert (named_ == &e);
@@ -446,42 +297,25 @@ namespace XSDFrontend
Names* named_;
};
-
//
//
- typedef
- Cult::Containers::Set<Nameable*>
- Nameables;
-
+ typedef std::set<Nameable*> Nameables;
//
//
class Scope: public virtual Nameable
{
protected:
- typedef
- Cult::Containers::List<Names*>
- NamesList;
-
- typedef
- Cult::Containers::Map<Names*, NamesList::Iterator>
- ListIteratorMap;
-
- typedef
- Cult::Containers::Map<Name, NamesList>
- NamesMap;
+ typedef std::list<Names*> NamesList;
+ typedef std::map<Names*, NamesList::iterator> ListIteratorMap;
+ typedef std::map<Name, NamesList> NamesMap;
public:
- typedef
- Bits::PointerIterator<NamesList::Iterator>
- NamesIterator;
-
- typedef
- Bits::PointerIterator<NamesList::ConstIterator>
- NamesConstIterator;
+ typedef pointer_iterator<NamesList::iterator> NamesIterator;
+ typedef pointer_iterator<NamesList::const_iterator> NamesConstIterator;
typedef
- Cult::Containers::Pair <NamesConstIterator, NamesConstIterator>
+ std::pair<NamesConstIterator, NamesConstIterator>
NamesIteratorPair;
NamesIterator
@@ -511,7 +345,7 @@ namespace XSDFrontend
virtual NamesIteratorPair
find (Name const& name) const
{
- NamesMap::ConstIterator i (names_map_.find (name));
+ NamesMap::const_iterator i (names_map_.find (name));
if (i == names_map_.end ())
return NamesIteratorPair (names_.end (), names_.end ());
@@ -522,42 +356,36 @@ namespace XSDFrontend
NamesIterator
find (Names& e)
{
- ListIteratorMap::Iterator i (iterator_map_.find (&e));
+ ListIteratorMap::iterator i (iterator_map_.find (&e));
return i != iterator_map_.end () ? i->second : names_.end ();
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Scope (Path const& file, UnsignedLong line, UnsignedLong column)
+ public:
+ Scope (Path const& file, unsigned long line, unsigned long column)
: Node (file, line, column)
{
}
- Scope ()
- {
- }
-
- Void
+ void
add_edge_left (Names& e)
{
- NamesList::Iterator i (names_.insert (names_.end (), &e));
+ NamesList::iterator i (names_.insert (names_.end (), &e));
iterator_map_[&e] = i;
names_map_[e.name ()].push_back (&e);
}
- Void
+ void
remove_edge_left (Names& e)
{
- ListIteratorMap::Iterator i (iterator_map_.find (&e));
+ ListIteratorMap::iterator i (iterator_map_.find (&e));
assert (i != iterator_map_.end ());
names_.erase (i->second);
iterator_map_.erase (i);
- NamesMap::Iterator j (names_map_.find (e.name ()));
+ NamesMap::iterator j (names_map_.find (e.name ()));
- for (NamesList::Iterator i (j->second.begin ());
+ for (NamesList::iterator i (j->second.begin ());
i != j->second.end (); ++i)
{
if (*i == &e)
@@ -565,21 +393,16 @@ namespace XSDFrontend
}
}
- //@@ Ideally should be protected but then NodeArg has no way to
- // access it. Maybe when (if) I move NodeArg into Grpah I can
- // resolve this.
- //
- public:
- Void
+ void
add_edge_left (Names& e, NamesIterator const& after)
{
- NamesList::Iterator i;
+ NamesList::iterator i;
if (after.base () == names_.end ())
i = names_.insert (names_.begin (), &e);
else
{
- NamesList::Iterator j (after.base ());
+ NamesList::iterator j (after.base ());
i = names_.insert (++j, &e);
}
@@ -587,9 +410,11 @@ namespace XSDFrontend
names_map_[e.name ()].push_back (&e);
}
- protected:
using Nameable::add_edge_right;
+ protected:
+ Scope () {}
+
private:
NamesList names_;
ListIteratorMap iterator_map_;
@@ -606,22 +431,12 @@ namespace XSDFrontend
class Type: public virtual Nameable
{
protected:
- typedef
- Cult::Containers::Vector<Belongs*>
- Classifies;
-
- typedef
- Cult::Containers::Vector<Inherits*>
- Begets;
-
- typedef
- Cult::Containers::Set<Arguments*>
- ArgumentsSet;
+ typedef std::vector<Belongs*> Classifies;
+ typedef std::vector<Inherits*> Begets;
+ typedef std::set<Arguments*> ArgumentsSet;
public:
- typedef
- Bits::PointerIterator<Classifies::ConstIterator>
- ClassifiesIterator;
+ typedef pointer_iterator<Classifies::const_iterator> ClassifiesIterator;
ClassifiesIterator
classifies_begin () const
@@ -637,7 +452,7 @@ namespace XSDFrontend
//
//
- Boolean
+ bool
inherits_p () const
{
return inherits_ != 0;
@@ -652,9 +467,7 @@ namespace XSDFrontend
//
//
- typedef
- Bits::PointerIterator<Begets::ConstIterator>
- BegetsIterator;
+ typedef pointer_iterator<Begets::const_iterator> BegetsIterator;
BegetsIterator
begets_begin () const
@@ -670,9 +483,7 @@ namespace XSDFrontend
//
//
- typedef
- Bits::PointerIterator<ArgumentsSet::ConstIterator>
- ArgumentsIterator;
+ typedef pointer_iterator<ArgumentsSet::const_iterator> ArgumentsIterator;
ArgumentsIterator
arguments_begin () const
@@ -686,21 +497,16 @@ namespace XSDFrontend
return arguments_.end ();
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Type ()
- : inherits_ (0)
- {
- }
+ public:
+ Type (): inherits_ (0) {}
- Void
+ void
add_edge_right (Belongs& e)
{
classifies_.push_back (&e);
}
- Void
+ void
add_edge_right (Inherits& e)
{
begets_.push_back (&e);
@@ -708,16 +514,16 @@ namespace XSDFrontend
using Nameable::add_edge_right;
- Void
+ void
add_edge_left (Arguments& a)
{
arguments_.insert (&a);
}
- Void
+ void
remove_edge_left (Arguments&);
- Void
+ void
add_edge_left (Inherits& e)
{
inherits_ = &e;
@@ -730,7 +536,6 @@ namespace XSDFrontend
ArgumentsSet arguments_;
};
-
class Instance: public virtual Nameable
{
public:
@@ -743,21 +548,16 @@ namespace XSDFrontend
Type&
type () const;
- Boolean
+ bool
typed_p () const
{
return belongs_ != 0;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Instance ()
- : belongs_ (0)
- {
- }
+ public:
+ Instance (): belongs_ (0) {}
- Void
+ void
add_edge_left (Belongs& e)
{
belongs_ = &e;
@@ -783,20 +583,14 @@ namespace XSDFrontend
return *type_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Belongs ()
- {
- }
-
- Void
+ public:
+ void
set_left_node (Instance& n)
{
instance_ = &n;
}
- Void
+ void
set_right_node (Type& n)
{
type_ = &n;
@@ -825,20 +619,14 @@ namespace XSDFrontend
return *derived_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Inherits ()
- {
- }
-
- Void
+ public:
+ void
set_left_node (Type& n)
{
derived_ = &n;
}
- Void
+ void
set_right_node (Type& n)
{
base_ = &n;
@@ -849,30 +637,17 @@ namespace XSDFrontend
Type* derived_;
};
-
class Extends: public virtual Inherits
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Extends ()
- {
- }
};
class Restricts: public virtual Inherits
{
- protected:
- typedef
- Cult::Containers::Map<WideString, WideString>
- Facets;
-
public:
- typedef
- Facets::Iterator
- FacetIterator;
+ typedef std::map<String, String> Facets;
+ typedef Facets::iterator FacetIterator;
- Boolean
+ bool
facet_empty ()
{
return facets_.empty ();
@@ -891,22 +666,21 @@ namespace XSDFrontend
}
FacetIterator
- facet_find (WideString const& name)
+ facet_find (String const& name)
{
return facets_.find (name);
}
- Void
+ void
facet_insert (String const& name, String const& value)
{
facets_[name] = value;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Restricts ()
+ Facets const&
+ facets () const
{
+ return facets_;
}
protected:
@@ -936,21 +710,16 @@ namespace XSDFrontend
return *namespace__;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- BelongsToNamespace ()
- : member_ (0), namespace__ (0)
- {
- }
+ public:
+ BelongsToNamespace (): member_ (0), namespace__ (0) {}
- Void
+ void
set_left_node (Member& n)
{
member_ = &n;
}
- Void
+ void
set_right_node (Namespace& n)
{
namespace__ = &n;
@@ -969,13 +738,13 @@ namespace XSDFrontend
// Member is global either if it is defined outside any type
// or it is a ref="" of a global member.
//
- Boolean
+ bool
global_p () const
{
return global_;
}
- Boolean
+ bool
qualified_p () const
{
return qualified_;
@@ -995,13 +764,13 @@ namespace XSDFrontend
// is a superset of the default value semantics. As such setting the
// fixed value appears as if the default value was also set.
//
- Boolean
+ bool
default_p () const
{
return value_type_ != ValueType::none;
}
- Boolean
+ bool
fixed_p () const
{
return value_type_ == ValueType::fixed;
@@ -1009,7 +778,7 @@ namespace XSDFrontend
struct NoValue {};
- WideString
+ String
value () const
{
if (value_type_ != ValueType::none)
@@ -1020,24 +789,22 @@ namespace XSDFrontend
//
//
- Void
- default_ (WideString const& v)
+ void
+ default_ (String const& v)
{
value_ = v;
value_type_ = ValueType::default_;
}
- Void
- fixed (WideString const& v)
+ void
+ fixed (String const& v)
{
value_ = v;
value_type_ = ValueType::fixed;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Member (Boolean global, Boolean qualified)
+ public:
+ Member (bool global, bool qualified)
: global_ (global),
qualified_ (qualified),
belongs_to_namespace_ (0),
@@ -1045,7 +812,7 @@ namespace XSDFrontend
{
}
- Void
+ void
add_edge_left (BelongsToNamespace& e)
{
// In the parser we sometimes re-add the same adge.
@@ -1056,8 +823,8 @@ namespace XSDFrontend
using Instance::add_edge_left;
private:
- Boolean global_;
- Boolean qualified_;
+ bool global_;
+ bool qualified_;
BelongsToNamespace* belongs_to_namespace_;
struct ValueType
@@ -1070,7 +837,7 @@ namespace XSDFrontend
};
};
- WideString value_;
+ String value_;
ValueType::Value value_type_;
};
@@ -1080,17 +847,12 @@ namespace XSDFrontend
class Specialization: public virtual Type
{
- typedef
- Cult::Containers::Vector<Arguments*>
- Argumented;
+ typedef std::vector<Arguments*> Argumented;
public:
+ typedef pointer_iterator<Argumented::iterator> ArgumentedIterator;
typedef
- Bits::PointerIterator<Argumented::Iterator>
- ArgumentedIterator;
-
- typedef
- Bits::PointerIterator<Argumented::ConstIterator>
+ pointer_iterator<Argumented::const_iterator>
ArgumentedConstIterator;
ArgumentedIterator
@@ -1125,32 +887,28 @@ namespace XSDFrontend
return *argumented_[0];
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
using Type::add_edge_right;
- Void
+ void
add_edge_right (Arguments& a)
{
argumented_.push_back (&a);
}
- Void
- remove_edge_right (Arguments&);
-
- public:
- Void
+ void
add_edge_right (Arguments& a, ArgumentedIterator const& pos)
{
argumented_.insert (pos.base (), &a);
}
+ void
+ remove_edge_right (Arguments&);
+
private:
Argumented argumented_;
};
-
class Arguments: public virtual Edge
{
public:
@@ -1166,9 +924,7 @@ namespace XSDFrontend
return *specialization_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
void
set_left_node (Type& n)
{
@@ -1205,17 +961,14 @@ namespace XSDFrontend
//
class AnyType: public virtual Type
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- AnyType (Path const& file, UnsignedLong line, UnsignedLong column)
+ public:
+ AnyType (Path const& file, unsigned long line, unsigned long column)
: Node (file, line, column)
{
}
- AnyType () // For virtual inheritance.
- {
- }
+ protected:
+ AnyType () {} // For virtual inheritance.
};
@@ -1223,17 +976,14 @@ namespace XSDFrontend
//
class AnySimpleType: public virtual Type
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- AnySimpleType (Path const& file, UnsignedLong line, UnsignedLong column)
+ public:
+ AnySimpleType (Path const& file, unsigned long line, unsigned long column)
: Node (file, line, column)
{
}
- AnySimpleType () // For virtual inheritance.
- {
- }
+ protected:
+ AnySimpleType () {} // For virtual inheritance.
};
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx
index adcf71e..93bcf79 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx
@@ -1,32 +1,45 @@
// file : xsd-frontend/semantic-graph/enumeration.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/enumeration.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
+ // Enumeration
+ //
+ Enumeration::
+ Enumeration (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
- using RTTI::Access;
- using RTTI::TypeInfo;
+ // Enumerator
+ //
+ Enumerator::
+ Enumerator (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
namespace
{
+ using compiler::type_info;
+
// Enumeration
//
struct EnumerationInit
{
EnumerationInit ()
{
- TypeInfo ti (typeid (Enumeration));
- ti.add_base (Access::public_, true, typeid (Complex));
- RTTI::insert (ti);
+ type_info ti (typeid (Enumeration));
+ ti.add_base (typeid (Complex));
+ insert (ti);
}
-
} enumeration_init_;
@@ -36,32 +49,11 @@ namespace XSDFrontend
{
EnumeratorInit ()
{
- TypeInfo ti (typeid (Enumerator));
- ti.add_base (Access::public_, true, typeid (Instance));
- RTTI::insert (ti);
+ type_info ti (typeid (Enumerator));
+ ti.add_base (typeid (Instance));
+ insert (ti);
}
-
} enumerator_init_;
}
-
-
- // Enumeration
- //
-
- Enumeration::
- Enumeration (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
-
-
- // Enumerator
- //
-
- Enumerator::
- Enumerator (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx
index a21e8f3..90a33d1 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/enumeration.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ENUMERATION_HXX
@@ -15,19 +14,15 @@ namespace XSDFrontend
{
class Enumeration: public virtual Complex
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Enumeration (Path const& file, UnsignedLong line, UnsignedLong column);
+ public:
+ Enumeration (Path const& file, unsigned long line, unsigned long column);
};
class Enumerator: public virtual Instance
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Enumerator (Path const& file, UnsignedLong line, UnsignedLong column);
+ public:
+ Enumerator (Path const& file, unsigned long line, unsigned long column);
};
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx
new file mode 100644
index 0000000..cc98449
--- /dev/null
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx
@@ -0,0 +1,1143 @@
+// file : xsd-frontend/semantic-graph/fundamental.cxx
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Note, that this file is automatically generated!
+//
+
+#include <cutl/compiler/type-info.hxx>
+
+#include <xsd-frontend/semantic-graph/fundamental.hxx>
+
+namespace XSDFrontend
+{
+ namespace SemanticGraph
+ {
+ namespace Fundamental
+ {
+ using compiler::type_info;
+
+ // Type
+ //
+ namespace
+ {
+ struct TypeInit
+ {
+ TypeInit ()
+ {
+ type_info ti (typeid (Type));
+ ti.add_base (typeid (SemanticGraph::Type));
+ insert (ti);
+ }
+ } any_type_init_;
+ }
+
+ Type::
+ Type ()
+ {
+ }
+
+
+ // Byte
+ //
+ namespace
+ {
+ struct ByteInit
+ {
+ ByteInit ()
+ {
+ type_info ti (typeid (Byte));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } byte_init_;
+ }
+
+ Byte::
+ Byte (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // UnsignedByte
+ //
+ namespace
+ {
+ struct UnsignedByteInit
+ {
+ UnsignedByteInit ()
+ {
+ type_info ti (typeid (UnsignedByte));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } unsigned_byte_init_;
+ }
+
+ UnsignedByte::
+ UnsignedByte (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Short
+ //
+ namespace
+ {
+ struct ShortInit
+ {
+ ShortInit ()
+ {
+ type_info ti (typeid (Short));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } short_init_;
+ }
+
+ Short::
+ Short (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // UnsignedShort
+ //
+ namespace
+ {
+ struct UnsignedShortInit
+ {
+ UnsignedShortInit ()
+ {
+ type_info ti (typeid (UnsignedShort));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } unsigned_short_init_;
+ }
+
+ UnsignedShort::
+ UnsignedShort (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Int
+ //
+ namespace
+ {
+ struct IntInit
+ {
+ IntInit ()
+ {
+ type_info ti (typeid (Int));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } int_init_;
+ }
+
+ Int::
+ Int (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // UnsignedInt
+ //
+ namespace
+ {
+ struct UnsignedIntInit
+ {
+ UnsignedIntInit ()
+ {
+ type_info ti (typeid (UnsignedInt));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } unsigned_int_init_;
+ }
+
+ UnsignedInt::
+ UnsignedInt (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Long
+ //
+ namespace
+ {
+ struct LongInit
+ {
+ LongInit ()
+ {
+ type_info ti (typeid (Long));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } long_init_;
+ }
+
+ Long::
+ Long (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // UnsignedLong
+ //
+ namespace
+ {
+ struct UnsignedLongInit
+ {
+ UnsignedLongInit ()
+ {
+ type_info ti (typeid (UnsignedLong));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } unsigned_long_init_;
+ }
+
+ UnsignedLong::
+ UnsignedLong (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Integer
+ //
+ namespace
+ {
+ struct IntegerInit
+ {
+ IntegerInit ()
+ {
+ type_info ti (typeid (Integer));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } integer_init_;
+ }
+
+ Integer::
+ Integer (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // NonPositiveInteger
+ //
+ namespace
+ {
+ struct NonPositiveIntegerInit
+ {
+ NonPositiveIntegerInit ()
+ {
+ type_info ti (typeid (NonPositiveInteger));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } non_positive_integer_init_;
+ }
+
+ NonPositiveInteger::
+ NonPositiveInteger (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // NonNegativeInteger
+ //
+ namespace
+ {
+ struct NonNegativeIntegerInit
+ {
+ NonNegativeIntegerInit ()
+ {
+ type_info ti (typeid (NonNegativeInteger));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } non_negative_integer_init_;
+ }
+
+ NonNegativeInteger::
+ NonNegativeInteger (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // PositiveInteger
+ //
+ namespace
+ {
+ struct PositiveIntegerInit
+ {
+ PositiveIntegerInit ()
+ {
+ type_info ti (typeid (PositiveInteger));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } positive_integer_init_;
+ }
+
+ PositiveInteger::
+ PositiveInteger (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // NegativeInteger
+ //
+ namespace
+ {
+ struct NegativeIntegerInit
+ {
+ NegativeIntegerInit ()
+ {
+ type_info ti (typeid (NegativeInteger));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } negative_integer_init_;
+ }
+
+ NegativeInteger::
+ NegativeInteger (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Boolean
+ //
+ namespace
+ {
+ struct BooleanInit
+ {
+ BooleanInit ()
+ {
+ type_info ti (typeid (Boolean));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } boolean_init_;
+ }
+
+ Boolean::
+ Boolean (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Float
+ //
+ namespace
+ {
+ struct FloatInit
+ {
+ FloatInit ()
+ {
+ type_info ti (typeid (Float));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } float_init_;
+ }
+
+ Float::
+ Float (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Double
+ //
+ namespace
+ {
+ struct DoubleInit
+ {
+ DoubleInit ()
+ {
+ type_info ti (typeid (Double));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } double_init_;
+ }
+
+ Double::
+ Double (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Decimal
+ //
+ namespace
+ {
+ struct DecimalInit
+ {
+ DecimalInit ()
+ {
+ type_info ti (typeid (Decimal));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } decimal_init_;
+ }
+
+ Decimal::
+ Decimal (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // String
+ //
+ namespace
+ {
+ struct StringInit
+ {
+ StringInit ()
+ {
+ type_info ti (typeid (String));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } string_init_;
+ }
+
+ String::
+ String (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // NormalizedString
+ //
+ namespace
+ {
+ struct NormalizedStringInit
+ {
+ NormalizedStringInit ()
+ {
+ type_info ti (typeid (NormalizedString));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } normalized_string_init_;
+ }
+
+ NormalizedString::
+ NormalizedString (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Token
+ //
+ namespace
+ {
+ struct TokenInit
+ {
+ TokenInit ()
+ {
+ type_info ti (typeid (Token));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } token_init_;
+ }
+
+ Token::
+ Token (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Name
+ //
+ namespace
+ {
+ struct NameInit
+ {
+ NameInit ()
+ {
+ type_info ti (typeid (Name));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } name_init_;
+ }
+
+ Name::
+ Name (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // NameToken
+ //
+ namespace
+ {
+ struct NameTokenInit
+ {
+ NameTokenInit ()
+ {
+ type_info ti (typeid (NameToken));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } name_token_init_;
+ }
+
+ NameToken::
+ NameToken (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // NameTokens
+ //
+ namespace
+ {
+ struct NameTokensInit
+ {
+ NameTokensInit ()
+ {
+ type_info ti (typeid (NameTokens));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } name_tokens_init_;
+ }
+
+ NameTokens::
+ NameTokens (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // NCName
+ //
+ namespace
+ {
+ struct NCNameInit
+ {
+ NCNameInit ()
+ {
+ type_info ti (typeid (NCName));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } NC_name_init_;
+ }
+
+ NCName::
+ NCName (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Language
+ //
+ namespace
+ {
+ struct LanguageInit
+ {
+ LanguageInit ()
+ {
+ type_info ti (typeid (Language));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } language_init_;
+ }
+
+ Language::
+ Language (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // QName
+ //
+ namespace
+ {
+ struct QNameInit
+ {
+ QNameInit ()
+ {
+ type_info ti (typeid (QName));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } q_name_init_;
+ }
+
+ QName::
+ QName (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Id
+ //
+ namespace
+ {
+ struct IdInit
+ {
+ IdInit ()
+ {
+ type_info ti (typeid (Id));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } id_init_;
+ }
+
+ Id::
+ Id (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // IdRef
+ //
+ namespace
+ {
+ struct IdRefInit
+ {
+ IdRefInit ()
+ {
+ type_info ti (typeid (IdRef));
+ ti.add_base (typeid (Type));
+ ti.add_base (typeid (Specialization));
+ insert (ti);
+ }
+
+ } id_ref_init_;
+ }
+
+ IdRef::
+ IdRef (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // IdRefs
+ //
+ namespace
+ {
+ struct IdRefsInit
+ {
+ IdRefsInit ()
+ {
+ type_info ti (typeid (IdRefs));
+ ti.add_base (typeid (Type));
+ ti.add_base (typeid (Specialization));
+ insert (ti);
+ }
+
+ } id_refs_init_;
+ }
+
+ IdRefs::
+ IdRefs (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // AnyURI
+ //
+ namespace
+ {
+ struct AnyURIInit
+ {
+ AnyURIInit ()
+ {
+ type_info ti (typeid (AnyURI));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } any_URI_init_;
+ }
+
+ AnyURI::
+ AnyURI (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Base64Binary
+ //
+ namespace
+ {
+ struct Base64BinaryInit
+ {
+ Base64BinaryInit ()
+ {
+ type_info ti (typeid (Base64Binary));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } base_64_binary_init_;
+ }
+
+ Base64Binary::
+ Base64Binary (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // HexBinary
+ //
+ namespace
+ {
+ struct HexBinaryInit
+ {
+ HexBinaryInit ()
+ {
+ type_info ti (typeid (HexBinary));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } hex_binary_init_;
+ }
+
+ HexBinary::
+ HexBinary (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Date
+ //
+ namespace
+ {
+ struct DateInit
+ {
+ DateInit ()
+ {
+ type_info ti (typeid (Date));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } date_init_;
+ }
+
+ Date::
+ Date (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // DateTime
+ //
+ namespace
+ {
+ struct DateTimeInit
+ {
+ DateTimeInit ()
+ {
+ type_info ti (typeid (DateTime));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } date_time_init_;
+ }
+
+ DateTime::
+ DateTime (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Duration
+ //
+ namespace
+ {
+ struct DurationInit
+ {
+ DurationInit ()
+ {
+ type_info ti (typeid (Duration));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } duration_init_;
+ }
+
+ Duration::
+ Duration (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Day
+ //
+ namespace
+ {
+ struct DayInit
+ {
+ DayInit ()
+ {
+ type_info ti (typeid (Day));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } day_init_;
+ }
+
+ Day::
+ Day (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Month
+ //
+ namespace
+ {
+ struct MonthInit
+ {
+ MonthInit ()
+ {
+ type_info ti (typeid (Month));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } month_init_;
+ }
+
+ Month::
+ Month (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // MonthDay
+ //
+ namespace
+ {
+ struct MonthDayInit
+ {
+ MonthDayInit ()
+ {
+ type_info ti (typeid (MonthDay));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } month_day_init_;
+ }
+
+ MonthDay::
+ MonthDay (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Year
+ //
+ namespace
+ {
+ struct YearInit
+ {
+ YearInit ()
+ {
+ type_info ti (typeid (Year));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } year_init_;
+ }
+
+ Year::
+ Year (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // YearMonth
+ //
+ namespace
+ {
+ struct YearMonthInit
+ {
+ YearMonthInit ()
+ {
+ type_info ti (typeid (YearMonth));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } year_month_init_;
+ }
+
+ YearMonth::
+ YearMonth (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Time
+ //
+ namespace
+ {
+ struct TimeInit
+ {
+ TimeInit ()
+ {
+ type_info ti (typeid (Time));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } time_init_;
+ }
+
+ Time::
+ Time (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Entity
+ //
+ namespace
+ {
+ struct EntityInit
+ {
+ EntityInit ()
+ {
+ type_info ti (typeid (Entity));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } entity_init_;
+ }
+
+ Entity::
+ Entity (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Entities
+ //
+ namespace
+ {
+ struct EntitiesInit
+ {
+ EntitiesInit ()
+ {
+ type_info ti (typeid (Entities));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } entities_init_;
+ }
+
+ Entities::
+ Entities (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+
+
+ // Notation
+ //
+ namespace
+ {
+ struct NotationInit
+ {
+ NotationInit ()
+ {
+ type_info ti (typeid (Notation));
+ ti.add_base (typeid (Type));
+ insert (ti);
+ }
+
+ } notation_init_;
+ }
+
+ Notation::
+ Notation (Path const& file,
+ unsigned long line,
+ unsigned long column)
+ : Node (file, line, column)
+ {
+ }
+ }
+ }
+}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4
index cc1316c..c336ab8 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4
@@ -1,8 +1,7 @@
divert(-1)
# file : xsd-frontend/semantic-graph/fundamental.cxx.m4
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
include(`fundamental.m4')
@@ -21,9 +20,9 @@ define(`fundamental_type_impl', `
{
$1Init ()
{
- TypeInfo ti (typeid ($1));
- ti.add_base (Access::public_, true, typeid (Type));
- RTTI::insert (ti);
+ type_info ti (typeid ($1));
+ ti.add_base (typeid (Type));
+ insert (ti);
}
} $2_init_;
@@ -31,8 +30,8 @@ define(`fundamental_type_impl', `
$1::
$1 (Path const& file,
- SemanticGraph::UnsignedLong line,
- SemanticGraph::UnsignedLong column)
+ unsigned long line,
+ unsigned long column)
: Node (file, line, column)
{
}')
@@ -42,13 +41,14 @@ dnl
dnl
dnl
// file : xsd-frontend/semantic-graph/fundamental.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
// Note, that this file is automatically generated!
//
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/fundamental.hxx>
namespace XSDFrontend
@@ -57,11 +57,7 @@ namespace XSDFrontend
{
namespace Fundamental
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
+ using compiler::type_info;
// Type
//
@@ -71,11 +67,10 @@ namespace XSDFrontend
{
TypeInit ()
{
- TypeInfo ti (typeid (Type));
- ti.add_base (Access::public_, true, typeid (SemanticGraph::Type));
- RTTI::insert (ti);
+ type_info ti (typeid (Type));
+ ti.add_base (typeid (SemanticGraph::Type));
+ insert (ti);
}
-
} any_type_init_;
}
@@ -138,10 +133,10 @@ fundamental_type(`id')
{
IdRefInit ()
{
- TypeInfo ti (typeid (IdRef));
- ti.add_base (Access::public_, true, typeid (Type));
- ti.add_base (Access::public_, true, typeid (Specialization));
- RTTI::insert (ti);
+ type_info ti (typeid (IdRef));
+ ti.add_base (typeid (Type));
+ ti.add_base (typeid (Specialization));
+ insert (ti);
}
} id_ref_init_;
@@ -149,8 +144,8 @@ fundamental_type(`id')
IdRef::
IdRef (Path const& file,
- SemanticGraph::UnsignedLong line,
- SemanticGraph::UnsignedLong column)
+ unsigned long line,
+ unsigned long column)
: Node (file, line, column)
{
}
@@ -164,10 +159,10 @@ fundamental_type(`id')
{
IdRefsInit ()
{
- TypeInfo ti (typeid (IdRefs));
- ti.add_base (Access::public_, true, typeid (Type));
- ti.add_base (Access::public_, true, typeid (Specialization));
- RTTI::insert (ti);
+ type_info ti (typeid (IdRefs));
+ ti.add_base (typeid (Type));
+ ti.add_base (typeid (Specialization));
+ insert (ti);
}
} id_refs_init_;
@@ -175,8 +170,8 @@ fundamental_type(`id')
IdRefs::
IdRefs (Path const& file,
- SemanticGraph::UnsignedLong line,
- SemanticGraph::UnsignedLong column)
+ unsigned long line,
+ unsigned long column)
: Node (file, line, column)
{
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx
new file mode 100644
index 0000000..d810824
--- /dev/null
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx
@@ -0,0 +1,516 @@
+// file : xsd-frontend/semantic-graph/fundamental.hxx
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Note, that this file is automatically generated!
+//
+
+#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX
+#define XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX
+
+#include <xsd-frontend/semantic-graph/elements.hxx>
+
+namespace XSDFrontend
+{
+ namespace SemanticGraph
+ {
+ namespace Fundamental
+ {
+ //
+ //
+ class Type: public virtual SemanticGraph::Type
+ {
+ protected:
+ Type ();
+ };
+
+
+ //
+ //
+ class Byte: public virtual Type
+ {
+ public:
+ Byte (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class UnsignedByte: public virtual Type
+ {
+ public:
+ UnsignedByte (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Short: public virtual Type
+ {
+ public:
+ Short (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class UnsignedShort: public virtual Type
+ {
+ public:
+ UnsignedShort (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Int: public virtual Type
+ {
+ public:
+ Int (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class UnsignedInt: public virtual Type
+ {
+ public:
+ UnsignedInt (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Long: public virtual Type
+ {
+ public:
+ Long (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class UnsignedLong: public virtual Type
+ {
+ public:
+ UnsignedLong (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Integer: public virtual Type
+ {
+ public:
+ Integer (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class NonPositiveInteger: public virtual Type
+ {
+ public:
+ NonPositiveInteger (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class NonNegativeInteger: public virtual Type
+ {
+ public:
+ NonNegativeInteger (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class PositiveInteger: public virtual Type
+ {
+ public:
+ PositiveInteger (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class NegativeInteger: public virtual Type
+ {
+ public:
+ NegativeInteger (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Boolean: public virtual Type
+ {
+ public:
+ Boolean (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Float: public virtual Type
+ {
+ public:
+ Float (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Double: public virtual Type
+ {
+ public:
+ Double (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Decimal: public virtual Type
+ {
+ public:
+ Decimal (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class String: public virtual Type
+ {
+ public:
+ String (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class NormalizedString: public virtual Type
+ {
+ public:
+ NormalizedString (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Token: public virtual Type
+ {
+ public:
+ Token (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Name: public virtual Type
+ {
+ public:
+ Name (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class NameToken: public virtual Type
+ {
+ public:
+ NameToken (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class NameTokens: public virtual Type
+ {
+ public:
+ NameTokens (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class NCName: public virtual Type
+ {
+ public:
+ NCName (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Language: public virtual Type
+ {
+ public:
+ Language (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class QName: public virtual Type
+ {
+ public:
+ QName (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Id: public virtual Type
+ {
+ public:
+ Id (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class IdRef: public virtual Type,
+ public virtual Specialization
+ {
+ public:
+ IdRef (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class IdRefs: public virtual Type,
+ public virtual Specialization
+ {
+ public:
+ IdRefs (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class AnyURI: public virtual Type
+ {
+ public:
+ AnyURI (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Base64Binary: public virtual Type
+ {
+ public:
+ Base64Binary (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class HexBinary: public virtual Type
+ {
+ public:
+ HexBinary (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Date: public virtual Type
+ {
+ public:
+ Date (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class DateTime: public virtual Type
+ {
+ public:
+ DateTime (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Duration: public virtual Type
+ {
+ public:
+ Duration (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Day: public virtual Type
+ {
+ public:
+ Day (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Month: public virtual Type
+ {
+ public:
+ Month (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class MonthDay: public virtual Type
+ {
+ public:
+ MonthDay (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Year: public virtual Type
+ {
+ public:
+ Year (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class YearMonth: public virtual Type
+ {
+ public:
+ YearMonth (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Time: public virtual Type
+ {
+ public:
+ Time (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Entity: public virtual Type
+ {
+ public:
+ Entity (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Entities: public virtual Type
+ {
+ public:
+ Entities (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+
+
+ //
+ //
+ class Notation: public virtual Type
+ {
+ public:
+ Notation (Path const& file,
+ unsigned long line,
+ unsigned long column);
+ };
+ }
+ }
+}
+
+#endif // XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4
index f5a88a9..52c9c89 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4
@@ -1,8 +1,7 @@
divert(-1)
# file : xsd-frontend/semantic-graph/fundamental.hxx.m4
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
include(`fundamental.m4')
@@ -15,20 +14,17 @@ define(`fundamental_type_impl', `
//
class $1: public virtual Type
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
$1 (Path const& file,
- SemanticGraph::UnsignedLong line,
- SemanticGraph::UnsignedLong column);
+ unsigned long line,
+ unsigned long column);
};')
divert(0)dnl
dnl
dnl
dnl
// file : xsd-frontend/semantic-graph/fundamental.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
// Note, that this file is automatically generated!
@@ -50,8 +46,6 @@ namespace XSDFrontend
class Type: public virtual SemanticGraph::Type
{
protected:
- friend class Bits::Graph<Node, Edge>;
-
Type ();
};
dnl
@@ -106,12 +100,10 @@ fundamental_type(`id')
class IdRef: public virtual Type,
public virtual Specialization
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
IdRef (Path const& file,
- SemanticGraph::UnsignedLong line,
- SemanticGraph::UnsignedLong column);
+ unsigned long line,
+ unsigned long column);
};
@@ -120,12 +112,10 @@ fundamental_type(`id')
class IdRefs: public virtual Type,
public virtual Specialization
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
IdRefs (Path const& file,
- SemanticGraph::UnsignedLong line,
- SemanticGraph::UnsignedLong column);
+ unsigned long line,
+ unsigned long column);
};
dnl
dnl URI.
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4
index 735b35d..b9243f7 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4
@@ -1,6 +1,5 @@
# file : xsd-frontend/semantic-graph/fundamental.m4
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
define(`upcase', `translit(`$*', `a-z', `A-Z')')
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx
index 3184041..f62f617 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx
@@ -1,37 +1,34 @@
// file : xsd-frontend/semantic-graph/list.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/list.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
+ List::
+ List (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
namespace
{
+ using compiler::type_info;
+
struct ListInit
{
ListInit ()
{
- TypeInfo ti (typeid (List));
- ti.add_base (Access::public_, true, typeid (Specialization));
- RTTI::insert (ti);
+ type_info ti (typeid (List));
+ ti.add_base (typeid (Specialization));
+ insert (ti);
}
-
} list_init_;
}
-
- List::
- List (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx
index 3ba0c02..d7f370f 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/list.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_LIST_HXX
@@ -14,10 +13,8 @@ namespace XSDFrontend
{
class List: public virtual Specialization
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- List (Path const& file, UnsignedLong line, UnsignedLong column);
+ public:
+ List (Path const& file, unsigned long line, unsigned long column);
};
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx
index 789b5d8..e33a892 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx
@@ -1,37 +1,34 @@
// file : xsd-frontend/semantic-graph/namespace.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/namespace.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
+ Namespace::
+ Namespace (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
namespace
{
+ using compiler::type_info;
+
struct NamespaceInit
{
NamespaceInit ()
{
- TypeInfo ti (typeid (Namespace));
- ti.add_base (Access::public_, true, typeid (Scope));
- RTTI::insert (ti);
+ type_info ti (typeid (Namespace));
+ ti.add_base (typeid (Scope));
+ insert (ti);
}
-
} namespace_init_;
}
-
- Namespace::
- Namespace (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx
index 25bd1c0..ccc9d61 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/namespace.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_NAMESPACE_HXX
@@ -14,15 +13,11 @@ namespace XSDFrontend
{
class Namespace : public virtual Scope
{
- protected:
- friend class Bits::Graph<Node, Edge>;
+ public:
+ Namespace (Path const& file, unsigned long line, unsigned long column);
- Namespace (Path const& file, UnsignedLong line, UnsignedLong column);
-
- Void
- add_edge_right (BelongsToNamespace&)
- {
- }
+ void
+ add_edge_right (BelongsToNamespace&) {}
using Scope::add_edge_right;
};
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx
index f8c93de..c3269e6 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx
@@ -1,61 +1,54 @@
// file : xsd-frontend/semantic-graph/particle.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/particle.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
-
// ContainsParticle
//
- namespace
- {
- struct ContainsParticleInit
- {
- ContainsParticleInit ()
- {
- TypeInfo ti (typeid (ContainsParticle));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
- }
-
- } contains_particle_init_;
- }
-
ContainsParticle::
- ContainsParticle (UnsignedLong min, UnsignedLong max)
+ ContainsParticle (unsigned long min, unsigned long max)
: particle_ (0), compositor_ (0), min_ (min), max_ (max)
{
}
// Particle
//
+ Particle::
+ Particle ()
+ : contained_particle_ (0)
+ {
+ }
+
namespace
{
+ using compiler::type_info;
+
+ struct ContainsParticleInit
+ {
+ ContainsParticleInit ()
+ {
+ type_info ti (typeid (ContainsParticle));
+ ti.add_base (typeid (Edge));
+ insert (ti);
+ }
+ } contains_particle_init_;
+
struct ParticleInit
{
ParticleInit ()
{
- TypeInfo ti (typeid (Particle));
- ti.add_base (Access::public_, true, typeid (Node));
- RTTI::insert (ti);
+ type_info ti (typeid (Particle));
+ ti.add_base (typeid (Node));
+ insert (ti);
}
-
} particle_init_;
}
-
- Particle::
- Particle ()
- : contained_particle_ (0)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx
index df48de4..a7f0755 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/particle.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_PARTICLE_HXX
@@ -36,43 +35,41 @@ namespace XSDFrontend
}
public:
- UnsignedLong
+ unsigned long
min () const
{
return min_;
}
- UnsignedLong
+ unsigned long
max () const
{
return max_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- ContainsParticle (UnsignedLong min, UnsignedLong max);
+ public:
+ ContainsParticle (unsigned long min, unsigned long max);
- Void
+ void
set_left_node (Compositor& n)
{
compositor_ = &n;
}
- Void
+ void
set_right_node (Particle& n)
{
particle_ = &n;
}
- Void
+ void
clear_left_node (Compositor& n)
{
assert (compositor_ == &n);
compositor_ = 0;
}
- Void
+ void
clear_right_node (Particle& n)
{
assert (particle_ == &n);
@@ -82,7 +79,7 @@ namespace XSDFrontend
private:
Particle* particle_;
Compositor* compositor_;
- UnsignedLong min_, max_;
+ unsigned long min_, max_;
};
//
@@ -90,7 +87,7 @@ namespace XSDFrontend
class Particle: public virtual Node
{
public:
- Boolean
+ bool
contained_particle_p ()
{
return contained_particle_ != 0;
@@ -104,32 +101,30 @@ namespace XSDFrontend
}
public:
- UnsignedLong
+ unsigned long
min () const
{
assert (contained_particle_ != 0);
return contained_particle_->min ();
}
- UnsignedLong
+ unsigned long
max () const
{
assert (contained_particle_ != 0);
return contained_particle_->max ();
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
+ public:
Particle ();
- Void
+ void
add_edge_right (ContainsParticle& e)
{
contained_particle_ = &e;
}
- Void
+ void
remove_edge_right (ContainsParticle& e)
{
assert (contained_particle_ == &e);
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx
index f812797..d1cbf25 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx
@@ -1,32 +1,64 @@
// file : xsd-frontend/semantic-graph/schema.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/schema.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
+ // Schema
+ //
+ Schema::NamesIteratorPair Schema::
+ find (Name const& name) const
+ {
+ // Here we are going to create an illusion that the namespace
+ // hierarchy is flat.
+ names_.clear ();
+ schemas_.clear ();
+
+ find_ (name, names_, schemas_);
+
+ return NamesIteratorPair (NamesConstIterator (names_.begin ()),
+ NamesConstIterator (names_.end ()));
+ }
+
+ void Schema::
+ find_ (Name const& name, NamesList& names, SchemaSet& set) const
+ {
+ set.insert (this);
+
+ // Check our own namespace first so it will end up first in the list.
+ //
+ NamesIteratorPair pair (Scope::find (name));
+ names.insert (names.end (), pair.first.base (), pair.second.base ());
- using RTTI::Access;
- using RTTI::TypeInfo;
+ for (UsesIterator i (uses_begin ()), end (uses_end ()); i != end; ++i)
+ {
+ Schema& s (i->schema ());
+
+ if (set.find (&s) == set.end ())
+ s.find_ (name, names, set);
+ }
+ }
namespace
{
+ using compiler::type_info;
+
// Uses
//
struct UsesInit
{
UsesInit ()
{
- TypeInfo ti (typeid (Uses));
- ti.add_base (Access::public_, true, typeid (Edge));
- RTTI::insert (ti);
+ type_info ti (typeid (Uses));
+ ti.add_base (typeid (Edge));
+ insert (ti);
}
-
} uses_init_;
@@ -36,11 +68,10 @@ namespace XSDFrontend
{
ImpliesInit ()
{
- TypeInfo ti (typeid (Implies));
- ti.add_base (Access::public_, true, typeid (Uses));
- RTTI::insert (ti);
+ type_info ti (typeid (Implies));
+ ti.add_base (typeid (Uses));
+ insert (ti);
}
-
} implies_init_;
@@ -50,11 +81,10 @@ namespace XSDFrontend
{
SourcesInit ()
{
- TypeInfo ti (typeid (Sources));
- ti.add_base (Access::public_, true, typeid (Uses));
- RTTI::insert (ti);
+ type_info ti (typeid (Sources));
+ ti.add_base (typeid (Uses));
+ insert (ti);
}
-
} sources_init_;
@@ -64,11 +94,10 @@ namespace XSDFrontend
{
IncludesInit ()
{
- TypeInfo ti (typeid (Includes));
- ti.add_base (Access::public_, true, typeid (Uses));
- RTTI::insert (ti);
+ type_info ti (typeid (Includes));
+ ti.add_base (typeid (Uses));
+ insert (ti);
}
-
} includes_init_;
@@ -78,11 +107,10 @@ namespace XSDFrontend
{
ImportsInit ()
{
- TypeInfo ti (typeid (Imports));
- ti.add_base (Access::public_, true, typeid (Uses));
- RTTI::insert (ti);
+ type_info ti (typeid (Imports));
+ ti.add_base (typeid (Uses));
+ insert (ti);
}
-
} imports_init_;
@@ -92,48 +120,11 @@ namespace XSDFrontend
{
SchemaInit ()
{
- TypeInfo ti (typeid (Schema));
- ti.add_base (Access::public_, true, typeid (Scope));
- RTTI::insert (ti);
+ type_info ti (typeid (Schema));
+ ti.add_base (typeid (Scope));
+ insert (ti);
}
-
} schema_init_;
}
-
-
- // Schema
- //
- Schema::NamesIteratorPair Schema::
- find (Name const& name) const
- {
- // Here we are going to create an illusion that the namespace
- // hierarchy is flat.
- names_.clear ();
- schemas_.clear ();
-
- find_ (name, names_, schemas_);
-
- return NamesIteratorPair (NamesConstIterator (names_.begin ()),
- NamesConstIterator (names_.end ()));
- }
-
- Void Schema::
- find_ (Name const& name, NamesList& names, SchemaSet& set) const
- {
- set.insert (this);
-
- // Check our own namespace first so it will end up first in the list.
- //
- NamesIteratorPair pair (Scope::find (name));
- names.insert (names.end (), pair.first.base (), pair.second.base ());
-
- for (UsesIterator i (uses_begin ()), end (uses_end ()); i != end; ++i)
- {
- Schema& s (i->schema ());
-
- if (set.find (&s) == set.end ())
- s.find_ (name, names, set);
- }
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx
index 10d2f75..803c870 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx
@@ -1,12 +1,12 @@
// file : xsd-frontend/semantic-graph/schema.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_SCHEMA_HXX
#define XSD_FRONTEND_SEMANTIC_GRAPH_SCHEMA_HXX
-#include <cult/containers/set.hxx>
+#include <set>
+#include <vector>
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/namespace.hxx>
@@ -15,11 +15,8 @@ namespace XSDFrontend
{
namespace SemanticGraph
{
- //
- //
class Schema;
-
class Uses: public virtual Edge
{
public:
@@ -41,21 +38,16 @@ namespace XSDFrontend
return path_;
}
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Uses (Path const& path)
- : path_ (path)
- {
- }
+ public:
+ Uses (Path const& path): path_ (path) {}
- Void
+ void
set_left_node (Schema& s)
{
user_ = &s;
}
- Void
+ void
set_right_node (Schema& s)
{
schema_ = &s;
@@ -72,13 +64,8 @@ namespace XSDFrontend
//
class Implies: public virtual Uses
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Implies (Path const& path)
- : Uses (path)
- {
- }
+ public:
+ Implies (Path const& path): Uses (path) {}
};
@@ -86,13 +73,8 @@ namespace XSDFrontend
//
class Sources: public virtual Uses
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Sources (Path const& path)
- : Uses (path)
- {
- }
+ public:
+ Sources (Path const& path): Uses (path) {}
};
@@ -100,13 +82,8 @@ namespace XSDFrontend
//
class Includes: public virtual Uses
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Includes (Path const& path)
- : Uses (path)
- {
- }
+ public:
+ Includes (Path const& path): Uses (path) {}
};
@@ -114,40 +91,29 @@ namespace XSDFrontend
//
class Imports: public virtual Uses
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Imports (Path const& path)
- : Uses (path)
- {
- }
+ public:
+ Imports (Path const& path): Uses (path) {}
};
-
//
//
- class Schema: public virtual Scope,
- private Bits::Graph<Node, Edge>,
- public NonCopyable
+ class Schema: public graph, public virtual Scope
{
- typedef
- Cult::Containers::Vector<Uses*>
- UsesList;
-
- typedef
- Cult::Containers::Vector<Uses*>
- UsedList;
+ typedef std::vector<Uses*> UsesList;
+ typedef std::vector<Uses*> UsedList;
public:
- Schema (Path const& file, UnsignedLong line, UnsignedLong column)
- : SemanticGraph::Node (file, line, column)
+ Schema (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column), graph_ (*this)
{
}
+ private:
+ Schema (Schema const&);
+ Schema& operator= (Schema const&);
+
public:
- typedef
- Bits::PointerIterator<UsesList::ConstIterator>
- UsesIterator;
+ typedef pointer_iterator<UsesList::const_iterator> UsesIterator;
UsesIterator
uses_begin () const
@@ -161,9 +127,8 @@ namespace XSDFrontend
return uses_.end ();
}
- typedef
- Bits::PointerIterator<UsedList::ConstIterator>
- UsedIterator;
+ public:
+ typedef pointer_iterator<UsedList::const_iterator> UsedIterator;
UsedIterator
used_begin () const
@@ -177,7 +142,7 @@ namespace XSDFrontend
return used_.end ();
}
- Boolean
+ bool
used_p () const
{
return used_begin () != used_end ();
@@ -187,90 +152,81 @@ namespace XSDFrontend
find (Name const& name) const;
public:
- using Bits::Graph<SemanticGraph::Node, Edge>::new_edge;
- using Bits::Graph<SemanticGraph::Node, Edge>::reset_left_node;
- using Bits::Graph<SemanticGraph::Node, Edge>::reset_right_node;
- using Bits::Graph<SemanticGraph::Node, Edge>::add_edge_left;
- using Bits::Graph<SemanticGraph::Node, Edge>::add_edge_right;
- using Bits::Graph<SemanticGraph::Node, Edge>::delete_node;
- using Bits::Graph<SemanticGraph::Node, Edge>::delete_edge;
+ using graph::new_edge;
+ using graph::reset_left_node;
+ using graph::reset_right_node;
+ using graph::add_edge_left;
+ using graph::add_edge_right;
+ using graph::delete_node;
+ using graph::delete_edge;
template <typename T>
T&
- new_node (Path const& file, UnsignedLong line, UnsignedLong column)
+ new_node (Path const& file, unsigned long line, unsigned long column)
{
- return graph ().new_node<T> (file, line, column);
+ return graph_.new_node<T> (file, line, column);
}
template <typename T, typename A0>
T&
- new_node (Path const& file, UnsignedLong line, UnsignedLong column,
+ new_node (Path const& file, unsigned long line, unsigned long column,
A0 const& a0)
{
- return graph ().new_node<T> (file, line, column, a0);
+ return graph_.new_node<T> (file, line, column, a0);
}
template <typename T, typename A0, typename A1>
T&
- new_node (Path const& file, UnsignedLong line, UnsignedLong column,
+ new_node (Path const& file, unsigned long line, unsigned long column,
A0 const& a0, A1 const& a1)
{
- return graph ().new_node<T> (file, line, column, a0, a1);
+ return graph_.new_node<T> (file, line, column, a0, a1);
}
template <typename T, typename A0, typename A1, typename A2>
T&
- new_node (Path const& file, UnsignedLong line, UnsignedLong column,
+ new_node (Path const& file, unsigned long line, unsigned long column,
A0 const& a0, A1 const& a1, A2 const& a2)
{
- return graph ().new_node<T> (file, line, column, a0, a1, a2);
+ return graph_.new_node<T> (file, line, column, a0, a1, a2);
}
template <typename T, typename A0, typename A1, typename A2,
typename A3>
T&
- new_node (Path const& file, UnsignedLong line, UnsignedLong column,
+ new_node (Path const& file, unsigned long line, unsigned long column,
A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3)
{
- return graph ().new_node<T> (file, line, column, a0, a1, a2, a3);
+ return graph_.new_node<T> (file, line, column, a0, a1, a2, a3);
}
- protected:
- //@@ gcc bug #21146
- //
- friend class Bits::Graph<SemanticGraph::Node, Edge>;
-
+ public:
using Scope::add_edge_left;
using Node::add_edge_right;
- Void
+ void
add_edge_left (Uses& e)
{
uses_.push_back (&e);
}
- Void
+ void
add_edge_right (Uses& e)
{
used_.push_back (&e);
}
private:
- Bits::Graph<SemanticGraph::Node, Edge>&
- graph ()
- {
- return *this;
- }
+ typedef std::set<Schema const*> SchemaSet;
- private:
- UsesList uses_;
- UsedList used_;
+ void
+ find_ (Name const& name, NamesList&, SchemaSet&) const;
private:
- typedef Cult::Containers::Set<Schema const*> SchemaSet;
+ graph& graph_;
- Void
- find_ (Name const& name, NamesList&, SchemaSet&) const;
+ UsesList uses_;
+ UsedList used_;
mutable NamesList names_;
mutable SchemaSet schemas_;
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx
index b4b4cf0..4e7436d 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx
@@ -1,37 +1,34 @@
// file : xsd-frontend/semantic-graph/union.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/union.hxx>
namespace XSDFrontend
{
namespace SemanticGraph
{
- namespace RTTI = Cult::RTTI;
-
- using RTTI::Access;
- using RTTI::TypeInfo;
+ Union::
+ Union (Path const& file, unsigned long line, unsigned long column)
+ : Node (file, line, column)
+ {
+ }
namespace
{
+ using compiler::type_info;
+
struct UnionInit
{
UnionInit ()
{
- TypeInfo ti (typeid (Union));
- ti.add_base (Access::public_, true, typeid (Specialization));
- RTTI::insert (ti);
+ type_info ti (typeid (Union));
+ ti.add_base (typeid (Specialization));
+ insert (ti);
}
-
} union_init_;
}
-
- Union::
- Union (Path const& file, UnsignedLong line, UnsignedLong column)
- : Node (file, line, column)
- {
- }
}
}
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx
index 62df730..d7ba385 100644
--- a/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx
+++ b/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/semantic-graph/union.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_UNION_HXX
@@ -14,10 +13,8 @@ namespace XSDFrontend
{
class Union: public virtual Specialization
{
- protected:
- friend class Bits::Graph<Node, Edge>;
-
- Union (Path const& file, UnsignedLong line, UnsignedLong column);
+ public:
+ Union (Path const& file, unsigned long line, unsigned long column);
};
}
}
diff --git a/libxsd-frontend/xsd-frontend/transformations/anonymous.cxx b/libxsd-frontend/xsd-frontend/transformations/anonymous.cxx
index 118fd5d..1c42d98 100644
--- a/libxsd-frontend/xsd-frontend/transformations/anonymous.cxx
+++ b/libxsd-frontend/xsd-frontend/transformations/anonymous.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/transformations/anonymous.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/transformations/anonymous.hxx>
@@ -10,27 +9,281 @@
#include <iostream>
#include <sstream>
+#include <typeinfo>
using std::wcerr;
using std::endl;
namespace XSDFrontend
{
- using namespace Cult;
-
- typedef WideString String;
-
namespace
{
using Transformations::AnonymousNameTranslator;
+ //
+ //
+ struct CompareMembers: Traversal::Element,
+ Traversal::Attribute,
+ Traversal::Any,
+ Traversal::AnyAttribute
+ {
+ CompareMembers (SemanticGraph::Nameable& m, bool& r)
+ : member_ (m), result_ (r)
+ {
+ }
+
+ virtual void
+ traverse (SemanticGraph::Element& x)
+ {
+ using SemanticGraph::Element;
+
+ Element& y (dynamic_cast<Element&> (member_));
+
+ // Check cardinalities.
+ //
+ if (x.min () != y.min () || x.max () != y.max ())
+ return;
+
+ traverse_member (x);
+ }
+
+ virtual void
+ traverse (SemanticGraph::Attribute& x)
+ {
+ using SemanticGraph::Attribute;
+
+ Attribute& y (dynamic_cast<Attribute&> (member_));
+
+ // Check cardinalities.
+ //
+ if (x.optional_p () != y.optional_p ())
+ return;
+
+ traverse_member (x);
+ }
+
+ virtual void
+ traverse_member (SemanticGraph::Member& x)
+ {
+ using SemanticGraph::Member;
+
+ Member& y (dynamic_cast<Member&> (member_));
+
+ // Check name.
+ //
+ if (x.name () != y.name ())
+ return;
+
+ // Check namespace.
+ //
+ if (x.qualified_p () || y.qualified_p ())
+ {
+ if (!x.qualified_p () || !y.qualified_p ())
+ return;
+
+ if (x.namespace_ ().name () != y.namespace_ ().name ())
+ return;
+ }
+
+ // Check type.
+ //
+ // @@ What if types are anonymous and structurally equal?
+ //
+ if (&x.type () != &y.type ())
+ return;
+
+ // Check default/fixed values.
+ //
+ if (x.default_p () != y.default_p () || x.fixed_p () != y.fixed_p ())
+ return;
+
+ if (x.default_p () && x.value () != y.value ())
+ return;
+
+ result_ = true;
+ }
+
+ virtual void
+ traverse (SemanticGraph::Any&)
+ {
+ //@@ TODO
+ }
+
+ virtual void
+ traverse (SemanticGraph::AnyAttribute&)
+ {
+ //@@ TODO
+ }
+
+ private:
+ SemanticGraph::Nameable& member_;
+ bool& result_;
+ };
+
+ // Compare two types for structural equality.
+ //
+ struct CompareTypes: Traversal::List,
+ Traversal::Union,
+ Traversal::Enumeration,
+ Traversal::Complex
+ {
+ CompareTypes (SemanticGraph::Type& t, bool& r)
+ : type_ (t), result_ (r)
+ {
+ }
+
+
+ virtual void
+ traverse (SemanticGraph::List&)
+ {
+ using SemanticGraph::List;
+
+ //List& y (dynamic_cast<List&> (type_));
+ }
+
+ virtual void
+ traverse (SemanticGraph::Union& x)
+ {
+ using SemanticGraph::Union;
+
+ Union& y (dynamic_cast<Union&> (type_));
+
+ Union::ArgumentedIterator ix (x.argumented_begin ()),
+ iy (y.argumented_begin ());
+
+ for (; ix != x.argumented_end () && iy != y.argumented_end ();
+ ++ix, ++iy)
+ {
+ // @@ Anon structurally equivalent.
+ //
+ if (&iy->type () != &ix->type ())
+ return;
+ }
+
+ result_ = true;
+ }
+
+ virtual void
+ traverse (SemanticGraph::Enumeration& x)
+ {
+ using SemanticGraph::Enumeration;
+
+ Enumeration& y (dynamic_cast<Enumeration&> (type_));
+
+ // Bases should be the same.
+ //
+ if (&x.inherits ().base () != &y.inherits ().base ())
+ return;
+
+ // Make sure facets match.
+ //
+ using SemanticGraph::Restricts;
+
+ Restricts& rx (dynamic_cast<Restricts&> (x.inherits ()));
+ Restricts& ry (dynamic_cast<Restricts&> (y.inherits ()));
+
+ if (rx.facets () != ry.facets ())
+ return;
+
+ // Compare enumerators.
+ //
+ using SemanticGraph::Scope;
+
+ Scope::NamesIterator ix (x.names_begin ()), iy (y.names_begin ());
+ for (; ix != x.names_end () && iy != y.names_end (); ++ix, ++iy)
+ {
+ if (ix->name () != iy->name ())
+ return;
+ }
+
+ if (ix != x.names_end () || iy != y.names_end ())
+ return;
+
+ result_ = true;
+ }
+
+ virtual void
+ traverse (SemanticGraph::Complex& x)
+ {
+ using SemanticGraph::Complex;
+
+ Complex& y (dynamic_cast<Complex&> (type_));
+
+ // Check inheritance.
+ //
+ if (x.inherits_p () || y.inherits_p ())
+ {
+ // They both must inherits.
+ //
+ if (!x.inherits_p () || !y.inherits_p ())
+ return;
+
+ // With the same kind of inheritance (restriction or extension).
+ //
+ if (typeid (x.inherits ()) != typeid (y.inherits ()))
+ return;
+
+ // Bases should be the same.
+ //
+ // @@ What if bases are anonymous?
+ //
+ if (&x.inherits ().base () != &y.inherits ().base ())
+ return;
+
+ // If it is a restriction, make sure facets match.
+ //
+ using SemanticGraph::Restricts;
+
+ if (x.inherits ().is_a<Restricts> ())
+ {
+ Restricts& rx (dynamic_cast<Restricts&> (x.inherits ()));
+ Restricts& ry (dynamic_cast<Restricts&> (y.inherits ()));
+
+ if (rx.facets () != ry.facets ())
+ return;
+ }
+ }
+
+ // Check the member list.
+ //
+ // @@ Ignoring compositors at the moment.
+ //
+ using SemanticGraph::Scope;
+
+ Scope::NamesIterator ix (x.names_begin ()), iy (y.names_begin ());
+ for (; ix != x.names_end () && iy != y.names_end (); ++ix, ++iy)
+ {
+ if (typeid (ix->named ()) != typeid (iy->named ()))
+ return;
+
+ bool equal (false);
+ CompareMembers t (iy->named (), equal);
+ t.dispatch (ix->named ());
+
+ if (!equal)
+ return;
+ }
+
+ if (ix != x.names_end () || iy != y.names_end ())
+ return;
+
+ result_ = true;
+ }
+
+ private:
+ SemanticGraph::Type& type_;
+ bool& result_;
+ };
+
+ //
+ //
class Context
{
public:
Context (SemanticGraph::Schema& schema_,
SemanticGraph::Path const& file,
AnonymousNameTranslator& trans_,
- Boolean du)
+ bool du)
: schema_path_ (file),
ns_ (0),
failed_ (false),
@@ -56,6 +309,19 @@ namespace XSDFrontend
}
public:
+
+ bool
+ structurally_equal (SemanticGraph::Type& x, SemanticGraph::Type& y)
+ {
+ if (typeid (x) != typeid (y))
+ return false;
+
+ bool r (false);
+ CompareTypes t (y, r);
+ t.dispatch (x);
+ return r;
+ }
+
struct UnstableConflict
{
UnstableConflict (SemanticGraph::Type& type)
@@ -73,7 +339,7 @@ namespace XSDFrontend
SemanticGraph::Type& type_;
};
- Boolean
+ SemanticGraph::Type*
conflict (String const& name)
{
using SemanticGraph::Type;
@@ -96,10 +362,10 @@ namespace XSDFrontend
throw UnstableConflict (*t1);
}
- return true;
+ return t1;
}
- return false;
+ return 0;
}
SemanticGraph::Type*
@@ -179,17 +445,17 @@ namespace XSDFrontend
private:
SemanticGraph::Path const schema_path_;
SemanticGraph::Namespace* ns_;
- Boolean failed_;
+ bool failed_;
public:
AnonymousNameTranslator& trans;
- Boolean detect_unstable;
+ bool detect_unstable;
public:
SemanticGraph::Schema& schema;
SemanticGraph::Path const& schema_path;
SemanticGraph::Namespace*& ns;
- Boolean& failed;
+ bool& failed;
};
@@ -198,7 +464,7 @@ namespace XSDFrontend
//
struct Uses: Traversal::Uses
{
- virtual Void
+ virtual void
traverse (Type& u)
{
SemanticGraph::Schema& s (u.schema ());
@@ -220,13 +486,13 @@ namespace XSDFrontend
{
}
- Void
+ void
pre (SemanticGraph::Namespace& ns)
{
ns_ = &ns;
}
- Void
+ void
post (SemanticGraph::Namespace&)
{
ns_ = 0;
@@ -248,7 +514,7 @@ namespace XSDFrontend
{
}
- virtual Void
+ virtual void
traverse (SemanticGraph::List& l)
{
SemanticGraph::Type& t (l.argumented ().type ());
@@ -264,6 +530,7 @@ namespace XSDFrontend
// Run the name through the translation service.
//
SemanticGraph::Path file (path (l));
+ file.normalize ();
String file_str;
// Try to use the portable representation of the path. If that
@@ -271,15 +538,11 @@ namespace XSDFrontend
//
try
{
- file_str = file.string ();
+ file_str = file.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- file_str = file.native_file_string ();
-#else
file_str = file.string ();
-#endif
}
String name (
@@ -288,7 +551,7 @@ namespace XSDFrontend
// Make sure the name is unique.
//
- UnsignedLong n (1);
+ unsigned long n (1);
String escaped (name);
while (conflict (escaped))
@@ -330,7 +593,7 @@ namespace XSDFrontend
}
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Union& u)
{
String file_str;
@@ -352,21 +615,18 @@ namespace XSDFrontend
if (!file_str)
{
SemanticGraph::Path file (path (u));
+ file.normalize ();
// Try to use the portable representation of the path. If
// that fails, fall back to the native representation.
//
try
{
- file_str = file.string ();
+ file_str = file.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- file_str = file.native_file_string ();
-#else
file_str = file.string ();
-#endif
}
}
@@ -376,7 +636,7 @@ namespace XSDFrontend
// Make sure the name is unique.
//
- UnsignedLong n (1);
+ unsigned long n (1);
String escaped (name);
while (conflict (escaped))
@@ -419,7 +679,7 @@ namespace XSDFrontend
}
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Complex& c)
{
if (!c.inherits_p ())
@@ -438,6 +698,7 @@ namespace XSDFrontend
// Run the name through the translation service.
//
SemanticGraph::Path file (path (c));
+ file.normalize ();
String file_str;
// Try to use the portable representation of the path. If that
@@ -445,15 +706,11 @@ namespace XSDFrontend
//
try
{
- file_str = file.string ();
+ file_str = file.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- file_str = file.native_file_string ();
-#else
file_str = file.string ();
-#endif
}
String name (
@@ -462,7 +719,7 @@ namespace XSDFrontend
// Make sure the name is unique.
//
- UnsignedLong n (1);
+ unsigned long n (1);
String escaped (name);
while (conflict (escaped))
@@ -517,7 +774,7 @@ namespace XSDFrontend
{
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Element& e)
{
SemanticGraph::Type& t (e.type ());
@@ -560,7 +817,7 @@ namespace XSDFrontend
}
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Attribute& a)
{
SemanticGraph::Type& t (a.type ());
@@ -603,7 +860,7 @@ namespace XSDFrontend
}
}
- Void
+ void
traverse_ (SemanticGraph::Member& m)
{
using SemanticGraph::Type;
@@ -640,6 +897,7 @@ namespace XSDFrontend
// Run the name through the translation service.
//
SemanticGraph::Path file (path (m));
+ file.normalize ();
String file_str;
// Try to use the portable representation of the path. If that
@@ -647,27 +905,46 @@ namespace XSDFrontend
//
try
{
- file_str = file.string ();
+ file_str = file.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- file_str = file.native_file_string ();
-#else
file_str = file.string ();
-#endif
}
String name (
trans.translate (file_str, ns->name (), m.name (), xpath (m)));
- // Make sure the name is unique.
+ // Check if this name conflicts.
//
- UnsignedLong n (1);
+ unsigned long n (1);
String escaped (name);
- while (conflict (escaped))
+ while (SemanticGraph::Type* other = conflict (escaped))
{
+ // First see if we should just use the other type. It should
+ // also have been anonymous and structurally equal to our type.
+ //
+ if (other->context ().count ("anonymous"))
+ {
+ if (structurally_equal (t, *other))
+ {
+ // Reset the elements that are classified by this type to point
+ // to the other type.
+ //
+ for (Type::ClassifiesIterator i (t.classifies_begin ());
+ i != t.classifies_end (); ++i)
+ {
+ schema.reset_right_node (*i, *other);
+ }
+
+ //wcerr << "equal " << name << endl;
+ return;
+ }
+ //else
+ //wcerr << "unequal " << name << endl;
+ }
+
std::wostringstream os;
os << n++;
escaped = name + os.str ();
@@ -687,10 +964,10 @@ namespace XSDFrontend
{
}
- Void Anonymous::
+ void Anonymous::
transform (SemanticGraph::Schema& s,
SemanticGraph::Path const& f,
- Boolean duc)
+ bool duc)
{
Context ctx (s, f, trans_, duc);
diff --git a/libxsd-frontend/xsd-frontend/transformations/anonymous.hxx b/libxsd-frontend/xsd-frontend/transformations/anonymous.hxx
index 2409822..cafd187 100644
--- a/libxsd-frontend/xsd-frontend/transformations/anonymous.hxx
+++ b/libxsd-frontend/xsd-frontend/transformations/anonymous.hxx
@@ -1,12 +1,11 @@
// file : xsd-frontend/transformations/anonymous.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRANSFORMATIONS_ANONYMOUS_HXX
#define XSD_FRONTEND_TRANSFORMATIONS_ANONYMOUS_HXX
-#include <cult/types.hxx>
+#include <xsd-frontend/types.hxx>
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
#include <xsd-frontend/semantic-graph/schema.hxx>
@@ -15,8 +14,6 @@ namespace XSDFrontend
{
namespace Transformations
{
- using namespace Cult::Types;
-
class AnonymousNameTranslator
{
public:
@@ -26,11 +23,11 @@ namespace XSDFrontend
// The file argument is empty for the currect translation
// unit.
//
- virtual WideString
- translate (WideString const& file,
- WideString const& ns,
- WideString const& name,
- WideString const& xpath) = 0;
+ virtual String
+ translate (String const& file,
+ String const& ns,
+ String const& name,
+ String const& xpath) = 0;
};
// This transformation morphs anonymous types into named ones
@@ -46,10 +43,10 @@ namespace XSDFrontend
Anonymous (AnonymousNameTranslator&);
- Void
+ void
transform (SemanticGraph::Schema&,
SemanticGraph::Path const&,
- Boolean detect_unstable_conflicts);
+ bool detect_unstable_conflicts);
private:
AnonymousNameTranslator& trans_;
diff --git a/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx b/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx
index e10b9d3..26ad16c 100644
--- a/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx
+++ b/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx
@@ -1,23 +1,19 @@
// file : xsd-frontend/transformations/enum-synthesis.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <xsd-frontend/transformations/enum-synthesis.hxx>
+#include <set>
#include <xsd-frontend/semantic-graph.hxx>
#include <xsd-frontend/traversal.hxx>
-#include <cult/containers/set.hxx>
+#include <xsd-frontend/transformations/enum-synthesis.hxx>
namespace XSDFrontend
{
- using namespace Cult;
- typedef WideString String;
-
namespace
{
- typedef Cult::Containers::Set<String> Enumerators;
+ typedef std::set<String> Enumerators;
struct Enumerator: Traversal::Enumerator
{
@@ -28,7 +24,7 @@ namespace XSDFrontend
{
}
- virtual Void
+ virtual void
traverse (Type& e)
{
String const& name (e.name ());
@@ -64,7 +60,7 @@ namespace XSDFrontend
{
}
- virtual Void
+ virtual void
traverse (Type& u)
{
using SemanticGraph::Enumeration;
@@ -208,7 +204,7 @@ namespace XSDFrontend
//
struct Uses: Traversal::Uses
{
- virtual Void
+ virtual void
traverse (Type& u)
{
SemanticGraph::Schema& s (u.schema ());
@@ -224,7 +220,7 @@ namespace XSDFrontend
namespace Transformations
{
- Void EnumSynthesis::
+ void EnumSynthesis::
transform (SemanticGraph::Schema& s, SemanticGraph::Path const&)
{
Traversal::Schema schema;
diff --git a/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx b/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx
index e3c38c7..9f0f970 100644
--- a/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx
+++ b/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx
@@ -1,12 +1,11 @@
// file : xsd-frontend/transformations/enum-synthesis.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRANSFORMATIONS_ENUM_SYNTHESIS_HXX
#define XSD_FRONTEND_TRANSFORMATIONS_ENUM_SYNTHESIS_HXX
-#include <cult/types.hxx>
+#include <xsd-frontend/types.hxx>
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
#include <xsd-frontend/semantic-graph/schema.hxx>
@@ -15,8 +14,6 @@ namespace XSDFrontend
{
namespace Transformations
{
- using namespace Cult::Types;
-
// This transformation replaces unions of one or more enumerations
// with the same base with an equivalent synthesized enumeration.
// This transformation assumes that there are no anonymous types.
@@ -24,7 +21,7 @@ namespace XSDFrontend
class EnumSynthesis
{
public:
- Void
+ void
transform (SemanticGraph::Schema&, SemanticGraph::Path const&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/transformations/restriction.cxx b/libxsd-frontend/xsd-frontend/transformations/restriction.cxx
index c58d98f..edd74be 100644
--- a/libxsd-frontend/xsd-frontend/transformations/restriction.cxx
+++ b/libxsd-frontend/xsd-frontend/transformations/restriction.cxx
@@ -1,27 +1,21 @@
// file : xsd-frontend/transformations/restriction.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <xsd-frontend/transformations/restriction.hxx>
+#include <vector>
+#include <iostream>
#include <xsd-frontend/semantic-graph.hxx>
#include <xsd-frontend/traversal.hxx>
-#include <cult/containers/vector.hxx>
-
-#include <iostream>
+#include <xsd-frontend/transformations/restriction.hxx>
-using std::wcerr;
-using std::endl;
+using namespace std;
namespace XSDFrontend
{
- using namespace Cult;
-
- typedef WideString String;
typedef Transformations::Restriction::Failed Failed;
- typedef Containers::Vector<SemanticGraph::Complex*> BaseList;
+ typedef std::vector<SemanticGraph::Complex*> BaseList;
namespace
{
@@ -34,7 +28,7 @@ namespace XSDFrontend
{
}
- virtual Void
+ virtual void
traverse (Type& c)
{
using namespace SemanticGraph;
@@ -107,7 +101,7 @@ namespace XSDFrontend
else
{
Compositor::ContainsIterator i (root.contains_begin ());
- BaseList::ReverseIterator j (base_model.rbegin ());
+ BaseList::reverse_iterator j (base_model.rbegin ());
for (; i != root.contains_end (); ++i, ++j)
{
@@ -153,7 +147,7 @@ namespace XSDFrontend
}
private:
- Void
+ void
handle (SemanticGraph::Particle& r, SemanticGraph::Particle& b)
{
using namespace SemanticGraph;
@@ -215,7 +209,7 @@ namespace XSDFrontend
}
}
- Boolean
+ bool
match (SemanticGraph::Particle& r, SemanticGraph::Particle& b)
{
using namespace SemanticGraph;
@@ -282,7 +276,7 @@ namespace XSDFrontend
return false;
}
- Void
+ void
merge_attributes (SemanticGraph::Complex& c,
SemanticGraph::Complex& base)
{
@@ -364,12 +358,12 @@ namespace XSDFrontend
}
}
- Void
+ void
handle_any_attributes (SemanticGraph::Complex& c, BaseList& bl)
{
using namespace SemanticGraph;
- BaseList::ReverseIterator bi (bl.rbegin ()), be (bl.rend ());
+ BaseList::reverse_iterator bi (bl.rbegin ()), be (bl.rend ());
Scope::NamesIterator si;
if (bi != be)
@@ -432,14 +426,14 @@ namespace XSDFrontend
struct Anonymous : Traversal::Element,
Traversal::Attribute
{
- Anonymous (Traversal::NodeDispatcherBase& d1)
+ Anonymous (Traversal::NodeDispatcher& d1)
: complex_ (&d1, 0)
{
*this >> belongs_ >> complex_;
}
- Anonymous (Traversal::NodeDispatcherBase& d1,
- Traversal::NodeDispatcherBase& d2)
+ Anonymous (Traversal::NodeDispatcher& d1,
+ Traversal::NodeDispatcher& d2)
: complex_ (&d1, &d2)
{
*this >> belongs_ >> complex_;
@@ -460,7 +454,7 @@ namespace XSDFrontend
public:
- virtual Void
+ virtual void
traverse (SemanticGraph::Element& e)
{
SemanticGraph::Type& t (e.type ());
@@ -479,7 +473,7 @@ namespace XSDFrontend
}
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Attribute& a)
{
SemanticGraph::Type& t (a.type ());
@@ -501,13 +495,13 @@ namespace XSDFrontend
private:
struct Complex : Traversal::Complex
{
- Complex (Traversal::NodeDispatcherBase* d1,
- Traversal::NodeDispatcherBase* d2)
+ Complex (Traversal::NodeDispatcher* d1,
+ Traversal::NodeDispatcher* d2)
: d1_ (d1), d2_ (d2)
{
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Complex& c)
{
if (d1_)
@@ -518,8 +512,8 @@ namespace XSDFrontend
}
private:
- Traversal::NodeDispatcherBase* d1_;
- Traversal::NodeDispatcherBase* d2_;
+ Traversal::NodeDispatcher* d1_;
+ Traversal::NodeDispatcher* d2_;
} complex_;
@@ -532,7 +526,7 @@ namespace XSDFrontend
//
struct Uses: Traversal::Uses
{
- virtual Void
+ virtual void
traverse (Type& u)
{
SemanticGraph::Schema& s (u.schema ());
@@ -548,7 +542,7 @@ namespace XSDFrontend
namespace Transformations
{
- Void Restriction::
+ void Restriction::
transform (SemanticGraph::Schema& s, SemanticGraph::Path const&)
{
Traversal::Schema schema;
diff --git a/libxsd-frontend/xsd-frontend/transformations/restriction.hxx b/libxsd-frontend/xsd-frontend/transformations/restriction.hxx
index 7c3282e..6d7410c 100644
--- a/libxsd-frontend/xsd-frontend/transformations/restriction.hxx
+++ b/libxsd-frontend/xsd-frontend/transformations/restriction.hxx
@@ -1,12 +1,11 @@
// file : xsd-frontend/transformations/restriction.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRANSFORMATIONS_RESTRICTION_HXX
#define XSD_FRONTEND_TRANSFORMATIONS_RESTRICTION_HXX
-#include <cult/types.hxx>
+#include <xsd-frontend/types.hxx>
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
#include <xsd-frontend/semantic-graph/schema.hxx>
@@ -15,8 +14,6 @@ namespace XSDFrontend
{
namespace Transformations
{
- using namespace Cult::Types;
-
// This transformation performs two major tasks. It transfers omitted
// attribute declarations from the base to derived-by-restriction type
// and establishes correspondence between particles and compositors by
@@ -30,7 +27,7 @@ namespace XSDFrontend
public:
struct Failed {};
- Void
+ void
transform (SemanticGraph::Schema&, SemanticGraph::Path const&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx b/libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx
index 9ac8445..2fc14b5 100644
--- a/libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx
+++ b/libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx
@@ -1,48 +1,42 @@
// file : xsd-frontend/transformations/schema-per-type.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <xsd-frontend/transformations/schema-per-type.hxx>
-
-#include <xsd-frontend/semantic-graph.hxx>
-#include <xsd-frontend/traversal.hxx>
+#include <strings.h> // strcasecmp
-#include <cult/containers/map.hxx>
-#include <cult/containers/set.hxx>
-#include <cult/containers/vector.hxx>
+#include <map>
+#include <set>
+#include <vector>
#include <sstream>
#include <iostream>
-#include <strings.h> // strcasecmp
+#include <xsd-frontend/semantic-graph.hxx>
+#include <xsd-frontend/traversal.hxx>
+
+#include <xsd-frontend/transformations/schema-per-type.hxx>
using std::wcerr;
using std::endl;
namespace XSDFrontend
{
- using namespace Cult;
-
- typedef WideString String;
typedef Transformations::SchemaPerType::Failed Failed;
-
- typedef Containers::Vector<SemanticGraph::Schema*> Schemas;
- typedef Containers::Map<SemanticGraph::Type*,
- SemanticGraph::Schema*> TypeSchemaMap;
+ typedef std::vector<SemanticGraph::Schema*> Schemas;
+ typedef std::map<SemanticGraph::Type*, SemanticGraph::Schema*> TypeSchemaMap;
// Compare file paths case-insensitively.
//
struct FileComparator
{
- Boolean
+ bool
operator() (NarrowString const& x, NarrowString const& y) const
{
return strcasecmp (x.c_str (), y.c_str ()) < 0;
}
};
- typedef Containers::Set<NarrowString, FileComparator> FileSet;
+ typedef std::set<NarrowString, FileComparator> FileSet;
namespace
{
@@ -59,7 +53,7 @@ namespace XSDFrontend
xsd_ = 0;
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Includes& i)
{
SemanticGraph::Schema& s (i.schema ());
@@ -72,7 +66,7 @@ namespace XSDFrontend
}
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Imports& i)
{
SemanticGraph::Schema& s (i.schema ());
@@ -85,7 +79,7 @@ namespace XSDFrontend
}
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Implies& i)
{
if (xsd_ == 0)
@@ -97,12 +91,13 @@ namespace XSDFrontend
SemanticGraph::Schema*& xsd_;
};
- Void
+ void
process_schema (SemanticGraph::Schema& s,
SemanticGraph::Schema& root,
SemanticGraph::Schema& xsd,
TypeSchemaMap& tsm,
FileSet& file_set,
+ bool fat_type_file,
Transformations::SchemaPerTypeTranslator& trans)
{
using namespace SemanticGraph;
@@ -141,7 +136,7 @@ namespace XSDFrontend
//
if (!tn)
{
- for (NarrowString::Iterator i (base.begin ()), e (base.end ());
+ for (NarrowString::iterator i (base.begin ()), e (base.end ());
i != e; ++i)
{
if (*i == '/' || *i == '\\')
@@ -153,7 +148,7 @@ namespace XSDFrontend
//
NarrowString file_name (base);
- for (UnsignedLong i (1);
+ for (unsigned long i (1);
file_set.find (file_name) != file_set.end ();
++i)
{
@@ -167,11 +162,7 @@ namespace XSDFrontend
try
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
path = Path (file_name);
-#else
- path = Path (file_name.c_str());
-#endif
}
catch (InvalidPath const&)
{
@@ -184,7 +175,7 @@ namespace XSDFrontend
throw Failed ();
}
}
- catch (String::NonRepresentable const&)
+ catch (NonRepresentable const&)
{
wcerr << "error: '" << wbase << "' cannot be represented as a "
<< "narrow string" << endl;
@@ -195,6 +186,8 @@ namespace XSDFrontend
throw Failed ();
}
+ Type& t (dynamic_cast<Type&> (n));
+
Schema& ts (root.new_node<Schema> (path, 1, 1));
root.new_edge<Implies> (ts, xsd, xsd_path);
@@ -202,11 +195,43 @@ namespace XSDFrontend
root.new_edge<Names> (ts, tns, ns.name ());
root.new_edge<Names> (tns, n, name);
+ // If we are generating fat type files, then also move the global
+ // elements this type classifies to the new schema.
+ //
+ if (fat_type_file)
+ {
+ for (Type::ClassifiesIterator j (t.classifies_begin ());
+ j != t.classifies_end (); ++j)
+ {
+ Instance& e (j->instance ());
+
+ // We can only move a global element from the same namespace.
+ //
+ if (e.is_a<Element> () &&
+ e.scope ().is_a<Namespace> () &&
+ e.scope ().name () == ns.name ())
+ {
+ Names& n (e.named ());
+ String name (n.name ());
+
+ // Watch out for the iterator validity: the edge we are
+ // about to remove can be from the same list we are
+ // currently iterating.
+ //
+ if (i != ns.names_end () && &*i == &n)
+ ++i;
+
+ root.delete_edge (n.scope (), e, n);
+ root.new_edge<Names> (tns, e, name);
+ }
+ }
+ }
+
// Add include to the original schema and enter into the
// type-schema map.
//
root.new_edge<Includes> (s, ts, path);
- tsm[&dynamic_cast<Type&> (n)] = &ts;
+ tsm[&t] = &ts;
}
else
++i;
@@ -219,7 +244,7 @@ namespace XSDFrontend
{
Type (SemanticGraph::Schema& schema,
SemanticGraph::Schema& root,
- Char const* by_value_key,
+ char const* by_value_key,
TypeSchemaMap& tsm)
: schema_ (schema),
root_ (root),
@@ -229,7 +254,7 @@ namespace XSDFrontend
*this >> names_ >> *this;
}
- virtual Void
+ virtual void
traverse (SemanticGraph::List& l)
{
// Treat item type as base type since it is impossible
@@ -239,7 +264,7 @@ namespace XSDFrontend
set_dep (t, false);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Complex& c)
{
if (c.inherits_p ())
@@ -248,26 +273,26 @@ namespace XSDFrontend
Traversal::Complex::names (c);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Member& m)
{
SemanticGraph::Type& t (m.type ());
- Boolean weak (
+ bool weak (
by_value_key_ == 0 ||
!t.context ().count (by_value_key_) ||
- !t.context ().get<Boolean> (by_value_key_));
+ !t.context ().get<bool> (by_value_key_));
set_dep (t, weak);
}
private:
- Void
- set_dep (SemanticGraph::Type& t, Boolean weak)
+ void
+ set_dep (SemanticGraph::Type& t, bool weak)
{
using namespace SemanticGraph;
- TypeSchemaMap::Iterator i (tsm_.find (&t));
+ TypeSchemaMap::iterator i (tsm_.find (&t));
// If a type is not present in the map then it must be
// a built-in type.
@@ -301,9 +326,9 @@ namespace XSDFrontend
private:
SemanticGraph::Schema& schema_;
SemanticGraph::Schema& root_;
- Char const* by_value_key_;
+ char const* by_value_key_;
TypeSchemaMap& tsm_;
- Containers::Set<SemanticGraph::Type*> type_set_;
+ std::set<SemanticGraph::Type*> type_set_;
Traversal::Names names_;
};
@@ -312,8 +337,10 @@ namespace XSDFrontend
namespace Transformations
{
SchemaPerType::
- SchemaPerType (SchemaPerTypeTranslator& trans, Char const* by_value_key)
- : by_value_key_ (by_value_key), trans_ (trans)
+ SchemaPerType (SchemaPerTypeTranslator& trans,
+ bool fat,
+ char const* key)
+ : fat_type_file_ (fat), by_value_key_ (key), trans_ (trans)
{
}
@@ -344,8 +371,10 @@ namespace XSDFrontend
//
FileSet file_set;
- for (Schemas::Iterator i (schemas.begin ()); i != schemas.end (); ++i)
+ for (Schemas::iterator i (schemas.begin ()); i != schemas.end (); ++i)
{
+ // This path was already normalized by the parser.
+ //
SemanticGraph::Path const& path (
(*i)->context ().get<SemanticGraph::Path> ("absolute-path"));
@@ -353,31 +382,22 @@ namespace XSDFrontend
//
NarrowString abs_path;
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
// Try to use the portable representation of the path. If that
// fails, fall back to the native representation.
//
try
{
- abs_path = path.string ();
+ abs_path = path.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
- abs_path = path.native_file_string ();
+ abs_path = path.string ();
}
-#else
- // The new ABI does not have a fallback native representation
- abs_path = path.string ();
-#endif
NarrowString tf (trans_.translate_schema (abs_path));
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
- NarrowString file (tf ? tf : path.leaf ());
-#else
- NarrowString file (tf ? tf : path.filename ().string());
-#endif
+ NarrowString file (tf ? tf : path.leaf ().string ());
- Size p (file.rfind ('.'));
+ size_t p (file.rfind ('.'));
NarrowString ext (
p != NarrowString::npos ? NarrowString (file, p) : "");
@@ -388,7 +408,7 @@ namespace XSDFrontend
//
NarrowString new_name (base);
- for (UnsignedLong n (1);
+ for (unsigned long n (1);
file_set.find (new_name) != file_set.end ();
++n)
{
@@ -402,11 +422,7 @@ namespace XSDFrontend
try
{
-#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
(*i)->context ().set ("renamed", SemanticGraph::Path (new_name));
-#else
- (*i)->context ().set ("renamed", SemanticGraph::Path (new_name.c_str()));
-#endif
}
catch (SemanticGraph::InvalidPath const&)
{
@@ -424,9 +440,9 @@ namespace XSDFrontend
//
TypeSchemaMap tsm;
- for (Schemas::Iterator i (schemas.begin ()); i != schemas.end (); ++i)
+ for (Schemas::iterator i (schemas.begin ()); i != schemas.end (); ++i)
{
- process_schema (**i, root, *xsd, tsm, file_set, trans_);
+ process_schema (**i, root, *xsd, tsm, file_set, fat_type_file_, trans_);
}
// wcerr << tsm.size () << " type schema nodes" << endl;
@@ -434,7 +450,7 @@ namespace XSDFrontend
// Establish include/import dependencies. While at it add the
// new schemas to the list which we will return.
//
- for (TypeSchemaMap::Iterator i (tsm.begin ()); i != tsm.end (); ++i)
+ for (TypeSchemaMap::iterator i (tsm.begin ()); i != tsm.end (); ++i)
{
SemanticGraph::Schema& s (*i->second);
Type t (s, root, by_value_key_, tsm);
diff --git a/libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx b/libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx
index 89b6d83..8b6a69e 100644
--- a/libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx
+++ b/libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx
@@ -1,13 +1,13 @@
// file : xsd-frontend/transformations/schema-per-type.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRANSFORMATIONS_SCHEMA_PER_TYPE_HXX
#define XSD_FRONTEND_TRANSFORMATIONS_SCHEMA_PER_TYPE_HXX
-#include <cult/types.hxx>
-#include <cult/containers/vector.hxx>
+#include <vector>
+
+#include <xsd-frontend/types.hxx>
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
#include <xsd-frontend/semantic-graph/schema.hxx>
@@ -16,8 +16,6 @@ namespace XSDFrontend
{
namespace Transformations
{
- using namespace Cult::Types;
-
class SchemaPerTypeTranslator
{
public:
@@ -27,8 +25,8 @@ namespace XSDFrontend
// The following two functions should return empty string if
// there is no match.
//
- virtual WideString
- translate_type (WideString const& ns, WideString const& name) = 0;
+ virtual String
+ translate_type (String const& ns, String const& name) = 0;
virtual NarrowString
translate_schema (NarrowString const& abs_path) = 0;
@@ -46,13 +44,16 @@ namespace XSDFrontend
// with the by_value_key key and it is true, then the schema
// for this type is included "strongly".
//
- SchemaPerType (SchemaPerTypeTranslator&, Char const* by_value_key = 0);
+ SchemaPerType (SchemaPerTypeTranslator&,
+ bool fat_type_file,
+ char const* by_value_key = 0);
- Cult::Containers::Vector<SemanticGraph::Schema*>
+ std::vector<SemanticGraph::Schema*>
transform (SemanticGraph::Schema&);
private:
- Char const* by_value_key_;
+ bool fat_type_file_;
+ char const* by_value_key_;
SchemaPerTypeTranslator& trans_;
};
}
diff --git a/libxsd-frontend/xsd-frontend/transformations/simplifier.cxx b/libxsd-frontend/xsd-frontend/transformations/simplifier.cxx
index 2ccaed2..9372a4a 100644
--- a/libxsd-frontend/xsd-frontend/transformations/simplifier.cxx
+++ b/libxsd-frontend/xsd-frontend/transformations/simplifier.cxx
@@ -1,19 +1,14 @@
// file : xsd-frontend/transformations/simplifier.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <xsd-frontend/transformations/simplifier.hxx>
-
#include <xsd-frontend/semantic-graph.hxx>
#include <xsd-frontend/traversal.hxx>
-#include <cult/containers/vector.hxx>
+#include <xsd-frontend/transformations/simplifier.hxx>
namespace XSDFrontend
{
- using namespace Cult;
-
namespace
{
struct Compositor: Traversal::All,
@@ -25,7 +20,7 @@ namespace XSDFrontend
{
}
- virtual Void
+ virtual void
traverse (SemanticGraph::All& a)
{
// The all compositor cannot contain compositors.
@@ -34,7 +29,7 @@ namespace XSDFrontend
remove (a);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Choice& c)
{
// Do the depth-first traversal so that we take into account
@@ -54,7 +49,7 @@ namespace XSDFrontend
remove (c);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Sequence& s)
{
// Do the depth-first traversal so that we take into account
@@ -73,7 +68,7 @@ namespace XSDFrontend
}
private:
- virtual Void
+ virtual void
remove (SemanticGraph::Compositor& c)
{
using SemanticGraph::Node;
@@ -106,7 +101,7 @@ namespace XSDFrontend
//
struct Type: Traversal::Complex
{
- virtual Void
+ virtual void
traverse (SemanticGraph::Complex& c)
{
if (c.contains_compositor_p ())
@@ -119,7 +114,7 @@ namespace XSDFrontend
//
struct Uses: Traversal::Uses
{
- virtual Void
+ virtual void
traverse (Type& u)
{
SemanticGraph::Schema& s (u.schema ());
@@ -135,7 +130,7 @@ namespace XSDFrontend
namespace Transformations
{
- Void Simplifier::
+ void Simplifier::
transform (SemanticGraph::Schema& s, SemanticGraph::Path const&)
{
Traversal::Schema schema;
diff --git a/libxsd-frontend/xsd-frontend/transformations/simplifier.hxx b/libxsd-frontend/xsd-frontend/transformations/simplifier.hxx
index 676c166..674ee45 100644
--- a/libxsd-frontend/xsd-frontend/transformations/simplifier.hxx
+++ b/libxsd-frontend/xsd-frontend/transformations/simplifier.hxx
@@ -1,12 +1,11 @@
// file : xsd-frontend/transformations/simplifier.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRANSFORMATIONS_SIMPLIFIER_HXX
#define XSD_FRONTEND_TRANSFORMATIONS_SIMPLIFIER_HXX
-#include <cult/types.hxx>
+#include <xsd-frontend/types.hxx>
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
#include <xsd-frontend/semantic-graph/schema.hxx>
@@ -15,8 +14,6 @@ namespace XSDFrontend
{
namespace Transformations
{
- using namespace Cult::Types;
-
// This transformation performs various schema simplifications
// (e.g., removing empty compositors, etc). This transformation
// assumes that there are no anonymous types.
@@ -24,7 +21,7 @@ namespace XSDFrontend
class Simplifier
{
public:
- Void
+ void
transform (SemanticGraph::Schema&, SemanticGraph::Path const&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal.hxx b/libxsd-frontend/xsd-frontend/traversal.hxx
index 9b1c359..10190a1 100644
--- a/libxsd-frontend/xsd-frontend/traversal.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_HXX
diff --git a/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx b/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx
index 55ed999..50655dd 100644
--- a/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/any-attribute.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// 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
diff --git a/libxsd-frontend/xsd-frontend/traversal/any.hxx b/libxsd-frontend/xsd-frontend/traversal/any.hxx
index 505d336..85a320d 100644
--- a/libxsd-frontend/xsd-frontend/traversal/any.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/any.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/any.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef 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
index e5c2237..a40afd7 100644
--- a/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/attribute-group.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// 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>
@@ -9,7 +8,7 @@ namespace XSDFrontend
{
namespace Traversal
{
- Void AttributeGroup::
+ void AttributeGroup::
traverse (Type& g)
{
pre (g);
@@ -17,12 +16,12 @@ namespace XSDFrontend
post (g);
}
- Void AttributeGroup::
+ void AttributeGroup::
pre (Type&)
{
}
- Void AttributeGroup::
+ void AttributeGroup::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx b/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx
index cd01a97..03fee14 100644
--- a/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/attribute-group.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// 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
@@ -15,13 +14,13 @@ namespace XSDFrontend
{
struct AttributeGroup: ScopeTemplate<SemanticGraph::AttributeGroup>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute.cxx b/libxsd-frontend/xsd-frontend/traversal/attribute.cxx
index c051667..e61eeb2 100644
--- a/libxsd-frontend/xsd-frontend/traversal/attribute.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/attribute.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/attribute.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/attribute.hxx>
@@ -9,7 +8,7 @@ namespace XSDFrontend
{
namespace Traversal
{
- Void Attribute::
+ void Attribute::
traverse (Type& a)
{
pre (a);
@@ -18,29 +17,29 @@ namespace XSDFrontend
post (a);
}
- Void Attribute::
+ void Attribute::
pre (Type&)
{
}
- Void Attribute::
- belongs (Type& a, EdgeDispatcherBase& d)
+ void Attribute::
+ belongs (Type& a, EdgeDispatcher& d)
{
d.dispatch (a.belongs ());
}
- Void Attribute::
+ void Attribute::
belongs (Type& a)
{
belongs (a, *this);
}
- Void Attribute::
+ void Attribute::
name (Type&)
{
}
- Void Attribute::
+ void Attribute::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute.hxx b/libxsd-frontend/xsd-frontend/traversal/attribute.hxx
index feb6b31..f3962e4 100644
--- a/libxsd-frontend/xsd-frontend/traversal/attribute.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/attribute.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/attribute.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_HXX
@@ -17,22 +16,22 @@ namespace XSDFrontend
{
struct Attribute : Node<SemanticGraph::Attribute>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ virtual void
+ belongs (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
belongs (Type&);
- virtual Void
+ virtual void
name (Type&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/complex.cxx b/libxsd-frontend/xsd-frontend/traversal/complex.cxx
index d6cfc41..6e936ab 100644
--- a/libxsd-frontend/xsd-frontend/traversal/complex.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/complex.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/complex.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/complex.hxx>
@@ -9,7 +8,7 @@ namespace XSDFrontend
{
namespace Traversal
{
- Void Complex::
+ void Complex::
traverse (Type& c)
{
pre (c);
@@ -20,43 +19,43 @@ namespace XSDFrontend
post (c);
}
- Void Complex::
+ void Complex::
pre (Type&)
{
}
- Void Complex::
+ void Complex::
name (Type&)
{
}
- Void Complex::
+ void Complex::
inherits (Type& c)
{
inherits (c, *this);
}
- Void Complex::
- inherits (Type& c, EdgeDispatcherBase& d)
+ void Complex::
+ inherits (Type& c, EdgeDispatcher& d)
{
if (c.inherits_p ())
d.dispatch (c.inherits ());
}
- Void Complex::
+ void Complex::
contains_compositor (Type& c)
{
contains_compositor (c, *this);
}
- Void Complex::
- contains_compositor (Type& c, EdgeDispatcherBase& d)
+ void Complex::
+ contains_compositor (Type& c, EdgeDispatcher& d)
{
if (c.contains_compositor_p ())
d.dispatch (c.contains_compositor ());
}
- Void Complex::
+ void Complex::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/complex.hxx b/libxsd-frontend/xsd-frontend/traversal/complex.hxx
index 3dd7e7b..1f55730 100644
--- a/libxsd-frontend/xsd-frontend/traversal/complex.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/complex.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/complex.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_COMPLEX_HXX
@@ -15,28 +14,28 @@ namespace XSDFrontend
{
struct Complex : ScopeTemplate<SemanticGraph::Complex>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
name (Type&);
- virtual Void
+ virtual void
inherits (Type&);
- Void
- inherits (Type&, EdgeDispatcherBase&);
+ void
+ inherits (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
contains_compositor (Type&);
- Void
- contains_compositor (Type&, EdgeDispatcherBase&);
+ void
+ contains_compositor (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/compositors.cxx b/libxsd-frontend/xsd-frontend/traversal/compositors.cxx
index d3089fc..f2b3dcd 100644
--- a/libxsd-frontend/xsd-frontend/traversal/compositors.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/compositors.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/compositors.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/compositors.hxx>
@@ -11,7 +10,7 @@ namespace XSDFrontend
{
// ContainsParticle
//
- Void ContainsParticle::
+ void ContainsParticle::
traverse (Type& c)
{
dispatch (c.particle ());
@@ -20,7 +19,7 @@ namespace XSDFrontend
// ContainsCompositor
//
- Void ContainsCompositor::
+ void ContainsCompositor::
traverse (Type& c)
{
dispatch (c.compositor ());
@@ -29,7 +28,7 @@ namespace XSDFrontend
// Compositor
//
- Void Compositor::
+ void Compositor::
traverse (Type& c)
{
pre (c);
@@ -37,25 +36,25 @@ namespace XSDFrontend
post (c);
}
- Void Compositor::
+ void Compositor::
pre (Type&)
{
}
- Void Compositor::
+ void Compositor::
contains (Type& c)
{
iterate_and_dispatch (
c.contains_begin (), c.contains_end (), edge_traverser ());
}
- Void Compositor::
- contains (Type& c, EdgeDispatcherBase& d)
+ void Compositor::
+ contains (Type& c, EdgeDispatcher& d)
{
iterate_and_dispatch (c.contains_begin (), c.contains_end (), d);
}
- Void Compositor::
+ void Compositor::
post (Type&)
{
}
@@ -63,7 +62,7 @@ namespace XSDFrontend
// All
//
- Void All::
+ void All::
traverse (Type& c)
{
pre (c);
@@ -71,25 +70,25 @@ namespace XSDFrontend
post (c);
}
- Void All::
+ void All::
pre (Type&)
{
}
- Void All::
+ void All::
contains (Type& c)
{
iterate_and_dispatch (
c.contains_begin (), c.contains_end (), edge_traverser ());
}
- Void All::
- contains (Type& c, EdgeDispatcherBase& d)
+ void All::
+ contains (Type& c, EdgeDispatcher& d)
{
iterate_and_dispatch (c.contains_begin (), c.contains_end (), d);
}
- Void All::
+ void All::
post (Type&)
{
}
@@ -97,7 +96,7 @@ namespace XSDFrontend
// Choice
//
- Void Choice::
+ void Choice::
traverse (Type& c)
{
pre (c);
@@ -105,25 +104,25 @@ namespace XSDFrontend
post (c);
}
- Void Choice::
+ void Choice::
pre (Type&)
{
}
- Void Choice::
+ void Choice::
contains (Type& c)
{
iterate_and_dispatch (
c.contains_begin (), c.contains_end (), edge_traverser ());
}
- Void Choice::
- contains (Type& c, EdgeDispatcherBase& d)
+ void Choice::
+ contains (Type& c, EdgeDispatcher& d)
{
iterate_and_dispatch (c.contains_begin (), c.contains_end (), d);
}
- Void Choice::
+ void Choice::
post (Type&)
{
}
@@ -131,7 +130,7 @@ namespace XSDFrontend
// Sequence
//
- Void Sequence::
+ void Sequence::
traverse (Type& c)
{
pre (c);
@@ -139,25 +138,25 @@ namespace XSDFrontend
post (c);
}
- Void Sequence::
+ void Sequence::
pre (Type&)
{
}
- Void Sequence::
+ void Sequence::
contains (Type& c)
{
iterate_and_dispatch (
c.contains_begin (), c.contains_end (), edge_traverser ());
}
- Void Sequence::
- contains (Type& c, EdgeDispatcherBase& d)
+ void Sequence::
+ contains (Type& c, EdgeDispatcher& d)
{
iterate_and_dispatch (c.contains_begin (), c.contains_end (), d);
}
- Void Sequence::
+ void Sequence::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/compositors.hxx b/libxsd-frontend/xsd-frontend/traversal/compositors.hxx
index e81460b..4761b99 100644
--- a/libxsd-frontend/xsd-frontend/traversal/compositors.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/compositors.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/compositors.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_COMPOSITORS_HXX
@@ -26,7 +25,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type&);
};
@@ -44,7 +43,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type&);
};
@@ -52,19 +51,19 @@ namespace XSDFrontend
//
struct Compositor : Node<SemanticGraph::Compositor>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
contains (Type&);
- virtual Void
- contains (Type&, EdgeDispatcherBase&);
+ virtual void
+ contains (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
post (Type&);
};
@@ -73,19 +72,19 @@ namespace XSDFrontend
//
struct All : Node<SemanticGraph::All>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
contains (Type&);
- virtual Void
- contains (Type&, EdgeDispatcherBase&);
+ virtual void
+ contains (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
post (Type&);
};
@@ -94,19 +93,19 @@ namespace XSDFrontend
//
struct Choice : Node<SemanticGraph::Choice>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
contains (Type&);
- virtual Void
- contains (Type&, EdgeDispatcherBase&);
+ virtual void
+ contains (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
post (Type&);
};
@@ -115,19 +114,19 @@ namespace XSDFrontend
//
struct Sequence : Node<SemanticGraph::Sequence>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
contains (Type&);
- virtual Void
- contains (Type&, EdgeDispatcherBase&);
+ virtual void
+ contains (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/element-group.cxx b/libxsd-frontend/xsd-frontend/traversal/element-group.cxx
index cb7a51a..0b253dd 100644
--- a/libxsd-frontend/xsd-frontend/traversal/element-group.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/element-group.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/element-group.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// 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>
@@ -9,7 +8,7 @@ namespace XSDFrontend
{
namespace Traversal
{
- Void ElementGroup::
+ void ElementGroup::
traverse (Type& g)
{
pre (g);
@@ -18,24 +17,24 @@ namespace XSDFrontend
post (g);
}
- Void ElementGroup::
+ void ElementGroup::
pre (Type&)
{
}
- Void ElementGroup::
- contains_compositor (Type& g, EdgeDispatcherBase& d)
+ void ElementGroup::
+ contains_compositor (Type& g, EdgeDispatcher& d)
{
d.dispatch (g.contains_compositor ());
}
- Void ElementGroup::
+ void ElementGroup::
contains_compositor (Type& g)
{
contains_compositor (g, *this);
}
- Void ElementGroup::
+ void ElementGroup::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/element-group.hxx b/libxsd-frontend/xsd-frontend/traversal/element-group.hxx
index 8ebe0bd..df13b26 100644
--- a/libxsd-frontend/xsd-frontend/traversal/element-group.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/element-group.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/element-group.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// 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
@@ -15,19 +14,19 @@ namespace XSDFrontend
{
struct ElementGroup: ScopeTemplate<SemanticGraph::ElementGroup>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
contains_compositor (Type&);
- virtual Void
- contains_compositor (Type&, EdgeDispatcherBase&);
+ virtual void
+ contains_compositor (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/element.cxx b/libxsd-frontend/xsd-frontend/traversal/element.cxx
index 7f296ee..efdb0a6 100644
--- a/libxsd-frontend/xsd-frontend/traversal/element.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/element.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/element.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/element.hxx>
@@ -9,7 +8,7 @@ namespace XSDFrontend
{
namespace Traversal
{
- Void Element::
+ void Element::
traverse (Type& m)
{
pre (m);
@@ -18,29 +17,29 @@ namespace XSDFrontend
post (m);
}
- Void Element::
+ void Element::
pre (Type&)
{
}
- Void Element::
- belongs (Type& m, EdgeDispatcherBase& d)
+ void Element::
+ belongs (Type& m, EdgeDispatcher& d)
{
d.dispatch (m.belongs ());
}
- Void Element::
+ void Element::
belongs (Type& m)
{
belongs (m, edge_traverser ());
}
- Void Element::
+ void Element::
name (Type&)
{
}
- Void Element::
+ void Element::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/element.hxx b/libxsd-frontend/xsd-frontend/traversal/element.hxx
index d5187ad..e1af29a 100644
--- a/libxsd-frontend/xsd-frontend/traversal/element.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/element.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/element.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_ELEMENT_HXX
@@ -15,22 +14,22 @@ namespace XSDFrontend
{
struct Element : Node<SemanticGraph::Element>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ virtual void
+ belongs (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
belongs (Type&);
- virtual Void
+ virtual void
name (Type&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.cxx b/libxsd-frontend/xsd-frontend/traversal/elements.cxx
index b1c47a0..e64e3b9 100644
--- a/libxsd-frontend/xsd-frontend/traversal/elements.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/elements.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/elements.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/elements.hxx>
@@ -11,7 +10,7 @@ namespace XSDFrontend
{
// Instance
//
- Void Instance::
+ void Instance::
traverse (Type& a)
{
pre (a);
@@ -19,24 +18,24 @@ namespace XSDFrontend
post (a);
}
- Void Instance::
+ void Instance::
pre (Type&)
{
}
- Void Instance::
- belongs (Type& a, EdgeDispatcherBase& d)
+ void Instance::
+ belongs (Type& a, EdgeDispatcher& d)
{
d.dispatch (a.belongs ());
}
- Void Instance::
+ void Instance::
belongs (Type& a)
{
belongs (a, edge_traverser ());
}
- Void Instance::
+ void Instance::
post (Type&)
{
}
@@ -44,7 +43,7 @@ namespace XSDFrontend
// Member
//
- Void Member::
+ void Member::
traverse (Type& a)
{
pre (a);
@@ -52,24 +51,24 @@ namespace XSDFrontend
post (a);
}
- Void Member::
+ void Member::
pre (Type&)
{
}
- Void Member::
- belongs (Type& a, EdgeDispatcherBase& d)
+ void Member::
+ belongs (Type& a, EdgeDispatcher& d)
{
d.dispatch (a.belongs ());
}
- Void Member::
+ void Member::
belongs (Type& a)
{
belongs (a, edge_traverser ());
}
- Void Member::
+ void Member::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.hxx b/libxsd-frontend/xsd-frontend/traversal/elements.hxx
index c405a1b..bd1dd70 100644
--- a/libxsd-frontend/xsd-frontend/traversal/elements.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/elements.hxx
@@ -1,165 +1,97 @@
// file : xsd-frontend/traversal/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// 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 <cult/types.hxx>
-
-#include <frontend-elements/traversal.hxx>
+#include <cutl/compiler/traversal.hxx>
+#include <xsd-frontend/types.hxx>
#include <xsd-frontend/semantic-graph/elements.hxx>
namespace XSDFrontend
{
namespace Traversal
{
- using namespace Cult::Types;
-
- namespace Bits
- {
- using FrontendElements::Traversal::TraverserBase;
- using FrontendElements::Traversal::Traverser;
-
- using FrontendElements::Traversal::DispatcherBase;
- using FrontendElements::Traversal::Dispatcher;
-
- }
-
- typedef Bits::DispatcherBase<SemanticGraph::Node> NodeDispatcherBase;
- typedef Bits::DispatcherBase<SemanticGraph::Edge> EdgeDispatcherBase;
+ using namespace cutl;
+ typedef compiler::dispatcher<SemanticGraph::Node> NodeDispatcher;
+ typedef compiler::dispatcher<SemanticGraph::Edge> EdgeDispatcher;
//
//
- struct NodeBase : virtual Bits::Dispatcher<SemanticGraph::Node>,
- virtual Bits::Dispatcher<SemanticGraph::Edge>
+ struct NodeBase: NodeDispatcher, EdgeDispatcher
{
- Void
- edge_traverser (EdgeDispatcherBase& d)
+ void
+ edge_traverser (EdgeDispatcher& d)
{
- Bits::Dispatcher<SemanticGraph::Edge>::traverser (d);
+ EdgeDispatcher::traverser (d);
}
- EdgeDispatcherBase&
+ EdgeDispatcher&
edge_traverser ()
{
return *this;
}
- public:
- using Bits::Dispatcher<SemanticGraph::Node>::dispatch;
- using Bits::Dispatcher<SemanticGraph::Edge>::dispatch;
-
- using Bits::Dispatcher<SemanticGraph::Node>::map;
-
- using Bits::Dispatcher<SemanticGraph::Edge>::iterate_and_dispatch;
- };
-
-
- //
- //
- template <typename T>
- struct Node : Bits::TraverserBase<SemanticGraph::Node>, virtual NodeBase
- {
- typedef
- T
- Type;
-
- Node ()
- {
- map (typeid (Type), *this);
- }
-
- virtual Void
- traverse (Type&) = 0;
+ using NodeDispatcher::dispatch;
+ using EdgeDispatcher::dispatch;
- virtual Void
- trampoline (SemanticGraph::Node& i)
- {
- traverse (dynamic_cast<Type&> (i));
- }
-
- virtual Void
- trampoline (SemanticGraph::Node const&)
- {
- abort ();
- }
+ using EdgeDispatcher::iterate_and_dispatch;
};
-
- //
- //
- struct EdgeBase : virtual Bits::Dispatcher<SemanticGraph::Edge>,
- virtual Bits::Dispatcher<SemanticGraph::Node>
+ struct EdgeBase: EdgeDispatcher, NodeDispatcher
{
- Void
- node_traverser (NodeDispatcherBase& d)
+ void
+ node_traverser (NodeDispatcher& d)
{
- Bits::Dispatcher<SemanticGraph::Node>::traverser (d);
+ NodeDispatcher::traverser (d);
}
- NodeDispatcherBase&
+ NodeDispatcher&
node_traverser ()
{
return *this;
}
- public:
- using Bits::Dispatcher<SemanticGraph::Edge>::dispatch;
- using Bits::Dispatcher<SemanticGraph::Node>::dispatch;
+ using EdgeDispatcher::dispatch;
+ using NodeDispatcher::dispatch;
- using Bits::Dispatcher<SemanticGraph::Edge>::map;
-
- using Bits::Dispatcher<SemanticGraph::Node>::iterate_and_dispatch;
- };
-
- template <typename T>
- struct Edge : Bits::TraverserBase<SemanticGraph::Edge>, virtual EdgeBase
- {
- typedef
- T
- Type;
-
- Edge ()
- {
- map (typeid (Type), *this);
- }
-
- virtual Void
- traverse (Type&) = 0;
-
- virtual Void
- trampoline (SemanticGraph::Edge& i)
- {
- traverse (dynamic_cast<Type&> (i));
- }
-
- virtual Void
- trampoline (SemanticGraph::Edge const&)
- {
- abort ();
- }
+ using NodeDispatcher::iterate_and_dispatch;
};
- inline
- EdgeBase&
+ inline EdgeBase&
operator>> (NodeBase& n, EdgeBase& e)
{
n.edge_traverser (e);
return e;
}
- inline
- NodeBase&
+ 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
//
@@ -176,7 +108,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.named ());
@@ -197,18 +129,17 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.type ());
}
};
-
+ //
// Nodes
//
-
//
//
struct Nameable : Node<SemanticGraph::Nameable>
@@ -222,20 +153,20 @@ namespace XSDFrontend
struct ScopeTemplate : Node<T>
{
public:
- virtual Void
+ virtual void
traverse (T& s)
{
names (s);
}
template<typename X>
- Void
+ void
names (T& s,
- EdgeDispatcherBase& 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))
+ 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));
@@ -266,13 +197,13 @@ namespace XSDFrontend
}
}
- virtual Void
- names (T& s, EdgeDispatcherBase& d)
+ virtual void
+ names (T& s, EdgeDispatcher& d)
{
names<ScopeTemplate<T> > (s, d);
}
- virtual Void
+ virtual void
names (T& s)
{
names (s,
@@ -283,22 +214,22 @@ namespace XSDFrontend
&ScopeTemplate<T>::names_next);
}
- virtual Void
+ virtual void
names_pre (T&)
{
}
- virtual Void
+ virtual void
names_next (T&)
{
}
- virtual Void
+ virtual void
names_post (T&)
{
}
- virtual Void
+ virtual void
names_none (T&)
{
}
@@ -316,7 +247,7 @@ namespace XSDFrontend
//
struct Type : Node<SemanticGraph::Type>
{
- virtual Void
+ virtual void
traverse (SemanticGraph::Type&) = 0;
};
@@ -325,19 +256,19 @@ namespace XSDFrontend
//
struct Instance : Node<SemanticGraph::Instance>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ virtual void
+ belongs (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
belongs (Type&);
- virtual Void
+ virtual void
post (Type&);
};
@@ -346,19 +277,19 @@ namespace XSDFrontend
//
struct Member : Node<SemanticGraph::Member>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ virtual void
+ belongs (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
belongs (Type&);
- virtual Void
+ virtual void
post (Type&);
};
@@ -376,7 +307,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.base ());
@@ -397,7 +328,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.base ());
@@ -418,7 +349,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.base ());
@@ -439,7 +370,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& a)
{
dispatch (a.type ());
@@ -452,7 +383,7 @@ namespace XSDFrontend
//
struct Contains : Edge<SemanticGraph::Contains>
{
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.element ());
diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.txx b/libxsd-frontend/xsd-frontend/traversal/elements.txx
index b673a8d..5b1aec0 100644
--- a/libxsd-frontend/xsd-frontend/traversal/elements.txx
+++ b/libxsd-frontend/xsd-frontend/traversal/elements.txx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/elements.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace XSDFrontend
diff --git a/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx b/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx
index a8a49a5..124606f 100644
--- a/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/enumeration.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/enumeration.hxx>
@@ -11,7 +10,7 @@ namespace XSDFrontend
{
// Enumeration
//
- Void Enumeration::
+ void Enumeration::
traverse (Type& e)
{
pre (e);
@@ -21,30 +20,30 @@ namespace XSDFrontend
post (e);
}
- Void Enumeration::
+ void Enumeration::
pre (Type&)
{
}
- Void Enumeration::
+ void Enumeration::
name (Type&)
{
}
- Void Enumeration::
+ void Enumeration::
inherits (Type& e)
{
inherits (e, *this);
}
- Void Enumeration::
- inherits (Type& e, EdgeDispatcherBase& d)
+ void Enumeration::
+ inherits (Type& e, EdgeDispatcher& d)
{
if (e.inherits_p ())
d.dispatch (e.inherits ());
}
- Void Enumeration::
+ void Enumeration::
post (Type&)
{
}
@@ -52,7 +51,7 @@ namespace XSDFrontend
// Enumerator
//
- Void Enumerator::
+ void Enumerator::
traverse (Type& e)
{
pre (e);
@@ -61,29 +60,29 @@ namespace XSDFrontend
post (e);
}
- Void Enumerator::
+ void Enumerator::
pre (Type&)
{
}
- Void Enumerator::
- belongs (Type& e, EdgeDispatcherBase& d)
+ void Enumerator::
+ belongs (Type& e, EdgeDispatcher& d)
{
d.dispatch (e.belongs ());
}
- Void Enumerator::
+ void Enumerator::
belongs (Type& e)
{
belongs (e, edge_traverser ());
}
- Void Enumerator::
+ void Enumerator::
name (Type&)
{
}
- Void Enumerator::
+ void Enumerator::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx b/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx
index c6d7f04..960b11c 100644
--- a/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/enumeration.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_ENUMERATION_HXX
@@ -15,43 +14,43 @@ namespace XSDFrontend
{
struct Enumeration : ScopeTemplate<SemanticGraph::Enumeration>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
name (Type&);
- virtual Void
+ virtual void
inherits (Type&);
- Void
- inherits (Type&, EdgeDispatcherBase&);
+ void
+ inherits (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
post (Type&);
};
struct Enumerator : Node<SemanticGraph::Enumerator>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ virtual void
+ belongs (Type&, EdgeDispatcher&);
- virtual Void
+ virtual void
belongs (Type&);
- virtual Void
+ virtual void
name (Type&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx b/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx
index b9cadec..5202adf 100644
--- a/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/fundamental.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/fundamental.hxx>
diff --git a/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx b/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx
index 5c20d9c..0b771cd 100644
--- a/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/fundamental.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_FUNDAMENTAL_HXX
diff --git a/libxsd-frontend/xsd-frontend/traversal/list.cxx b/libxsd-frontend/xsd-frontend/traversal/list.cxx
index ec434ba..9241af1 100644
--- a/libxsd-frontend/xsd-frontend/traversal/list.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/list.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/list.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/list.hxx>
@@ -9,7 +8,7 @@ namespace XSDFrontend
{
namespace Traversal
{
- Void List::
+ void List::
traverse (Type& l)
{
pre (l);
@@ -18,29 +17,29 @@ namespace XSDFrontend
post (l);
}
- Void List::
+ void List::
pre (Type&)
{
}
- Void List::
+ void List::
argumented (Type& l)
{
argumented (l, *this);
}
- Void List::
- argumented (Type& l, EdgeDispatcherBase& d)
+ void List::
+ argumented (Type& l, EdgeDispatcher& d)
{
d.dispatch (l.argumented ());
}
- Void List::
+ void List::
name (Type&)
{
}
- Void List::
+ void List::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/list.hxx b/libxsd-frontend/xsd-frontend/traversal/list.hxx
index 2bbc136..06aa154 100644
--- a/libxsd-frontend/xsd-frontend/traversal/list.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/list.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/list.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_LIST_HXX
@@ -15,22 +14,22 @@ namespace XSDFrontend
{
struct List: Node<SemanticGraph::List>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
argumented (Type&);
- virtual Void
- argumented (Type&, EdgeDispatcherBase& d);
+ virtual void
+ argumented (Type&, EdgeDispatcher& d);
- virtual Void
+ virtual void
name (Type&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/namespace.cxx b/libxsd-frontend/xsd-frontend/traversal/namespace.cxx
index cbc6ef2..fbf1105 100644
--- a/libxsd-frontend/xsd-frontend/traversal/namespace.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/namespace.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/namespace.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/namespace.hxx>
diff --git a/libxsd-frontend/xsd-frontend/traversal/namespace.hxx b/libxsd-frontend/xsd-frontend/traversal/namespace.hxx
index 22305e1..0dd0901 100644
--- a/libxsd-frontend/xsd-frontend/traversal/namespace.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/namespace.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/namespace.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_NAMESPACE_HXX
@@ -15,7 +14,7 @@ namespace XSDFrontend
{
struct Namespace: ScopeTemplate<SemanticGraph::Namespace>
{
- virtual Void
+ virtual void
traverse (Type& m)
{
pre (m);
@@ -24,17 +23,17 @@ namespace XSDFrontend
post (m);
}
- virtual Void
+ virtual void
pre (Type&)
{
}
- virtual Void
+ virtual void
name (Type&)
{
}
- virtual Void
+ virtual void
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/particle.cxx b/libxsd-frontend/xsd-frontend/traversal/particle.cxx
index e3d3a97..1dd0ce0 100644
--- a/libxsd-frontend/xsd-frontend/traversal/particle.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/particle.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/particle.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/particle.hxx>
@@ -11,19 +10,19 @@ namespace XSDFrontend
{
// Particle
//
- Void Particle::
+ void Particle::
traverse (Type& c)
{
pre (c);
post (c);
}
- Void Particle::
+ void Particle::
pre (Type&)
{
}
- Void Particle::
+ void Particle::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/particle.hxx b/libxsd-frontend/xsd-frontend/traversal/particle.hxx
index 3584c12..5346ae9 100644
--- a/libxsd-frontend/xsd-frontend/traversal/particle.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/particle.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/particle.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_PARTICLE_HXX
@@ -15,13 +14,13 @@ namespace XSDFrontend
{
struct Particle : Node<SemanticGraph::Particle>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/schema.cxx b/libxsd-frontend/xsd-frontend/traversal/schema.cxx
index acfca26..090e964 100644
--- a/libxsd-frontend/xsd-frontend/traversal/schema.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/schema.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/schema.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/schema.hxx>
diff --git a/libxsd-frontend/xsd-frontend/traversal/schema.hxx b/libxsd-frontend/xsd-frontend/traversal/schema.hxx
index a975475..a38ddfd 100644
--- a/libxsd-frontend/xsd-frontend/traversal/schema.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/schema.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/schema.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_SCHEMA_HXX
@@ -26,7 +25,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.schema ());
@@ -46,7 +45,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.schema ());
@@ -67,7 +66,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.schema ());
@@ -88,7 +87,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.schema ());
@@ -109,7 +108,7 @@ namespace XSDFrontend
node_traverser (n);
}
- virtual Void
+ virtual void
traverse (Type& e)
{
dispatch (e.schema ());
@@ -121,7 +120,7 @@ namespace XSDFrontend
//
struct Schema: ScopeTemplate<SemanticGraph::Schema>
{
- virtual Void
+ virtual void
traverse (Type& s)
{
pre (s);
@@ -134,12 +133,12 @@ namespace XSDFrontend
post (s);
}
- virtual Void
+ virtual void
pre (Type&)
{
}
- virtual Void
+ virtual void
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/union.cxx b/libxsd-frontend/xsd-frontend/traversal/union.cxx
index acf419a..fe8f7d0 100644
--- a/libxsd-frontend/xsd-frontend/traversal/union.cxx
+++ b/libxsd-frontend/xsd-frontend/traversal/union.cxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/union.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd-frontend/traversal/union.hxx>
@@ -9,7 +8,7 @@ namespace XSDFrontend
{
namespace Traversal
{
- Void Union::
+ void Union::
traverse (Type& u)
{
pre (u);
@@ -18,29 +17,29 @@ namespace XSDFrontend
post (u);
}
- Void Union::
+ void Union::
pre (Type&)
{
}
- Void Union::
+ void Union::
argumented (Type& u)
{
argumented (u, *this);
}
- Void Union::
- argumented (Type& u, EdgeDispatcherBase& d)
+ void Union::
+ argumented (Type& u, EdgeDispatcher& d)
{
iterate_and_dispatch (u.argumented_begin (), u.argumented_end (), d);
}
- Void Union::
+ void Union::
name (Type&)
{
}
- Void Union::
+ void Union::
post (Type&)
{
}
diff --git a/libxsd-frontend/xsd-frontend/traversal/union.hxx b/libxsd-frontend/xsd-frontend/traversal/union.hxx
index e3d31bd..8012036 100644
--- a/libxsd-frontend/xsd-frontend/traversal/union.hxx
+++ b/libxsd-frontend/xsd-frontend/traversal/union.hxx
@@ -1,6 +1,5 @@
// file : xsd-frontend/traversal/union.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TRAVERSAL_UNION_HXX
@@ -15,22 +14,22 @@ namespace XSDFrontend
{
struct Union: Node<SemanticGraph::Union>
{
- virtual Void
+ virtual void
traverse (Type&);
- virtual Void
+ virtual void
pre (Type&);
- virtual Void
+ virtual void
argumented (Type&);
- virtual Void
- argumented (Type&, EdgeDispatcherBase& d);
+ virtual void
+ argumented (Type&, EdgeDispatcher& d);
- virtual Void
+ virtual void
name (Type&);
- virtual Void
+ virtual void
post (Type&);
};
}
diff --git a/libxsd-frontend/xsd-frontend/types.cxx b/libxsd-frontend/xsd-frontend/types.cxx
new file mode 100644
index 0000000..49faf92
--- /dev/null
+++ b/libxsd-frontend/xsd-frontend/types.cxx
@@ -0,0 +1,61 @@
+// file : xsd-frontend/types.cxx
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include <cstdlib> // std::mbstowcs
+
+#include <xsd-frontend/types.hxx>
+
+namespace XSDFrontend
+{
+ // NonRepresentable
+ //
+ char const* NonRepresentable::
+ what () const throw ()
+ {
+ return "character is not representable in the narrower encoding";
+ }
+
+ // StringTemplate
+ //
+
+ // Specialization for char to wchar_t conversion.
+ //
+ template <>
+ void StringTemplate<wchar_t, char>::
+ from_narrow (char const* s)
+ {
+ size_type size (std::mbstowcs (0, s, 0) + 1);
+
+ // I dare to change the guts!
+ //
+ resize (size - 1);
+
+ wchar_t* p (const_cast<wchar_t*> (data ()));
+
+ std::mbstowcs (p, s, size);
+ }
+
+ // Specialization for wchar_t to char conversion.
+ //
+ template <>
+ StringTemplate<char> StringTemplate<wchar_t, char>::
+ to_narrow () const
+ {
+ size_type size (std::wcstombs (0, c_str (), 0));
+
+ if (size == size_type (-1))
+ throw NonRepresentable ();
+
+ // I dare to change the guts!
+ //
+ StringTemplate<char> r;
+ r.resize (size);
+
+ char* p (const_cast<char*> (r.data ()));
+
+ std::wcstombs (p, c_str (), size + 1);
+
+ return r;
+ }
+}
diff --git a/libxsd-frontend/xsd-frontend/types.hxx b/libxsd-frontend/xsd-frontend/types.hxx
index b3059fd..0cd1ad1 100644
--- a/libxsd-frontend/xsd-frontend/types.hxx
+++ b/libxsd-frontend/xsd-frontend/types.hxx
@@ -1,18 +1,250 @@
// file : xsd-frontend/types.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_TYPES_HXX
#define XSD_FRONTEND_TYPES_HXX
-#include <cult/types.hxx>
+#include <string>
+#include <cstddef> // std::size_t
namespace XSDFrontend
{
- using namespace Cult::Types;
+ using std::size_t;
- typedef Cult::WideString String;
+ namespace Bits
+ {
+ struct None {};
+
+ template <typename C>
+ struct NarrowerChar
+ {
+ typedef None Type;
+ };
+
+ template <>
+ struct NarrowerChar<wchar_t>
+ {
+ typedef char Type;
+ };
+ }
+
+ struct NonRepresentable: std::exception
+ {
+ virtual char const*
+ what () const throw ();
+ };
+
+ template <typename C, typename NC = typename Bits::NarrowerChar<C>::Type>
+ class StringTemplate;
+
+ template <>
+ class StringTemplate<Bits::None, Bits::None>
+ {
+ };
+
+ template <typename C, typename NC>
+ class StringTemplate : public std::basic_string<C>
+ {
+ typedef std::basic_string<C> Base;
+ typedef std::basic_string<NC> NarrowerBase;
+
+ Base&
+ base ()
+ {
+ return *this;
+ }
+
+ Base const&
+ base () const
+ {
+ return *this;
+ }
+
+ public:
+ typedef typename Base::size_type size_type;
+
+ using Base::npos;
+
+ public:
+ StringTemplate ()
+ {
+ }
+
+ StringTemplate (StringTemplate const& str,
+ size_type pos,
+ size_type n = npos)
+ : Base (str, pos, n)
+ {
+ }
+
+ StringTemplate (C const* s, size_type n)
+ : Base (s, n)
+ {
+ }
+
+ StringTemplate (C const* s)
+ : Base (s)
+ {
+ }
+
+ StringTemplate (size_type n, C c)
+ : Base (n, c)
+ {
+ }
+
+ template <typename I>
+ StringTemplate(I begin, I end)
+ : Base (begin, end)
+ {
+ }
+
+ StringTemplate (StringTemplate const& other)
+ : Base (other)
+ {
+ }
+
+ // Conversion from Base.
+ //
+ StringTemplate (Base const& str)
+ : Base (str)
+ {
+ }
+
+ // Conversion from the Narrower type. Experimental.
+ //
+ StringTemplate (NC const* s)
+ {
+ from_narrow (s);
+ }
+
+ StringTemplate (StringTemplate<NC> const& other)
+ {
+ from_narrow (other.c_str ());
+ }
+
+ StringTemplate (NarrowerBase const& other)
+ {
+ from_narrow (other.c_str ());
+ }
+
+ // Assignment.
+ //
+ StringTemplate&
+ operator= (StringTemplate const& str)
+ {
+ base () = str;
+ return *this;
+ }
+
+ StringTemplate&
+ operator= (C const* s)
+ {
+ base () = s;
+ return *this;
+ }
+
+ StringTemplate&
+ operator= (C c)
+ {
+ base () = c;
+ return *this;
+ }
+
+ // Assignment from Base.
+ //
+ StringTemplate&
+ operator= (Base const& str)
+ {
+ base () = str;
+ return *this;
+ }
+
+ public:
+ StringTemplate&
+ operator+= (StringTemplate const& str)
+ {
+ base () += str;
+ return *this;
+ }
+
+ StringTemplate&
+ operator+= (C const* s)
+ {
+ base () += s;
+ return *this;
+ }
+
+ StringTemplate&
+ operator+= (C c)
+ {
+ base () += c;
+ return *this;
+ }
+
+ // Conversion to the Narrower type.
+ //
+ public:
+ StringTemplate<NC>
+ to_narrow () const;
+
+ // Conversion to bool.
+ //
+ private:
+ typedef void (StringTemplate::*BooleanConvertible)();
+ void true_ () {}
+
+ public:
+ operator BooleanConvertible () const
+ {
+ return this->empty () ? 0 : &StringTemplate::true_;
+ }
+
+ private:
+ void
+ from_narrow (NC const* s);
+ };
+
+
+ template<typename C>
+ StringTemplate<C>
+ operator+ (StringTemplate<C> const& lhs, StringTemplate<C> const& rhs)
+ {
+ return StringTemplate<C> (lhs) += rhs;
+ }
+
+ template<typename C>
+ StringTemplate<C>
+ operator+ (C const* lhs, StringTemplate<C> const& rhs)
+ {
+ return StringTemplate<C> (lhs) += rhs;
+ }
+
+ template<typename C>
+ StringTemplate<C>
+ operator+ (StringTemplate<C> const& lhs, C const* rhs)
+ {
+ return StringTemplate<C> (lhs) += rhs;
+ }
+
+ template<typename C>
+ StringTemplate<C>
+ operator+ (C lhs, StringTemplate<C> const& rhs)
+ {
+ return StringTemplate<C> (1, lhs) += rhs;
+ }
+
+ template<typename C>
+ StringTemplate<C>
+ operator+ (StringTemplate<C> const& lhs, C rhs)
+ {
+ return StringTemplate<C> (lhs) += rhs;
+ }
+
+ typedef StringTemplate<char> NarrowString;
+ typedef StringTemplate<wchar_t> WideString;
+
+ typedef WideString String;
}
#endif // XSD_FRONTEND_TYPES_HXX
diff --git a/libxsd-frontend/xsd-frontend/version.hxx b/libxsd-frontend/xsd-frontend/version.hxx
new file mode 100644
index 0000000..fa6d1de
--- /dev/null
+++ b/libxsd-frontend/xsd-frontend/version.hxx
@@ -0,0 +1,14 @@
+// file : xsd-frontend/version.hxx
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef XSD_FRONTEND_VERSION_HXX
+#define XSD_FRONTEND_VERSION_HXX
+
+#include <xercesc/util/XercesVersion.hpp>
+
+#if _XERCES_VERSION < 30000
+# error Xerces-C++ 2-series is not supported
+#endif
+
+#endif // XSD_FRONTEND_VERSION_HXX
diff --git a/libxsd-frontend/xsd-frontend/xml.hxx b/libxsd-frontend/xsd-frontend/xml.hxx
index 8c9b01c..d33f6bf 100644
--- a/libxsd-frontend/xsd-frontend/xml.hxx
+++ b/libxsd-frontend/xsd-frontend/xml.hxx
@@ -1,18 +1,17 @@
// file : xsd-frontend/xml.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_FRONTEND_XML_HXX
#define XSD_FRONTEND_XML_HXX
+#include <vector>
#include <ostream>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/XMLString.hpp>
-#include <cult/containers/vector.hxx>
-
+#include <xsd-frontend/version.hxx> // Check Xerces-C++ version.
#include <xsd-frontend/types.hxx>
#include <xsd-frontend/schema-dom-parser.hxx>
@@ -24,9 +23,9 @@ namespace XSDFrontend
inline
String
- transcode (XMLCh const* s, Size length)
+ transcode (XMLCh const* s, size_t length)
{
- if (sizeof (WideChar) == 4)
+ if (sizeof (wchar_t) == 4)
{
// UTF-32
//
@@ -34,8 +33,8 @@ namespace XSDFrontend
// Find what the resulting buffer size will be.
//
- Size rl (0);
- Boolean valid (true);
+ size_t rl (0);
+ bool valid (true);
for (XMLCh const* p (s); p < end; ++p)
{
@@ -60,27 +59,27 @@ namespace XSDFrontend
String r;
r.reserve (rl + 1);
r.resize (rl);
- WideChar* rs (const_cast<WideChar*> (r.c_str ()));
+ wchar_t* rs (const_cast<wchar_t*> (r.c_str ()));
- Size i (0);
+ size_t i (0);
for (XMLCh const* p (s); p < end; ++p)
{
XMLCh x (*p);
if (x < 0xD800 || x > 0xDBFF)
- rs[i++] = WideChar (x);
+ rs[i++] = wchar_t (x);
else
rs[i++] = ((x - 0xD800) << 10) + (*++p - 0xDC00) + 0x10000;
}
return r;
}
- else if (sizeof (WideChar) == 2)
+ else if (sizeof (wchar_t) == 2)
{
// UTF-16
//
- return String (reinterpret_cast<const WideChar*> (s), length);
+ return String (reinterpret_cast<const wchar_t*> (s), length);
}
else
return String ();
@@ -97,7 +96,7 @@ namespace XSDFrontend
NarrowString
transcode_to_narrow (XMLCh const* xs)
{
- Char* s (Xerces::XMLString::transcode (xs));
+ char* s (Xerces::XMLString::transcode (xs));
NarrowString r (s);
Xerces::XMLString::release (&s);
return r;
@@ -107,16 +106,16 @@ namespace XSDFrontend
XMLCh*
transcode (String const& str)
{
- Size l (str.size ());
- WideChar const* s (str.c_str ());
+ size_t l (str.size ());
+ wchar_t const* s (str.c_str ());
- if (sizeof (WideChar) == 4)
+ if (sizeof (wchar_t) == 4)
{
// Find what the resulting buffer size will be.
//
- Size rl (0);
+ size_t rl (0);
- for (WideChar const* p (s); p < s + l; ++p)
+ for (wchar_t const* p (s); p < s + l; ++p)
{
rl += (*p & 0xFFFF0000) ? 2 : 1;
}
@@ -124,9 +123,9 @@ namespace XSDFrontend
XMLCh* r (new XMLCh[rl + 1]);
XMLCh* ir (r);
- for (WideChar const* p (s); p < s + l; ++p)
+ for (wchar_t const* p (s); p < s + l; ++p)
{
- WideChar w (*p);
+ wchar_t w (*p);
if (w & 0xFFFF0000)
{
@@ -143,12 +142,12 @@ namespace XSDFrontend
return r;
}
- else if (sizeof (WideChar) == 2)
+ else if (sizeof (wchar_t) == 2)
{
XMLCh* r (new XMLCh[l + 1]);
XMLCh* ir (r);
- for (Size i (0); i < l; ++ir, ++i)
+ for (size_t i (0); i < l; ++ir, ++i)
*ir = static_cast<XMLCh> (s[i]);
*ir = XMLCh (0);
@@ -167,7 +166,7 @@ namespace XSDFrontend
{
}
- XMLChString (WideChar const* s)
+ XMLChString (wchar_t const* s)
: s_ (transcode (String (s)))
{
}
@@ -217,20 +216,20 @@ namespace XSDFrontend
}
public:
- UnsignedLong
+ unsigned long
line () const
{
//@@ cache
//
- return reinterpret_cast<UnsignedLong> (e_->getUserData (line_key));
+ return reinterpret_cast<unsigned long> (e_->getUserData (line_key));
}
- UnsignedLong
+ unsigned long
column () const
{
//@@ cache
//
- return reinterpret_cast<UnsignedLong> (e_->getUserData (column_key));
+ return reinterpret_cast<unsigned long> (e_->getUserData (column_key));
}
public:
@@ -243,7 +242,7 @@ namespace XSDFrontend
public:
// Attribute identified by a name.
//
- Boolean
+ bool
attribute_p (String const& name) const
{
return attribute_p ("", name);
@@ -264,7 +263,7 @@ namespace XSDFrontend
// Attribute identified by namespace and name.
//
- Boolean
+ bool
attribute_p (String const& namespace_, String const& name) const
{
Xerces::DOMAttr* a (
@@ -303,7 +302,7 @@ namespace XSDFrontend
inline String
prefix (String const& n)
{
- Size i (0);
+ size_t i (0);
while (i < n.length () && n[i] != L':') ++i;
//std::wcerr << "prefix " << n << " "
@@ -315,7 +314,7 @@ namespace XSDFrontend
inline String
uq_name (String const& n)
{
- Size i (0);
+ size_t i (0);
while (i < n.length () && n[i] != L':') ++i;
return String (n.c_str () + (i == n.length () ? 0 : i + 1));
@@ -367,18 +366,11 @@ namespace XSDFrontend
ns_prefix (Element const& e, String const& wns)
{
XMLChString ns (wns);
-
-#if _XERCES_VERSION >= 30000
- XMLCh const* p (
- e.dom_element ()->lookupPrefix (ns.c_str ()));
-#else
- XMLCh const* p (
- e.dom_element ()->lookupNamespacePrefix (ns.c_str (), false));
-#endif
+ XMLCh const* p (e.dom_element ()->lookupPrefix (ns.c_str ()));
if (p == 0)
{
- Boolean r (e.dom_element ()->isDefaultNamespace (ns.c_str ()));
+ bool r (e.dom_element ()->isDefaultNamespace (ns.c_str ()));
if (r)
return L"";
@@ -518,9 +510,9 @@ namespace XSDFrontend
// Conversion to bool.
//
- typedef X* (AutoPtr::*BooleanConvertible)() const;
+ typedef X* (AutoPtr::*boolConvertible)() const;
- operator BooleanConvertible () const throw ()
+ operator boolConvertible () const throw ()
{
return x_ ? &AutoPtr<X>::operator-> : 0;
}
@@ -530,13 +522,13 @@ namespace XSDFrontend
};
template <typename X>
- struct PtrVector: Cult::Containers::Vector<X*>
+ struct PtrVector: std::vector<X*>
{
- typedef Cult::Containers::Vector<X*> Base;
+ typedef std::vector<X*> Base;
~PtrVector ()
{
- for (typename Base::Iterator i (this->begin ()), e (this->end ());
+ for (typename Base::iterator i (this->begin ()), e (this->end ());
i != e; ++i)
{
if (*i)
@@ -544,7 +536,7 @@ namespace XSDFrontend
}
}
- Void
+ void
push_back (AutoPtr<X>& x)
{
Base::push_back (0);