diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
commit | 8286ac511144e4f17d34eac9affb97e50646344a (patch) | |
tree | f1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /xsd/xsd/cxx/parser/state-processor.cxx | |
parent | a15cf65c44d5c224169c32ef5495b68c758134b7 (diff) |
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'xsd/xsd/cxx/parser/state-processor.cxx')
-rw-r--r-- | xsd/xsd/cxx/parser/state-processor.cxx | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/xsd/xsd/cxx/parser/state-processor.cxx b/xsd/xsd/cxx/parser/state-processor.cxx index 7fe3ff6..86f97ce 100644 --- a/xsd/xsd/cxx/parser/state-processor.cxx +++ b/xsd/xsd/cxx/parser/state-processor.cxx @@ -1,8 +1,10 @@ // file : xsd/cxx/parser/state-processor.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 <vector> +#include <iostream> + #include <cxx/parser/state-processor.hxx> #include <cxx/parser/elements.hxx> @@ -10,9 +12,7 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/vector.hxx> - -#include <iostream> +using namespace std; namespace CXX { @@ -20,8 +20,9 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector<SemanticGraph::Particle*> Particles; + typedef vector<SemanticGraph::Particle*> Particles; + /* void print (Particles const& p) { @@ -30,7 +31,7 @@ namespace CXX wcerr << "prefixes: " << endl; - for (Particles::ConstIterator i (p.begin ()); i != p.end (); ++i) + for (Particles::const_iterator i (p.begin ()); i != p.end (); ++i) { if (SemanticGraph::Element* e = dynamic_cast<SemanticGraph::Element*> (*i)) @@ -45,6 +46,7 @@ namespace CXX wcerr << endl; } + */ // // @@ -52,10 +54,10 @@ namespace CXX Traversal::Choice, Traversal::Sequence { - Particle (UnsignedLong& all, - UnsignedLong& choice, - UnsignedLong& sequence, - UnsignedLong& depth) + Particle (size_t& all, + size_t& choice, + size_t& sequence, + size_t& depth) : all_ (all), choice_ (choice), sequence_ (sequence), @@ -63,7 +65,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Compositor; @@ -78,8 +80,8 @@ namespace CXX // compositor cannot contain any nested compositors. // - UnsignedLong state (0); - UnsignedLong min (0); + size_t state (0); + size_t min (0); for (Compositor::ContainsIterator ci (a.contains_begin ()); ci != a.contains_end (); ++ci) @@ -101,7 +103,7 @@ namespace CXX { a.context ().set ("comp-number", choice_++); a.context ().set ("prefixes", prefixes_); - a.context ().set ("state-count", UnsignedLong (prefixes_.size ())); + a.context ().set ("state-count", size_t (prefixes_.size ())); // effective-min = min * actual-min // @@ -114,7 +116,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -126,8 +128,8 @@ namespace CXX // the actual value specified in the schema. // - UnsignedLong state (0); - UnsignedLong min (1); + size_t state (0); + size_t min (1); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -144,7 +146,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -159,7 +161,7 @@ namespace CXX t.prefixes_.end ().base ()); if (min == 1 && - p.context ().get<UnsignedLong> ("effective-min") == 0) + p.context ().get<size_t> ("effective-min") == 0) min = 0; } @@ -183,7 +185,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -195,9 +197,9 @@ namespace CXX // of the actual value specified in the schema. // - Boolean prefix (true); - UnsignedLong state (0); - UnsignedLong min (0); + bool prefix (true); + size_t state (0); + size_t min (0); for (Compositor::ContainsIterator ci (s.contains_begin ()); ci != s.contains_end (); ++ci) @@ -217,7 +219,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -233,7 +235,7 @@ namespace CXX t.prefixes_.begin ().base (), t.prefixes_.end ().base ()); - if (p.context ().get<UnsignedLong> ("effective-min") != 0) + if (p.context ().get<size_t> ("effective-min") != 0) min = 1; } } @@ -266,11 +268,11 @@ namespace CXX private: Particles prefixes_; - UnsignedLong& all_; - UnsignedLong& choice_; - UnsignedLong& sequence_; + size_t& all_; + size_t& choice_; + size_t& sequence_; - UnsignedLong& depth_; + size_t& depth_; }; @@ -278,12 +280,12 @@ namespace CXX // struct Complex: Traversal::Complex { - virtual Void + virtual void traverse (Type& c) { if (c.contains_compositor_p ()) { - UnsignedLong all (0), choice (0), sequence (0), depth (0); + size_t all (0), choice (0), sequence (0), depth (0); Particle t (all, choice, sequence, depth); t.dispatch (c.contains_compositor ().compositor ()); @@ -296,11 +298,11 @@ namespace CXX }; } - Void StateProcessor:: + void StateProcessor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { Traversal::Schema schema; - Traversal::Sources sources; + Sources sources; Traversal::Names schema_names; Traversal::Namespace ns; Traversal::Names ns_names; |