diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-06-22 11:50:03 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-06-22 11:50:03 +0200 |
commit | 54110801525371740298d5cae378bfc778749935 (patch) | |
tree | f0f125135b2a1bcf1eea49a559b49d00ea25d879 /xsd/processing/inheritance/processor.cxx | |
parent | 3f4a7a6b2a3b708ea69b980494f6e49eb0c02ebc (diff) |
Get rid of dependency on libcult
Diffstat (limited to 'xsd/processing/inheritance/processor.cxx')
-rw-r--r-- | xsd/processing/inheritance/processor.cxx | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/xsd/processing/inheritance/processor.cxx b/xsd/processing/inheritance/processor.cxx index 7d103db..1e46282 100644 --- a/xsd/processing/inheritance/processor.cxx +++ b/xsd/processing/inheritance/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 <set> +#include <iostream> + #include <processing/inheritance/processor.hxx> #include <elements.hxx> @@ -10,21 +13,13 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> - -#include <iostream> -using std::wcerr; -using std::endl; +using namespace std; namespace Processing { - using namespace Cult; - namespace SemanticGraph = XSDFrontend::SemanticGraph; namespace Traversal = XSDFrontend::Traversal; - typedef WideString String; - namespace Inheritance { namespace @@ -43,15 +38,14 @@ namespace Processing String member_xpath; }; - inline Boolean + inline bool operator< (Dep const& a, Dep const& b) { return &a.type < &b.type; } - typedef Containers::Set<Dep> DepSet; - typedef Containers::Set<SemanticGraph::Type*> TypeSet; - + typedef set<Dep> DepSet; + typedef set<SemanticGraph::Type*> TypeSet; String xpath (SemanticGraph::Nameable& n) @@ -88,7 +82,7 @@ namespace Processing *this >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -103,7 +97,7 @@ namespace Processing names (c); } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -158,14 +152,14 @@ namespace Processing } 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_); @@ -185,26 +179,26 @@ namespace Processing { Global (SemanticGraph::Schema& root, SemanticGraph::Schema& schema, - Boolean& failed) + bool& failed) : root_ (root), schema_ (schema), failed_ (failed) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) types_seen_.insert (&t); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { check_dep (c, c); types_seen_.insert (&c); }; - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Type& t (e.type ()); @@ -218,7 +212,7 @@ namespace Processing }; private: - Void + void check_dep (SemanticGraph::Nameable& global, SemanticGraph::Type& type) { @@ -236,7 +230,7 @@ namespace Processing complex.dispatch (type); } - for (DepSet::ConstIterator i (prereqs.begin ()); + for (DepSet::const_iterator i (prereqs.begin ()); i != prereqs.end (); ++i) { Dep const& dep (*i); @@ -364,7 +358,7 @@ namespace Processing private: // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -387,7 +381,7 @@ namespace Processing SemanticGraph::Schema& root_; SemanticGraph::Schema& schema_; TypeSet types_seen_; - Boolean& failed_; + bool& failed_; }; @@ -403,7 +397,7 @@ namespace Processing } private: - Cult::Containers::Set<SemanticGraph::Schema*> schemas_; + set<SemanticGraph::Schema*> schemas_; }; // Go into included/imported schemas while making sure we don't @@ -411,25 +405,25 @@ namespace Processing // struct Uses: Traversal::Includes, Traversal::Imports { - Uses (SemanticGraph::Schema& root, Boolean& failed) + Uses (SemanticGraph::Schema& root, bool& failed) : root_ (root), failed_ (failed) { } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { traverse (i.schema ()); } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { traverse (i.schema ()); } private: - Void + void traverse (SemanticGraph::Schema& s) { if (!s.context ().count ("processing-inheritance-seen")) @@ -457,14 +451,14 @@ namespace Processing private: SemanticGraph::Schema& root_; - Boolean& failed_; + bool& failed_; }; } - Void Processor:: + void Processor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { - Boolean failed (false); + bool failed (false); // We need to process include/imported schemas since other // parts of the process, for example, name processors can |