From 54110801525371740298d5cae378bfc778749935 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Jun 2012 11:50:03 +0200 Subject: Get rid of dependency on libcult --- xsd/cxx/parser/state-processor.cxx | 63 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'xsd/cxx/parser/state-processor.cxx') diff --git a/xsd/cxx/parser/state-processor.cxx b/xsd/cxx/parser/state-processor.cxx index 568154d..8664886 100644 --- a/xsd/cxx/parser/state-processor.cxx +++ b/xsd/cxx/parser/state-processor.cxx @@ -3,6 +3,9 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include + #include #include @@ -10,9 +13,7 @@ #include #include -#include - -#include +using namespace std; namespace CXX { @@ -20,7 +21,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector Particles; + typedef vector 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 (*i)) @@ -52,10 +53,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 +64,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Compositor; @@ -78,8 +79,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 +102,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 +115,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -126,8 +127,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 +145,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -159,7 +160,7 @@ namespace CXX t.prefixes_.end ().base ()); if (min == 1 && - p.context ().get ("effective-min") == 0) + p.context ().get ("effective-min") == 0) min = 0; } @@ -183,7 +184,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -195,9 +196,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 +218,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -233,7 +234,7 @@ namespace CXX t.prefixes_.begin ().base (), t.prefixes_.end ().base ()); - if (p.context ().get ("effective-min") != 0) + if (p.context ().get ("effective-min") != 0) min = 1; } } @@ -266,11 +267,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 +279,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,7 +297,7 @@ namespace CXX }; } - Void StateProcessor:: + void StateProcessor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { Traversal::Schema schema; -- cgit v1.1