diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-06-22 15:07:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-06-22 15:07:35 +0200 |
commit | 973221821ac8e20da4eadbf4ad552f686b1ace48 (patch) | |
tree | 861059c9606d07487f08413b35172fe2b5fa3733 /xsde/cxx/parser | |
parent | b2efa0d81f7e28017789082138cb547e6bea4028 (diff) |
Get rid of dependency on libcult
Diffstat (limited to 'xsde/cxx/parser')
34 files changed, 748 insertions, 776 deletions
diff --git a/xsde/cxx/parser/attribute-validation-source.cxx b/xsde/cxx/parser/attribute-validation-source.cxx index c82e8f0..97fc536 100644 --- a/xsde/cxx/parser/attribute-validation-source.cxx +++ b/xsde/cxx/parser/attribute-validation-source.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (a.name ()); @@ -39,7 +39,7 @@ namespace CXX os << "n == " << L << strlit (name) << " && ns.empty ()"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& ns (a.definition_namespace ().name ()); @@ -93,7 +93,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -173,7 +173,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "if ("; @@ -201,7 +201,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -219,7 +219,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -254,16 +254,16 @@ namespace CXX names_attribute_state_check_ >> attribute_state_check_; } - virtual Void + virtual void traverse (Type& c) { - Boolean has_att (has<Traversal::Attribute> (c)); - Boolean has_any (has<Traversal::AnyAttribute> (c)); + bool has_att (has<Traversal::Attribute> (c)); + bool has_any (has<Traversal::AnyAttribute> (c)); if (!has_att && !has_any) return; - Boolean has_req_att (false); + bool has_req_att (false); if (has_att) { RequiredAttributeTest test (has_req_att); @@ -444,7 +444,7 @@ namespace CXX }; } - Void + void generate_attribute_validation_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/attribute-validation-source.hxx b/xsde/cxx/parser/attribute-validation-source.hxx index fd79ef7..6e6663d 100644 --- a/xsde/cxx/parser/attribute-validation-source.hxx +++ b/xsde/cxx/parser/attribute-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_attribute_validation_source (Context&); } } diff --git a/xsde/cxx/parser/characters-validation-source.cxx b/xsde/cxx/parser/characters-validation-source.cxx index f17b135..b93e280 100644 --- a/xsde/cxx/parser/characters-validation-source.cxx +++ b/xsde/cxx/parser/characters-validation-source.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { if (!c.mixed_p ()) @@ -46,7 +46,7 @@ namespace CXX }; } - Void + void generate_characters_validation_source (Context& ctx) { //@@ Most of the time there is no mixed content type so diff --git a/xsde/cxx/parser/characters-validation-source.hxx b/xsde/cxx/parser/characters-validation-source.hxx index b302a16..e1692ec 100644 --- a/xsde/cxx/parser/characters-validation-source.hxx +++ b/xsde/cxx/parser/characters-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_characters_validation_source (Context&); } } diff --git a/xsde/cxx/parser/driver-source.cxx b/xsde/cxx/parser/driver-source.cxx index 2e8db21..f46bbe3 100644 --- a/xsde/cxx/parser/driver-source.cxx +++ b/xsde/cxx/parser/driver-source.cxx @@ -3,16 +3,17 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> +#include <map> +#include <sstream> + #include <cxx/parser/driver-source.hxx> #include <cxx/parser/print-impl-common.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/map.hxx> -#include <cult/containers/set.hxx> - -#include <sstream> +using namespace std; namespace CXX { @@ -20,11 +21,8 @@ namespace CXX { namespace { - typedef - Cult::Containers::Map<SemanticGraph::Type*, String> - TypeInstanceMap; - - typedef Cult::Containers::Set<String> InstanceSet; + typedef map<SemanticGraph::Type*, String> TypeInstanceMap; + typedef set<String> InstanceSet; // For base types we only want member's types, but not the // base itself. @@ -38,7 +36,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -50,7 +48,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -145,7 +143,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -157,7 +155,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -171,7 +169,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -193,13 +191,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { fund_type (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { fund_type (t, "any_simple_type"); @@ -207,7 +205,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -215,79 +213,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { fund_type (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { fund_type (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { fund_type (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { fund_type (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { fund_type (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { fund_type (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { fund_type (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { fund_type (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { fund_type (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { fund_type (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { fund_type (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { fund_type (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { fund_type (t, "negative_integer"); @@ -295,19 +293,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { fund_type (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { fund_type (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { fund_type (t, "decimal"); @@ -315,49 +313,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { fund_type (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { fund_type (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { fund_type (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { fund_type (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { fund_type (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { fund_type (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { fund_type (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { fund_type (t, "language"); @@ -366,7 +364,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -375,19 +373,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { fund_type (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { fund_type (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { fund_type (t, "idrefs"); @@ -395,7 +393,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -403,13 +401,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { fund_type (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { fund_type (t, "hex_binary"); @@ -418,55 +416,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { fund_type (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { fund_type (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { fund_type (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { fund_type (t, "day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { fund_type (t, "month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { fund_type (t, "month_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { fund_type (t, "year"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { fund_type (t, "year_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { fund_type (t, "time"); @@ -474,20 +472,20 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { fund_type (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { fund_type (t, "entities"); } private: - virtual Void + virtual void fund_type (SemanticGraph::Type& t, String const& name) { if (map_.find (&t) == map_.end ()) @@ -505,7 +503,7 @@ namespace CXX String base_name (escape (raw_name + L"_p")); String name (base_name); - for (UnsignedLong i (1); set_.find (name) != set_.end (); ++i) + for (size_t i (1); set_.find (name) != set_.end (); ++i) { std::wostringstream os; os << i; @@ -543,12 +541,12 @@ namespace CXX // struct ParticleArg: Traversal::Element, Context { - ParticleArg (Context& c, TypeInstanceMap& map, Boolean& first) + ParticleArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (map), first_ (first) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!first_) @@ -561,17 +559,17 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct AttributeArg: Traversal::Attribute, Context { - AttributeArg (Context& c, TypeInstanceMap& map, Boolean& first) + AttributeArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (map), first_ (first) { } - virtual Void + virtual void traverse (Type& a) { if (!first_) @@ -584,7 +582,7 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct ArgList : Traversal::Complex, @@ -608,7 +606,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -620,7 +618,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!first_) @@ -644,7 +642,7 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; + bool first_; }; struct ParserConnect: Traversal::List, @@ -674,7 +672,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (type_set_.find (&l) == type_set_.end ()) @@ -687,7 +685,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (type_set_.find (&c) == type_set_.end ()) @@ -716,7 +714,7 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -739,7 +737,7 @@ namespace CXX private: TypeInstanceMap& map_; - Cult::Containers::Set<SemanticGraph::Type*> type_set_; + set<SemanticGraph::Type*> type_set_; BaseType base_; Traversal::Inherits inherits_; @@ -762,7 +760,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options.root_element_first ()) @@ -784,7 +782,7 @@ namespace CXX }; } - Void + void generate_driver_source (Context& ctx) { // Figure out the root element. Validator should have made sure diff --git a/xsde/cxx/parser/driver-source.hxx b/xsde/cxx/parser/driver-source.hxx index d8b1e28..e19b2da 100644 --- a/xsde/cxx/parser/driver-source.hxx +++ b/xsde/cxx/parser/driver-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_driver_source (Context&); } } diff --git a/xsde/cxx/parser/element-validation-source.cxx b/xsde/cxx/parser/element-validation-source.cxx index e1216f7..a766a59 100644 --- a/xsde/cxx/parser/element-validation-source.cxx +++ b/xsde/cxx/parser/element-validation-source.cxx @@ -3,12 +3,14 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <vector> + #include <cxx/parser/element-validation-source.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/vector.hxx> +using namespace std; namespace CXX { @@ -16,7 +18,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector<SemanticGraph::Particle*> Particles; + typedef vector<SemanticGraph::Particle*> Particles; // Find particle that can be absent. // @@ -27,7 +29,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Choice; @@ -49,12 +51,12 @@ namespace CXX Traversal::Element, Traversal::Any { - IsOptional (Boolean& r) + IsOptional (bool& r) : r_ (r) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!r_ && c.min () == 0) @@ -73,7 +75,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!r_ && s.min () == 0) @@ -88,7 +90,7 @@ namespace CXX !r_ && i != s.contains_end (); ++i) { - Boolean r (false); + bool r (false); IsOptional test (r); test.dispatch (i->particle ()); if (!r) @@ -98,14 +100,14 @@ namespace CXX r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!r_ && e.min () == 0) r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (!r_ && a.min () == 0) @@ -113,21 +115,21 @@ namespace CXX } private: - Boolean& r_; + bool& r_; }; private: - Boolean optional_; + bool optional_; IsOptional is_optional_; SemanticGraph::Particle*& result_; }; // // - Void + void sequence_next_call (SemanticGraph::Sequence* s, Context* ctx); - Void + void choice_arm_call (SemanticGraph::Particle* p, SemanticGraph::Choice* c, Context* ctx) @@ -158,7 +160,7 @@ namespace CXX } } - Void + void sequence_next_call (SemanticGraph::Sequence* s, Context* ctx) { using SemanticGraph::Choice; @@ -207,11 +209,11 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (e.name ()); - Boolean subst (poly_code && e.global_p ()); + bool subst (poly_code && e.global_p ()); if (subst) os << "("; @@ -247,7 +249,7 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (a.definition_namespace ().name ()); @@ -294,7 +296,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // This compositor should already have been tested for @@ -302,9 +304,9 @@ namespace CXX // Particles const& p (c.context ().get<Particles> ("p:prefixes")); - Boolean paren (p.size () != 1); + bool paren (p.size () != 1); - for (Particles::ConstIterator i (p.begin ()), e (p.end ()); + for (Particles::const_iterator i (p.begin ()), e (p.end ()); i != e;) { if (paren) @@ -335,7 +337,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String ns (e.qualified_p () ? e.namespace_ ().name () : String ()); @@ -343,7 +345,7 @@ namespace CXX os << L << strlit (ns) << ", " << L << strlit (e.name ()); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (*a.namespace_begin ()); @@ -351,7 +353,7 @@ namespace CXX os << L << strlit (ns) << ", " << L << "\"*\""; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { Particles const& p (c.context ().get<Particles> ("p:prefixes")); @@ -374,7 +376,7 @@ namespace CXX // Generate sub-parser setup code as well as the pre/post calls. // - Void + void pre_post_calls (SemanticGraph::Particle& p) { using SemanticGraph::Element; @@ -383,7 +385,7 @@ namespace CXX if (Element* e = dynamic_cast<Element*> (&p)) { SemanticGraph::Type& type (e->type ()); - Boolean poly (poly_code && !anonymous (type)); + bool poly (poly_code && !anonymous (type)); String const& name (ename (*e)); String fq_type (fq_name (type)); @@ -522,10 +524,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong state (e.context ().get<UnsignedLong> ("p:state")); + size_t state (e.context ().get<size_t> ("p:state")); SemanticGraph::Compositor& c ( e.contained_particle ().compositor ()); @@ -549,16 +551,15 @@ namespace CXX // Make the call to _present if we haven't seen any // elements yet. // - UnsignedLong state_count ( - c.context().get<UnsignedLong> ("p:state-count")); + size_t state_count (c.context().get<size_t> ("p:state-count")); if (state_count > 1) { os << "if ("; - Boolean sub (false); + bool sub (false); - for (UnsignedLong i (0); i < state_count; ++i) + for (size_t i (0); i < state_count; ++i) { if (i == state) continue; @@ -609,14 +610,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Particle& p) { using SemanticGraph::Element; - UnsignedLong state (p.context ().get<UnsignedLong> ("p:state")); + size_t state (p.context ().get<size_t> ("p:state")); - UnsignedLong min (p.min ()), max (p.max ()); + size_t min (p.min ()), max (p.max ()); os << "case " << state << "UL:" << endl << "{"; @@ -695,20 +696,20 @@ namespace CXX << "}"; // case } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a<Choice> ()); + bool choice (c.is_a<Choice> ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get<UnsignedLong> ("p:effective-min")); - UnsignedLong n (cc.get<UnsignedLong> ("p:comp-number")); - UnsignedLong state (cc.get<UnsignedLong> ("p:state")); + size_t max (c.max ()); + size_t min (cc.get<size_t> ("p:effective-min")); + size_t n (cc.get<size_t> ("p:comp-number")); + size_t state (cc.get<size_t> ("p:state")); String func (choice ? "choice_" : "sequence_"); @@ -717,7 +718,7 @@ namespace CXX << "unsigned long s = ~0UL;" << endl; - Boolean first (true); + bool first (true); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -730,7 +731,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get<UnsignedLong> ("p:state")); + size_t state (p.context ().get<size_t> ("p:state")); if (first) first = false; @@ -755,7 +756,7 @@ namespace CXX if (Choice* pc = dynamic_cast<Choice*> (p)) { if (pc->min () != 0 && - pc->context ().get<UnsignedLong> ("p:effective-min") == 0) + pc->context ().get<size_t> ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -766,8 +767,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get<UnsignedLong> ("p:state")); + size_t state (pc->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -784,10 +784,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get<UnsignedLong> ("p:effective-min") == 0) + ps->context ().get<size_t> ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get<UnsignedLong> ("p:state")); + size_t state (ps->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -908,8 +907,8 @@ namespace CXX ParticleInCompositor { ParticleInSequence (Context& c, - UnsignedLong state, - UnsignedLong next_state, + size_t state, + size_t next_state, SemanticGraph::Complex& type) : ParticleInCompositor (c, type), state_ (state), particle_name_ (c) @@ -926,10 +925,10 @@ namespace CXX next_state_ = L"~0"; } - virtual Void + virtual void traverse (SemanticGraph::Particle& p) { - UnsignedLong min (p.min ()), max (p.max ()); + size_t min (p.min ()), max (p.max ()); os << "case " << state_ << "UL:" << endl << "{" @@ -1009,19 +1008,19 @@ namespace CXX << "}"; // case } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a<Choice> ()); + bool choice (c.is_a<Choice> ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get<UnsignedLong> ("p:effective-min")); - UnsignedLong n (cc.get<UnsignedLong> ("p:comp-number")); + size_t max (c.max ()); + size_t min (cc.get<size_t> ("p:effective-min")); + size_t n (cc.get<size_t> ("p:comp-number")); String func (choice ? "choice_" : "sequence_"); @@ -1030,7 +1029,7 @@ namespace CXX << "unsigned long s = ~0UL;" << endl; - Boolean first (true); + bool first (true); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -1043,7 +1042,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get<UnsignedLong> ("p:state")); + size_t state (p.context ().get<size_t> ("p:state")); if (first) first = false; @@ -1068,7 +1067,7 @@ namespace CXX if (Choice* pc = dynamic_cast<Choice*> (p)) { if (pc->min () != 0 && - pc->context ().get<UnsignedLong> ("p:effective-min") == 0) + pc->context ().get<size_t> ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -1079,8 +1078,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get<UnsignedLong> ("p:state")); + size_t state (pc->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1097,10 +1095,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get<UnsignedLong> ("p:effective-min") == 0) + ps->context ().get<size_t> ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get<UnsignedLong> ("p:state")); + size_t state (ps->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1253,7 +1250,7 @@ namespace CXX } private: - UnsignedLong state_; + size_t state_; String next_state_; ParticleName particle_name_; @@ -1274,7 +1271,7 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) // Empty compositor. @@ -1322,7 +1319,7 @@ namespace CXX Element& e (dynamic_cast<Element&> (ci->particle ())); String ns (e.qualified_p () ? e.namespace_ ().name () : String ()); - UnsignedLong state (e.context ().get<UnsignedLong> ("p:state")); + size_t state (e.context ().get<size_t> ("p:state")); os << "if (count[" << state << "UL] == 0)" << "{" @@ -1348,7 +1345,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -1358,7 +1355,7 @@ namespace CXX if (!cc.count ("p:comp-number")) // Empty compositor. return; - UnsignedLong n (cc.get<UnsignedLong> ("p:comp-number")); + size_t n (cc.get<size_t> ("p:comp-number")); os << "void " << ename (type_) << "::" << endl << "choice_" << n << " (unsigned long& state," << endl @@ -1411,7 +1408,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!s.context().count ("p:comp-number")) // Empty compositor. @@ -1419,7 +1416,7 @@ namespace CXX using SemanticGraph::Compositor; - UnsignedLong n (s.context ().get<UnsignedLong> ("p:comp-number")); + size_t n (s.context ().get<size_t> ("p:comp-number")); os << "void " << ename (type_) << "::" << endl << "sequence_" << n << " (unsigned long& state," << endl @@ -1444,7 +1441,7 @@ namespace CXX os << "switch (state)" << "{"; - UnsignedLong state (0); + size_t state (0); for (Compositor::ContainsIterator ci (s.contains_begin ()), ce (s.contains_end ()); ci != ce;) @@ -1467,7 +1464,7 @@ namespace CXX ci->particle ().is_a<Compositor> () && !ci->particle ().context().count ("p:comp-number")); - UnsignedLong next (ci == ce ? 0 : state + 1); + size_t next (ci == ce ? 0 : state + 1); ParticleInSequence t (*this, state++, next, type_); t.dispatch (p); @@ -1502,7 +1499,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // Clear the counts and push the initial state. @@ -1514,7 +1511,7 @@ namespace CXX traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Compositor&) // Choice and sequence. { os << "v_state_& vs = *static_cast< v_state_* > (" << @@ -1543,7 +1540,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All&) { // The 'all' state machine reaches the final state only @@ -1562,19 +1559,19 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) // Choice and sequence. { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a<Choice> ()); + bool choice (c.is_a<Choice> ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get<UnsignedLong> ("p:effective-min")); - UnsignedLong n (cc.get<UnsignedLong> ("p:comp-number")); + size_t max (c.max ()); + size_t min (cc.get<size_t> ("p:effective-min")); + size_t n (cc.get<size_t> ("p:comp-number")); String func (choice ? "choice_" : "sequence_"); @@ -1606,7 +1603,7 @@ namespace CXX << "unsigned long s = ~0UL;" << endl; - Boolean first (true); + bool first (true); // Note that we don't need to worry about the compositor // being empty - this case is handled by our caller. @@ -1622,7 +1619,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get<UnsignedLong> ("p:state")); + size_t state (p.context ().get<size_t> ("p:state")); if (first) first = false; @@ -1647,7 +1644,7 @@ namespace CXX if (Choice* pc = dynamic_cast<Choice*> (p)) { if (pc->min () != 0 && - pc->context ().get<UnsignedLong> ("p:effective-min") == 0) + pc->context ().get<size_t> ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -1658,8 +1655,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get<UnsignedLong> ("p:state")); + size_t state (pc->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1676,10 +1672,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get<UnsignedLong> ("p:effective-min") == 0) + ps->context ().get<size_t> ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get<UnsignedLong> ("p:state")); + size_t state (ps->context ().get<size_t> ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1845,7 +1840,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All&) { os << "all_0 (vd.state, v_all_count_.top (), " << @@ -1853,7 +1848,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Compositor&) // Choice and sequence. { os << "assert (vd.func != 0);" @@ -1881,7 +1876,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Element; @@ -1901,7 +1896,7 @@ namespace CXX (poly_runtime ? "0, " : "") << "true);" << "}"; - if (a.context ().get<UnsignedLong> ("p:effective-min") != 0) + if (a.context ().get<size_t> ("p:effective-min") != 0) { os << "else" << endl << "this->_schema_error (" << @@ -1919,14 +1914,13 @@ namespace CXX << "v_all_count_.pop ();"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) // Choice and sequence. { using SemanticGraph::Choice; using SemanticGraph::Sequence; - UnsignedLong min ( - c.context ().get<UnsignedLong> ("p:effective-min")); + size_t min (c.context ().get<size_t> ("p:effective-min")); os << "v_state_& vs = *static_cast< v_state_* > (" << "this->v_state_stack_.top ());" @@ -2019,7 +2013,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { // Nothing to generate if we don't have any elements and wildcards. @@ -2036,7 +2030,7 @@ namespace CXX // Don't use restriction_p here since we don't want special // treatment of anyType. // - Boolean restriction ( + bool restriction ( c.inherits_p () && c.inherits ().is_a<SemanticGraph::Restricts> ()); @@ -2284,7 +2278,7 @@ namespace CXX }; } - Void + void generate_element_validation_source (Context& ctx) { ctx.os << "#include <assert.h>" << endl diff --git a/xsde/cxx/parser/element-validation-source.hxx b/xsde/cxx/parser/element-validation-source.hxx index 8e40093..23e24f2 100644 --- a/xsde/cxx/parser/element-validation-source.hxx +++ b/xsde/cxx/parser/element-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_element_validation_source (Context&); } } diff --git a/xsde/cxx/parser/elements.cxx b/xsde/cxx/parser/elements.cxx index 2f0c7e3..46518fa 100644 --- a/xsde/cxx/parser/elements.cxx +++ b/xsde/cxx/parser/elements.cxx @@ -171,7 +171,7 @@ namespace CXX return t.context ().get<String> ("p:impl"); } - Boolean Context:: + bool Context:: has_facets (SemanticGraph::Complex& c) { if (restriction_p (c)) @@ -234,20 +234,20 @@ namespace CXX // Includes // - Void TypeForward:: + void TypeForward:: traverse (SemanticGraph::Type& t) { os << "class " << t.context ().get<String> (name_key_) << ";"; } - Void Includes:: + void Includes:: traverse_ (SemanticGraph::Uses& u) { // Support for weak (forward) inclusion used in the file-per-type // compilation model. // SemanticGraph::Schema& s (u.schema ()); - Boolean weak (u.context ().count ("weak")); + bool weak (u.context ().count ("weak")); if (weak && (type_ == header || type_ == impl_header)) { diff --git a/xsde/cxx/parser/elements.hxx b/xsde/cxx/parser/elements.hxx index 179eaec..eaad3f7 100644 --- a/xsde/cxx/parser/elements.hxx +++ b/xsde/cxx/parser/elements.hxx @@ -90,7 +90,7 @@ namespace CXX } public: - Boolean + bool restriction_p (SemanticGraph::Complex& c) const { if (c.inherits_p () && @@ -164,7 +164,7 @@ namespace CXX public: - Boolean + bool has_facets (SemanticGraph::Complex& c); public: @@ -175,13 +175,13 @@ namespace CXX String& list_base; String& parser_map; - Boolean validation; - Boolean exceptions; - Boolean poly_code; - Boolean poly_runtime; - Boolean reset; - Boolean mixin; - Boolean tiein; + bool validation; + bool exceptions; + bool poly_code; + bool poly_runtime; + bool reset; + bool mixin; + bool tiein; Regex const* hxx_expr; Regex const* ixx_expr; @@ -212,13 +212,13 @@ namespace CXX Traversal::Fundamental::Entity { - StringBasedType (Boolean& r) + StringBasedType (bool& r) : r_ (r) { *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -226,74 +226,74 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { r_ = true; } private: - Boolean& r_; + bool& r_; Traversal::Inherits inherits_; }; @@ -301,12 +301,12 @@ namespace CXX // struct RequiredAttributeTest: Traversal::Attribute { - RequiredAttributeTest (Boolean& result) + RequiredAttributeTest (bool& result) : result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (!result_ && !a.optional_p ()) @@ -314,7 +314,7 @@ namespace CXX } private: - Boolean& result_; + bool& result_; }; @@ -323,9 +323,9 @@ namespace CXX struct ParticleParamDecl: Traversal::Element, Context { ParticleParamDecl (Context& c, - Boolean& first, - Boolean name_arg, - Boolean poly) + bool& first, + bool name_arg, + bool poly) : Context (c), first_ (first), name_arg_ (name_arg), @@ -334,12 +334,12 @@ namespace CXX { } - ParticleParamDecl (Context& c, Boolean* result, Boolean poly) + ParticleParamDecl (Context& c, bool* result, bool poly) : Context (c), first_ (name_arg_), poly_ (poly), result_ (result) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_ && anonymous (e.type ())) @@ -368,15 +368,15 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean poly_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool poly_; + bool* result_; }; struct AttributeParamDecl: Traversal::Attribute, Context { - AttributeParamDecl (Context& c, Boolean& first, Boolean name_arg) + AttributeParamDecl (Context& c, bool& first, bool name_arg) : Context (c), first_ (first), name_arg_ (name_arg), @@ -384,12 +384,12 @@ namespace CXX { } - AttributeParamDecl (Context& c, Boolean* result) + AttributeParamDecl (Context& c, bool* result) : Context (c), first_ (name_arg_), result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (result_ != 0) @@ -412,16 +412,16 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool* result_; }; struct ParserParamDecl : Traversal::Complex, Traversal::List, Context { - ParserParamDecl (Context& c, Boolean name_arg, Boolean poly) + ParserParamDecl (Context& c, bool name_arg, bool poly) : Context (c), particle_ (c, first_, name_arg, poly), attribute_ (c, first_, name_arg), @@ -440,7 +440,7 @@ namespace CXX names_ >> attribute_; } - ParserParamDecl (Context& c, Boolean* result, Boolean poly) + ParserParamDecl (Context& c, bool* result, bool poly) : Context (c), particle_ (c, result, poly), attribute_ (c, result), @@ -457,7 +457,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -469,7 +469,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -505,20 +505,20 @@ namespace CXX AttributeParamDecl attribute_; Traversal::Names names_; - Boolean first_; - Boolean name_arg_; - Boolean poly_; - Boolean* result_; + bool first_; + bool name_arg_; + bool poly_; + bool* result_; }; struct ParserParamTest { - ParserParamTest (Context& c, Boolean& result, Boolean poly) + ParserParamTest (Context& c, bool& result, bool poly) : impl_ (c, &result, poly) { } - Void + void traverse (SemanticGraph::Complex& c) { impl_.traverse (c); @@ -532,16 +532,16 @@ namespace CXX // struct TypeForward: Traversal::Type, Context { - TypeForward (Context& c, Char const* name_key) + TypeForward (Context& c, char const* name_key) : Context (c), name_key_ (name_key) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t); private: - Char const* name_key_; + char const* name_key_; }; struct Includes : Traversal::Imports, @@ -563,20 +563,20 @@ namespace CXX schema_ >> schema_names_ >> namespace_ >> names_ >> type_forward_; } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { traverse_ (i); } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { traverse_ (i); } private: - Void + void traverse_ (SemanticGraph::Uses&); private: @@ -599,7 +599,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options_.root_element_first ()) diff --git a/xsde/cxx/parser/generator.cxx b/xsde/cxx/parser/generator.cxx index b226cb9..f78291e 100644 --- a/xsde/cxx/parser/generator.cxx +++ b/xsde/cxx/parser/generator.cxx @@ -9,9 +9,6 @@ #include <cutl/re.hxx> -#include <cult/containers/set.hxx> -#include <cult/containers/vector.hxx> - #include <cutl/compiler/code-stream.hxx> #include <cutl/compiler/cxx-indenter.hxx> #include <cutl/compiler/sloc-counter.hxx> @@ -70,7 +67,7 @@ namespace CXX { namespace { - Char const copyright_gpl[] = + char const copyright_gpl[] = "// Copyright (c) 2005-2011 Code Synthesis Tools CC\n" "//\n" "// This program was generated by CodeSynthesis XSD/e, an XML Schema\n" @@ -91,7 +88,7 @@ namespace CXX "//\n" "//\n\n"; - Char const copyright_proprietary[] = + char const copyright_proprietary[] = "// Copyright (c) 2005-2011 Code Synthesis Tools CC\n" "//\n" "// This program was generated by CodeSynthesis XSD/e, an XML Schema to\n" @@ -101,7 +98,7 @@ namespace CXX "// license text for conditions.\n" "//\n\n"; - Char const copyright_impl[] = + char const copyright_impl[] = "// Not copyrighted - public domain.\n" "//\n" "// This sample parser implementation was generated by CodeSynthesis XSD/e,\n" @@ -110,14 +107,14 @@ namespace CXX "//\n\n"; } - Void Parser::Generator:: + void Parser::Generator:: usage () { CXX::Parser::options::print_usage (wcout); CXX::options::print_usage (wcout); } - Void Parser::Generator:: + void Parser::Generator:: process_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -129,7 +126,7 @@ namespace CXX namespace { template <typename S> - Void + void open (S& ifs, NarrowString const& path) { try @@ -154,7 +151,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -174,7 +171,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def) @@ -190,13 +187,13 @@ namespace CXX } - UnsignedLong Parser::Generator:: + size_t Parser::Generator:: generate (Parser::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, TypeMap::Namespaces& type_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList& file_list, AutoUnlinks& unlinks) @@ -207,7 +204,7 @@ namespace CXX try { - Boolean generate_xml_schema (ops.generate_xml_schema ()); + bool generate_xml_schema (ops.generate_xml_schema ()); // We could be compiling several schemas at once in which case // handling of the --generate-xml-schema option gets tricky: we @@ -223,11 +220,11 @@ namespace CXX } } - Boolean impl (!generate_xml_schema && + bool impl (!generate_xml_schema && (ops.generate_noop_impl () || ops.generate_print_impl ())); - Boolean driver (gen_driver && !generate_xml_schema && + bool driver (gen_driver && !generate_xml_schema && ops.generate_test_driver ()); @@ -247,7 +244,7 @@ namespace CXX proc.process (ops, schema, file_path, true); } - Boolean validation (!ops.suppress_validation ()); + bool validation (!ops.suppress_validation ()); // Compute state machine info. // @@ -409,8 +406,8 @@ namespace CXX // Generate code. // - Boolean inline_ (ops.generate_inline () && !generate_xml_schema); - Boolean source (!generate_xml_schema); + bool inline_ (ops.generate_inline () && !generate_xml_schema); + bool source (!generate_xml_schema); NarrowString name (file_path.leaf ()); NarrowString skel_suffix (ops.skel_file_suffix ()); @@ -709,7 +706,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -752,7 +749,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); typedef compiler::ostream_filter<compiler::cxx_indenter, wchar_t> diff --git a/xsde/cxx/parser/generator.hxx b/xsde/cxx/parser/generator.hxx index c2a0177..5cfed0a 100644 --- a/xsde/cxx/parser/generator.hxx +++ b/xsde/cxx/parser/generator.hxx @@ -6,34 +6,27 @@ #ifndef CXX_PARSER_GENERATOR_HXX #define CXX_PARSER_GENERATOR_HXX -#include <cult/types.hxx> - -#include <cult/containers/vector.hxx> - #include <xsd-frontend/semantic-graph/elements.hxx> // Path #include <xsd-frontend/semantic-graph/schema.hxx> #include <xsde.hxx> - +#include <types.hxx> #include <type-map/type-map.hxx> - #include <cxx/parser/options.hxx> namespace CXX { namespace Parser { - using namespace Cult::Types; - class Generator { public: - static Void + static void usage (); // Assign names to global declarations. // - static Void + static void process_names (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&); @@ -42,13 +35,13 @@ namespace CXX // struct Failed {}; - static UnsignedLong + static size_t generate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, TypeMap::Namespaces& type_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList&, AutoUnlinks&); diff --git a/xsde/cxx/parser/impl-header.cxx b/xsde/cxx/parser/impl-header.cxx index e909ce5..2ffb493 100644 --- a/xsde/cxx/parser/impl-header.cxx +++ b/xsde/cxx/parser/impl-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -66,7 +66,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -113,7 +113,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -145,7 +145,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& arg (arg_type (e.type ())); @@ -169,7 +169,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& arg (arg_type (a.type ())); @@ -204,12 +204,12 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); String const& name (eimpl (c)); String const& ret (ret_type (c)); @@ -277,7 +277,7 @@ namespace CXX }; } - Void + void generate_impl_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/impl-header.hxx b/xsde/cxx/parser/impl-header.hxx index d72ab80..e534130 100644 --- a/xsde/cxx/parser/impl-header.hxx +++ b/xsde/cxx/parser/impl-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_impl_header (Context&); } } diff --git a/xsde/cxx/parser/impl-source.cxx b/xsde/cxx/parser/impl-source.cxx index 5ad9a02..35df1b1 100644 --- a/xsde/cxx/parser/impl-source.cxx +++ b/xsde/cxx/parser/impl-source.cxx @@ -22,7 +22,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -127,7 +127,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -205,7 +205,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -272,7 +272,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Complex; @@ -319,7 +319,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Complex; @@ -376,10 +376,10 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); + bool hb (c.inherits_p ()); String const& name (eimpl (c)); String const& ret (ret_type (c)); @@ -503,7 +503,7 @@ namespace CXX }; } - Void + void generate_impl_source (Context& ctx) { if (ctx.options.generate_print_impl ()) diff --git a/xsde/cxx/parser/impl-source.hxx b/xsde/cxx/parser/impl-source.hxx index 22587bd..7449e97 100644 --- a/xsde/cxx/parser/impl-source.hxx +++ b/xsde/cxx/parser/impl-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_impl_source (Context&); } } diff --git a/xsde/cxx/parser/name-processor.cxx b/xsde/cxx/parser/name-processor.cxx index 2483889..d0cd8b1 100644 --- a/xsde/cxx/parser/name-processor.cxx +++ b/xsde/cxx/parser/name-processor.cxx @@ -3,16 +3,18 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> +#include <map> +#include <sstream> +#include <iostream> + #include <cxx/elements.hxx> #include <cxx/parser/name-processor.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> -#include <cult/containers/set.hxx> - -#include <sstream> -#include <iostream> +using namespace std; namespace CXX { @@ -22,7 +24,7 @@ namespace CXX { // // - typedef Cult::Containers::Set<String> NameSet; + typedef set<String> NameSet; class Context: public CXX::Context { @@ -64,7 +66,7 @@ namespace CXX { String name (escape (n + suffix)); - for (UnsignedLong i (1); set.find (name) != set.end (); ++i) + for (size_t i (1); set.find (name) != set.end (); ++i) { std::wostringstream os; os << i; @@ -85,30 +87,30 @@ namespace CXX String const skel_suffix_; String const impl_suffix_; - Cult::Containers::Map<String, NameSet*> global_type_names_; + map<String, NameSet*> global_type_names_; public: - Boolean const impl; - Boolean const tiein; + bool const impl; + bool const tiein; String const& skel_suffix; String const& impl_suffix; - Cult::Containers::Map<String, NameSet*>& global_type_names; + map<String, NameSet*>& global_type_names; - Boolean validation; - Boolean polymorphic; + bool validation; + bool polymorphic; }; // Primary names. // struct PrimaryParticle: Traversal::Element, Context { - PrimaryParticle (Context& c, NameSet& set, Boolean restriction) + PrimaryParticle (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Element; @@ -130,17 +132,17 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct PrimaryAttribute: Traversal::Attribute, Context { - PrimaryAttribute (Context& c, NameSet& set, Boolean restriction) + PrimaryAttribute (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Attribute; @@ -162,7 +164,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; @@ -176,12 +178,12 @@ namespace CXX Traversal::Sequence, Context { - ParticleTag (Context& c, NameSet& set, Boolean restriction) + ParticleTag (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Element; @@ -202,7 +204,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -220,7 +222,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -240,7 +242,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -262,7 +264,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryCompositor: Traversal::All, @@ -270,7 +272,7 @@ namespace CXX Traversal::Sequence, Context { - SecondaryCompositor (Context& c, NameSet& set, Boolean restriction) + SecondaryCompositor (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction), @@ -279,7 +281,7 @@ namespace CXX contain_particle_tag_ >> particle_tag_; } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -294,7 +296,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -324,7 +326,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { SemanticGraph::Context& sc (s.context ()); @@ -370,7 +372,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; ParticleTag particle_tag_; Traversal::ContainsParticle contain_particle_tag_; @@ -378,15 +380,15 @@ namespace CXX struct SecondaryParticle: Traversal::Element, Context { - SecondaryParticle (Context& c, NameSet& set, Boolean restriction) + SecondaryParticle (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - Boolean poly ( + bool poly ( polymorphic && !e.type ().context ().count ("anonymous")); SemanticGraph::Context& ec (e.context ()); @@ -418,17 +420,17 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryAttribute: Traversal::Attribute, Context { - SecondaryAttribute (Context& c, NameSet& set, Boolean restriction) + SecondaryAttribute (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Attribute; @@ -458,7 +460,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; @@ -471,7 +473,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -493,7 +495,7 @@ namespace CXX // inheriting by restriction in which case we need to have // the same names as our base. // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) { @@ -607,7 +609,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& c (t.context ()); @@ -679,7 +681,7 @@ namespace CXX String base_name (escape (L"post_" + n)); String post (base_name); - for (UnsignedLong i (1); set.find (post) != set.end (); ++i) + for (size_t i (1); set.find (post) != set.end (); ++i) { std::wostringstream os; os << i; @@ -702,7 +704,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -798,13 +800,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { set_names (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { set_names (t, "any_simple_type"); @@ -812,7 +814,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set_names (t, "boolean"); @@ -820,79 +822,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { set_names (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { set_names (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { set_names (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { set_names (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { set_names (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { set_names (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { set_names (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { set_names (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { set_names (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { set_names (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { set_names (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { set_names (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { set_names (t, "negative_integer"); @@ -900,19 +902,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { set_names (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { set_names (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { set_names (t, "decimal"); @@ -920,49 +922,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { set_names (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { set_names (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { set_names (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { set_names (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { set_names (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { set_names (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { set_names (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { set_names (t, "language"); @@ -971,7 +973,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set_names (t, "qname"); @@ -980,19 +982,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { set_names (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { set_names (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { set_names (t, "idrefs"); @@ -1000,7 +1002,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set_names (t, "uri"); @@ -1008,13 +1010,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { set_names (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { set_names (t, "hex_binary"); @@ -1023,56 +1025,56 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { set_names (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { set_names (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { set_names (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { set_names (t, "gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { set_names (t, "gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { set_names (t, "gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { set_names (t, "gyear");; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { set_names (t, "gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { set_names (t, "time"); @@ -1080,13 +1082,13 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { set_names (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { set_names (t, "entities"); @@ -1105,12 +1107,12 @@ namespace CXX return escape (base + impl_suffix); } - Void + void set_names (SemanticGraph::Type& t, String const& name) { SemanticGraph::Context& c (t.context ()); - WideChar const* ns = validation + wchar_t const* ns = validation ? L"::xsde::cxx::parser::validating::" : L"::xsde::cxx::parser::non_validating::"; @@ -1136,7 +1138,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -1148,7 +1150,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1160,7 +1162,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1178,7 +1180,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1191,11 +1193,11 @@ namespace CXX } }; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -1289,11 +1291,11 @@ namespace CXX } } - Void NameProcessor:: + void NameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { process_impl (ops, tu, file, deep); } diff --git a/xsde/cxx/parser/name-processor.hxx b/xsde/cxx/parser/name-processor.hxx index 25aceaa..1a28e47 100644 --- a/xsde/cxx/parser/name-processor.hxx +++ b/xsde/cxx/parser/name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_PARSER_NAME_PROCESSOR_HXX #define CXX_PARSER_NAME_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <cxx/parser/options.hxx> namespace CXX { namespace Parser { - using namespace Cult::Types; - class NameProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/parser/options.cli b/xsde/cxx/parser/options.cli index 552b473..9b07011 100644 --- a/xsde/cxx/parser/options.cli +++ b/xsde/cxx/parser/options.cli @@ -3,11 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -include <vector>; -include <string>; include <cstddef>; // std::size_t -include <cult/types.hxx>; // NarrowString +include <types.hxx>; // NarrowString, NarrowStrings include <cxx/options.cli>; @@ -17,7 +15,7 @@ namespace CXX { class options: CXX::options { - std::vector<Cult::Types::NarrowString> --type-map + NarrowStrings --type-map { "<mapfile>", "Read XML Schema to C++ type mapping information from <mapfile>. @@ -116,7 +114,7 @@ namespace CXX implementation." }; - Cult::Types::NarrowString --root-element + NarrowString --root-element { "<element>", "Indicate that <element> is the document root. This information is @@ -125,21 +123,21 @@ namespace CXX // Suffixes. // - Cult::Types::NarrowString --skel-type-suffix = "_pskel" + NarrowString --skel-type-suffix = "_pskel" { "<suffix>", "Use the provided <suffix> instead of the default \cb{_pskel} to construct the names of generated parser skeletons." }; - Cult::Types::NarrowString --skel-file-suffix = "-pskel" + NarrowString --skel-file-suffix = "-pskel" { "<suffix>", "Use the provided <suffix> instead of the default \cb{-pskel} to construct the names of generated parser skeleton files." }; - Cult::Types::NarrowString --impl-type-suffix = "_pimpl" + NarrowString --impl-type-suffix = "_pimpl" { "<suffix>", "Use the provided <suffix> instead of the default \cb{_pimpl} to @@ -147,7 +145,7 @@ namespace CXX XML Schema types and sample parser implementations." }; - Cult::Types::NarrowString --impl-file-suffix = "-pimpl" + NarrowString --impl-file-suffix = "-pimpl" { "<suffix>", "Use the provided <suffix> instead of the default \cb{-pimpl} to diff --git a/xsde/cxx/parser/parser-forward.cxx b/xsde/cxx/parser/parser-forward.cxx index f2ee20b..4687fdc 100644 --- a/xsde/cxx/parser/parser-forward.cxx +++ b/xsde/cxx/parser/parser-forward.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { os << "class " << ename (e) << ";"; @@ -37,7 +37,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { os << "class " << ename (l) << ";"; @@ -53,7 +53,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { os << "class " << ename (u) << ";"; @@ -69,7 +69,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { os << "class " << ename (c) << ";"; @@ -77,7 +77,7 @@ namespace CXX }; } - Void + void generate_parser_forward (Context& ctx) { ctx.os << "// Forward declarations" << endl diff --git a/xsde/cxx/parser/parser-forward.hxx b/xsde/cxx/parser/parser-forward.hxx index c96f063..b93b638 100644 --- a/xsde/cxx/parser/parser-forward.hxx +++ b/xsde/cxx/parser/parser-forward.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_forward (Context&); } } diff --git a/xsde/cxx/parser/parser-header.cxx b/xsde/cxx/parser/parser-header.cxx index f9abf09..9986e87 100644 --- a/xsde/cxx/parser/parser-header.cxx +++ b/xsde/cxx/parser/parser-header.cxx @@ -3,13 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cxx/parser/parser-header.hxx> +#include <set> -#include <cult/containers/set.hxx> +#include <cxx/parser/parser-header.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Parser @@ -23,21 +25,21 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); SemanticGraph::Type& base (e.inherits ().base ()); String fq_base (fq_name (base)); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); t.dispatch (e); } - Boolean facets (enum_facets || has_facets (e)); + bool facets (enum_facets || has_facets (e)); os << "class " << name << ": public " << (mixin ? "virtual " : "") << fq_base @@ -54,7 +56,7 @@ namespace CXX String const& ret (ret_type (e)); String const& base_ret (ret_type (base)); - Boolean same (ret == base_ret); + bool same (ret == base_ret); os << "virtual " << ret << endl << post_name (e) << " ()" << @@ -91,7 +93,7 @@ namespace CXX // If our base has pure virtual post, override it here. // - Boolean base_same ( + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); @@ -110,8 +112,7 @@ namespace CXX // Some schemas have duplicate enumerators so we have to create // a set out of them in order get the accurate count. // - typedef Cult::Containers::Set<String> Enums; - Enums enums; + set<String> enums; for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); i != end; ++i) @@ -137,7 +138,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -253,7 +254,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -322,7 +323,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& p) { if (first_) @@ -334,7 +335,7 @@ namespace CXX } private: - Boolean first_; + bool first_; }; struct CompositorCallback: Traversal::All, @@ -347,7 +348,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (correspondent (a) == 0) @@ -365,7 +366,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -392,7 +393,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Root compositor that models inheritance by extension @@ -440,7 +441,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (correspondent (e) == 0) @@ -467,7 +468,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& arg (arg_type (a.type ())); @@ -494,7 +495,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& parser (eparser (e)); @@ -519,7 +520,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "void" << endl @@ -538,7 +539,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String type (fq_name (e.type ())); @@ -560,7 +561,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << fq_name (a.type ()) << "* " << emember (a) << ";"; @@ -581,14 +582,13 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) return; - UnsignedLong state_count ( - a.context().get<UnsignedLong> ("p:state-count")); + size_t state_count (a.context().get<size_t> ("p:state-count")); os << "void" << endl << "all_0 (unsigned long&," << endl @@ -606,13 +606,13 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!c.context().count ("p:comp-number")) return; - UnsignedLong n (c.context ().get<UnsignedLong> ("p:comp-number")); + size_t n (c.context ().get<size_t> ("p:comp-number")); os << "void" << endl << "choice_" << n << " (unsigned long&," << endl @@ -629,13 +629,13 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!s.context().count ("p:comp-number")) return; - UnsignedLong n (s.context ().get<UnsignedLong> ("p:comp-number")); + size_t n (s.context ().get<size_t> ("p:comp-number")); os << "void" << endl << "sequence_" << n << " (unsigned long&," << endl @@ -666,7 +666,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -733,7 +733,7 @@ namespace CXX names_attribute_validation_state_ >> attribute_validation_state_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename (c)); @@ -742,17 +742,17 @@ namespace CXX // generate parser callbacks, etc. since they are the same as // in the base. We only need the parsing/validation code. // - Boolean hb (c.inherits_p ()); - Boolean restriction (restriction_p (c)); - Boolean facets (has_facets (c)); + bool hb (c.inherits_p ()); + bool restriction (restriction_p (c)); + bool facets (has_facets (c)); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); - Boolean hae (has_particle<Traversal::Any> (c)); - Boolean haa (has<Traversal::AnyAttribute> (c)); + bool hae (has_particle<Traversal::Any> (c)); + bool haa (has<Traversal::AnyAttribute> (c)); - Boolean hra (false); // Has required attribute. + bool hra (false); // Has required attribute. if (ha) { RequiredAttributeTest test (hra); @@ -809,7 +809,7 @@ namespace CXX // post // String const& ret (ret_type (c)); - Boolean same (hb && ret == ret_type (c.inherits ().base ())); + bool same (hb && ret == ret_type (c.inherits ().base ())); os << "virtual " << ret << endl << post_name (c) << " ()" << @@ -840,7 +840,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); ParserParamTest test (*this, r, true); test.traverse (c); @@ -932,7 +932,7 @@ namespace CXX String const& base_ret (ret_type (base)); - Boolean base_same ( + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); @@ -1040,7 +1040,7 @@ namespace CXX if (validation && (he || hae)) { - UnsignedLong depth (c.context ().get<UnsignedLong> ("p:depth")); + size_t depth (c.context ().get<size_t> ("p:depth")); // Has to be public for some broken compilers (e.g., GH C++). // @@ -1245,13 +1245,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { gen_typedef (t, "void"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_typedef (t, string_type_); @@ -1259,7 +1259,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { gen_typedef (t, "bool"); @@ -1267,79 +1267,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { gen_typedef (t, "signed char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { gen_typedef (t, "unsigned char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { gen_typedef (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { gen_typedef (t, "unsigned short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { gen_typedef (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { gen_typedef (t, "unsigned int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { gen_typedef (t, long_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { gen_typedef (t, unsigned_long_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { gen_typedef (t, "unsigned long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { gen_typedef (t, "unsigned long"); @@ -1347,19 +1347,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { gen_typedef (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { gen_typedef (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { gen_typedef (t, "double"); @@ -1367,31 +1367,31 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { nmtoken_ = gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { // NMTOKENS uses NMTOKEN implementation to parse individual items. @@ -1402,19 +1402,19 @@ namespace CXX gen_typedef (t, string_seq_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_typedef (t, string_type_); @@ -1422,7 +1422,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { gen_typedef (t, qname_type_); @@ -1430,19 +1430,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { idref_ = gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { // IDREFS uses IDREF implementation to parse individual items. @@ -1455,7 +1455,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_typedef (t, string_type_); @@ -1463,13 +1463,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_typedef (t, buffer_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_typedef (t, buffer_type_); @@ -1478,55 +1478,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { gen_typedef (t, xs_ns_ + L"::date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { gen_typedef (t, xs_ns_ + L"::date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { gen_typedef (t, xs_ns_ + L"::duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { gen_typedef (t, xs_ns_ + L"::gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { gen_typedef (t, xs_ns_ + L"::gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { gen_typedef (t, xs_ns_ + L"::gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { gen_typedef (t, xs_ns_ + L"::gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { gen_typedef (t, xs_ns_ + L"::gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { gen_typedef (t, xs_ns_ + L"::time"); @@ -1534,18 +1534,18 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&) { } private: - Boolean + bool gen_typedef (SemanticGraph::Type& t, String const& type) { if (ret_type (t) == type) @@ -1584,8 +1584,8 @@ namespace CXX String long_type_; String unsigned_long_type_; - Boolean idref_; - Boolean nmtoken_; + bool idref_; + bool nmtoken_; }; struct FundNamespace : Namespace, Context @@ -1740,8 +1740,8 @@ namespace CXX }; } - Void - generate_parser_header (Context& ctx, Boolean generate_xml_schema) + void + generate_parser_header (Context& ctx, bool generate_xml_schema) { NarrowString extern_xml_schema; @@ -1759,12 +1759,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("p:includes")) { - typedef Cult::Containers::Set<String> Includes; + typedef set<String> Includes; Includes& is ( ctx.schema_root.context ().get<Includes> ("p:includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; @@ -1844,12 +1844,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("p:includes")) { - typedef Cult::Containers::Set<String> Includes; + typedef set<String> Includes; Includes& is ( ctx.schema_root.context ().get<Includes> ("p:includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; diff --git a/xsde/cxx/parser/parser-header.hxx b/xsde/cxx/parser/parser-header.hxx index 2337b64..a58ae76 100644 --- a/xsde/cxx/parser/parser-header.hxx +++ b/xsde/cxx/parser/parser-header.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Parser { - Void - generate_parser_header (Context&, Boolean generate_xml_schema); + void + generate_parser_header (Context&, bool generate_xml_schema); } } diff --git a/xsde/cxx/parser/parser-inline.cxx b/xsde/cxx/parser/parser-inline.cxx index 557a81e..fd1e6d4 100644 --- a/xsde/cxx/parser/parser-inline.cxx +++ b/xsde/cxx/parser/parser-inline.cxx @@ -14,7 +14,7 @@ namespace CXX { namespace { - Void + void facet_calls (SemanticGraph::Complex& c, Context& ctx) { using SemanticGraph::Restricts; @@ -123,19 +123,19 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); t.dispatch (e); } - UnsignedLong enum_count (0); + size_t enum_count (0); if (enum_facets) { for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); @@ -143,7 +143,7 @@ namespace CXX ++enum_count; } - Boolean facets (enum_facets || has_facets (e)); + bool facets (enum_facets || has_facets (e)); if (facets || tiein) os << "// " << name << endl @@ -197,8 +197,8 @@ namespace CXX } private: - Void - facet_calls (Type& e, UnsignedLong enum_count) + void + facet_calls (Type& e, size_t enum_count) { Parser::facet_calls (e, *this); @@ -217,7 +217,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -285,7 +285,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { if (tiein) @@ -328,7 +328,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& scope (ename (e.scope ())); @@ -360,7 +360,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << inl @@ -376,12 +376,12 @@ namespace CXX // struct ParticleMemberSet: Traversal::Element, Context { - ParticleMemberSet (Context& c, Boolean poly) + ParticleMemberSet (Context& c, bool poly) : Context (c), poly_ (poly) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_) @@ -394,7 +394,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; }; struct AttributeMemberSet: Traversal::Attribute, Context @@ -404,7 +404,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "this->" << emember (a) << " = &" << ename (a) << ";"; @@ -415,13 +415,13 @@ namespace CXX Traversal::List, Context { - BaseMemberSet (Context& c, Boolean poly) + BaseMemberSet (Context& c, bool poly) : Context (c), poly_ (poly) { inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -433,7 +433,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -447,19 +447,19 @@ namespace CXX private: Traversal::Inherits inherits_; - Boolean poly_; + bool poly_; }; // // struct ParticleMemberInit: Traversal::Element, Context { - ParticleMemberInit (Context& c, Boolean comma) + ParticleMemberInit (Context& c, bool comma) : Context (c), first_ (!comma) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (first_) @@ -476,24 +476,24 @@ namespace CXX } } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; struct AttributeMemberInit: Traversal::Attribute, Context { - AttributeMemberInit (Context& c, Boolean comma) + AttributeMemberInit (Context& c, bool comma) : Context (c), first_ (!comma) { } - virtual Void + virtual void traverse (Type& a) { if (first_) @@ -504,14 +504,14 @@ namespace CXX os << emember (a) << " (0)"; } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; // @@ -523,14 +523,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) return; - UnsignedLong state_count ( - a.context().get<UnsignedLong> ("p:state-count")); + size_t state_count (a.context().get<size_t> ("p:state-count")); os << "," << endl << " v_all_count_ (" << state_count << "UL, v_all_first_)"; @@ -586,17 +585,17 @@ namespace CXX contains_particle_set_poly_ >> particle_set_poly_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean facets (has_facets (c)); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + bool facets (has_facets (c)); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); - Boolean hae (has_particle<Traversal::Any> (c)); + bool hae (has_particle<Traversal::Any> (c)); - Boolean hra (false); // Has required attribute. + bool hra (false); // Has required attribute. if (ha) { RequiredAttributeTest test (hra); @@ -604,7 +603,7 @@ namespace CXX names (c, names_test); } - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); if (!(tiein || facets || (!restriction && (he || ha)) || @@ -657,7 +656,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); ParserParamTest test (*this, r, true); test.traverse (c); @@ -705,7 +704,7 @@ namespace CXX (validation && (he || hae || hra))) os << ": "; - Boolean comma (false); + bool comma (false); if (hb && tiein) { @@ -798,7 +797,7 @@ namespace CXX os << " " << etiein (c) << " (impl)"; - Boolean comma (true); + bool comma (true); if (!restriction && (he || ha)) { @@ -902,7 +901,7 @@ namespace CXX }; } - Void + void generate_parser_inline (Context& ctx) { // Emit "weak" header includes that are used in the file-per-type diff --git a/xsde/cxx/parser/parser-inline.hxx b/xsde/cxx/parser/parser-inline.hxx index 46b0f39..76c1ef2 100644 --- a/xsde/cxx/parser/parser-inline.hxx +++ b/xsde/cxx/parser/parser-inline.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_inline (Context&); } } diff --git a/xsde/cxx/parser/parser-source.cxx b/xsde/cxx/parser/parser-source.cxx index 868998f..dcb7c26 100644 --- a/xsde/cxx/parser/parser-source.cxx +++ b/xsde/cxx/parser/parser-source.cxx @@ -3,13 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cxx/parser/parser-source.hxx> +#include <set> -#include <cult/containers/set.hxx> +#include <cxx/parser/parser-source.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Parser @@ -23,7 +25,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); @@ -31,12 +33,12 @@ namespace CXX SemanticGraph::Type& base (e.inherits ().base ()); String const& base_ret (ret_type (base)); - Boolean same (ret == base_ret); - Boolean base_same ( + bool same (ret == base_ret); + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); @@ -106,7 +108,7 @@ namespace CXX if (validation) { - Boolean gen (!anonymous (e)); + bool gen (!anonymous (e)); // We normally don't need to enter anonymous types into // the inheritance map. The only exception is when an @@ -162,7 +164,7 @@ namespace CXX if (enum_facets) { - typedef Cult::Containers::Set<String> Enums; + typedef set<String> Enums; Enums enums; for (Type::NamesIterator i (e.names_begin ()), @@ -173,7 +175,7 @@ namespace CXX "_enums_[" << enums.size () << "UL] = " << "{"; - for (Enums::Iterator b (enums.begin ()), i (b), end (enums.end ()); + for (Enums::iterator b (enums.begin ()), i (b), end (enums.end ()); i != end; ++i) os << (i != b ? ",\n" : "") << strlit (*i); @@ -191,7 +193,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -375,7 +377,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -441,7 +443,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& m (emember (e)); @@ -468,7 +470,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& m (emember (a)); @@ -488,11 +490,11 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { - Boolean poly (poly_code && !anonymous (e.type ())); - Boolean subst (poly && e.global_p ()); + bool poly (poly_code && !anonymous (e.type ())); + bool subst (poly && e.global_p ()); if (e.qualified_p () && e.namespace_ ().name ()) { @@ -592,12 +594,12 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); - Boolean poly (poly_code && !anonymous (e.type ())); - Boolean subst (poly && e.global_p ()); + bool poly (poly_code && !anonymous (e.type ())); + bool subst (poly && e.global_p ()); if (e.qualified_p () && e.namespace_ ().name ()) { @@ -706,7 +708,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -802,7 +804,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (correspondent (a) == 0) @@ -834,7 +836,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -865,7 +867,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Root compositor that models inheritance by extension @@ -969,7 +971,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (correspondent (e) == 0) @@ -1009,7 +1011,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (ename (a)); @@ -1101,17 +1103,17 @@ namespace CXX names_attribute_ >> attribute_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean restriction (restriction_p (c)); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); + bool hb (c.inherits_p ()); + bool restriction (restriction_p (c)); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); - Boolean hae (has_particle<Traversal::Any> (c)); + bool hae (has_particle<Traversal::Any> (c)); - Boolean hra (false); // Has required attribute. + bool hra (false); // Has required attribute. if (ha) { RequiredAttributeTest test (hra); @@ -1121,10 +1123,10 @@ namespace CXX String const& name (ename (c)); String const& ret (ret_type (c)); - Boolean same (hb && ret == ret_type (c.inherits ().base ())); + bool same (hb && ret == ret_type (c.inherits ().base ())); String base_ret; - Boolean base_same (true); + bool base_same (true); if (tiein && hb) { @@ -1294,7 +1296,7 @@ namespace CXX if (hb && validation) { - Boolean gen (!anonymous (c)); + bool gen (!anonymous (c)); // We normally don't need to enter anonymous types into // the inheritance map. The only exception is when an @@ -1555,7 +1557,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (e.substitutes_p ()) @@ -1595,7 +1597,7 @@ namespace CXX }; } - Void + void generate_parser_source (Context& ctx) { if (ctx.tiein) diff --git a/xsde/cxx/parser/parser-source.hxx b/xsde/cxx/parser/parser-source.hxx index d2f7157..5d3bd4c 100644 --- a/xsde/cxx/parser/parser-source.hxx +++ b/xsde/cxx/parser/parser-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_source (Context&); } } diff --git a/xsde/cxx/parser/print-impl-common.hxx b/xsde/cxx/parser/print-impl-common.hxx index df379fa..c9fca22 100644 --- a/xsde/cxx/parser/print-impl-common.hxx +++ b/xsde/cxx/parser/print-impl-common.hxx @@ -76,13 +76,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type&) { gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_string (t); @@ -90,7 +90,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { if (default_type (t, "bool")) @@ -108,7 +108,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { if (default_type (t, "signed char")) @@ -124,7 +124,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { if (default_type (t, "unsigned char")) @@ -140,7 +140,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { if (default_type (t, "short")) @@ -156,7 +156,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { if (default_type (t, "unsigned short")) @@ -172,7 +172,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { if (default_type (t, "int")) @@ -188,7 +188,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { if (default_type (t, "unsigned int")) @@ -204,7 +204,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { if (options.no_long_long ()) @@ -237,7 +237,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { if (options.no_long_long ()) @@ -270,7 +270,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { if (default_type (t, "long")) @@ -286,7 +286,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { if (default_type (t, "long")) @@ -302,7 +302,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { if (default_type (t, "long")) @@ -318,7 +318,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { if (default_type (t, "unsigned long")) @@ -334,7 +334,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { if (default_type (t, "unsigned long")) @@ -352,7 +352,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { if (default_type (t, "float")) @@ -368,7 +368,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { if (default_type (t, "double")) @@ -384,7 +384,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { if (default_type (t, "double")) @@ -402,61 +402,61 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_string (t); @@ -465,13 +465,13 @@ namespace CXX // String sequences. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { gen_sequence (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { gen_sequence (t); @@ -480,7 +480,7 @@ namespace CXX // QName // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { if (options.no_stl ()) @@ -535,13 +535,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_buffer (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_buffer (t); @@ -549,7 +549,7 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { if (default_type (t, xs_ns_name () + L"::date")) @@ -571,7 +571,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { if (default_type (t, xs_ns_name () + L"::date_time")) @@ -600,7 +600,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { if (default_type (t, xs_ns_name () + L"::duration")) @@ -637,7 +637,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { if (default_type (t, xs_ns_name () + L"::gday")) @@ -655,7 +655,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { if (default_type (t, xs_ns_name () + L"::gmonth")) @@ -673,7 +673,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { if (default_type (t, xs_ns_name () + L"::gmonth_day")) @@ -693,7 +693,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { if (default_type (t, xs_ns_name () + L"::gyear")) @@ -711,7 +711,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { if (default_type (t, xs_ns_name () + L"::gyear_month")) @@ -731,7 +731,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { if (default_type (t, xs_ns_name () + L"::time")) @@ -922,7 +922,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_string (t); @@ -930,61 +930,61 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_string (t); @@ -993,13 +993,13 @@ namespace CXX // String sequences. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { gen_sequence (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { gen_sequence (t); @@ -1008,7 +1008,7 @@ namespace CXX // QName // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { if (options.no_stl () && @@ -1026,13 +1026,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_buffer (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_buffer (t); diff --git a/xsde/cxx/parser/state-processor.cxx b/xsde/cxx/parser/state-processor.cxx index 3caeb00..6e079d7 100644 --- a/xsde/cxx/parser/state-processor.cxx +++ b/xsde/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 <vector> +#include <iostream> + #include <cxx/parser/state-processor.hxx> #include <cxx/parser/elements.hxx> @@ -10,9 +13,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,17 +21,14 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector<SemanticGraph::Particle*> Particles; + typedef vector<SemanticGraph::Particle*> Particles; void print (Particles const& p) { - using std::wcerr; - using std::endl; - 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)) @@ -52,10 +50,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 +61,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Compositor; @@ -78,8 +76,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,8 +99,7 @@ namespace CXX { a.context ().set ("p:comp-number", choice_++); a.context ().set ("p:prefixes", prefixes_); - a.context ().set ("p:state-count", - UnsignedLong (prefixes_.size ())); + a.context ().set ("p:state-count", size_t (prefixes_.size ())); // effective-min = min * actual-min // @@ -115,7 +112,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -127,8 +124,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) @@ -145,7 +142,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -160,7 +157,7 @@ namespace CXX t.prefixes_.end ().base ()); if (min == 1 && - p.context ().get<UnsignedLong> ("p:effective-min") == 0) + p.context ().get<size_t> ("p:effective-min") == 0) min = 0; } @@ -184,7 +181,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -196,9 +193,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) @@ -218,7 +215,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -234,7 +231,7 @@ namespace CXX t.prefixes_.begin ().base (), t.prefixes_.end ().base ()); - if (p.context ().get<UnsignedLong> ("p:effective-min") != 0) + if (p.context ().get<size_t> ("p:effective-min") != 0) min = 1; } } @@ -267,11 +264,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_; }; @@ -279,12 +276,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 ()); @@ -297,7 +294,7 @@ namespace CXX }; } - Void StateProcessor:: + void StateProcessor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/state-processor.hxx b/xsde/cxx/parser/state-processor.hxx index 9a1bca6..58ca460 100644 --- a/xsde/cxx/parser/state-processor.hxx +++ b/xsde/cxx/parser/state-processor.hxx @@ -6,19 +6,18 @@ #ifndef CXX_PARSER_STATE_PROCESSOR_HXX #define CXX_PARSER_STATE_PROCESSOR_HXX -#include <cult/types.hxx> #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> + namespace CXX { namespace Parser { - using namespace Cult::Types; - class StateProcessor { public: - Void + void process (XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file); }; diff --git a/xsde/cxx/parser/type-processor.cxx b/xsde/cxx/parser/type-processor.cxx index eacede8..3513aed 100644 --- a/xsde/cxx/parser/type-processor.cxx +++ b/xsde/cxx/parser/type-processor.cxx @@ -3,7 +3,7 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include <cult/containers/set.hxx> +#include <set> #include <cxx/parser/elements.hxx> #include <cxx/parser/type-processor.hxx> @@ -11,6 +11,8 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Parser @@ -23,14 +25,14 @@ namespace CXX { Type (SemanticGraph::Schema& schema, TypeMap::Namespaces& type_map, - Boolean add_includes) + bool add_includes) : schema_ (schema), type_map_ (type_map), add_includes_ (add_includes) { } - virtual Void + virtual void traverse (SemanticGraph::Type& type) { using TypeMap::Namespace; @@ -48,7 +50,7 @@ namespace CXX // match the type in order to add include directives to the // new root schema. // - Boolean set (true); + bool set (true); if (tc.count ("p:ret-type")) { @@ -69,12 +71,12 @@ namespace CXX // std::wcerr << "traversing: " << ns_name << "#" << t_name << endl; - for (Namespaces::ConstIterator n (type_map_.begin ()); + for (Namespaces::const_iterator n (type_map_.begin ()); n != type_map_.end (); ++n) { // Check if the namespace matches. // - Boolean ns_match; + bool ns_match; if (!n->xsd_name ().empty ()) { @@ -135,7 +137,7 @@ namespace CXX arg_type = ret_type; else { - WideChar last (ret_type[ret_type.size () - 1]); + wchar_t last (ret_type[ret_type.size () - 1]); // If it is already a pointer or reference then use // it as is. @@ -162,7 +164,7 @@ namespace CXX { if (n->includes_begin () != n->includes_end ()) { - typedef Cult::Containers::Set<String> Includes; + typedef std::set<String> Includes; SemanticGraph::Context& sc (schema_.context ()); @@ -189,14 +191,14 @@ namespace CXX private: SemanticGraph::Schema& schema_; TypeMap::Namespaces& type_map_; - Boolean add_includes_; + bool add_includes_; }; // // struct BaseType: Traversal::Complex { - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { Complex::inherits (c); @@ -214,8 +216,8 @@ namespace CXX { GlobalType (SemanticGraph::Schema& schema, TypeMap::Namespaces& type_map, - Boolean add_includes, - Boolean tiein) + bool add_includes, + bool tiein) : type_ (schema, type_map, add_includes) { inherits_ >> type_; @@ -231,20 +233,20 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { type_.traverse (t); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { type_.traverse (l); Traversal::List::argumented (l, argumented_); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { type_.traverse (c); @@ -253,7 +255,7 @@ namespace CXX Complex::names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { type_.traverse (e); @@ -272,12 +274,12 @@ namespace CXX Traversal::Argumented argumented_; }; - Void + void process_impl (options const& ops, XSDFrontend::SemanticGraph::Schema& tu, TypeMap::Namespaces& type_map) { - Boolean tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()); + bool tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()); if (tu.names_begin ()->named ().name () == L"http://www.w3.org/2001/XMLSchema") @@ -300,7 +302,7 @@ namespace CXX // If --extern-xml-schema is specified, then we don't want // includes from the XML Schema type map. // - Boolean extern_xml_schema (ops.extern_xml_schema ()); + bool extern_xml_schema (ops.extern_xml_schema ()); // Besides types defined in this schema, also process those // referenced by global elements in case we are generating @@ -341,7 +343,7 @@ namespace CXX } } - Void TypeProcessor:: + void TypeProcessor:: process (options const& ops, XSDFrontend::SemanticGraph::Schema& s, TypeMap::Namespaces& tm) diff --git a/xsde/cxx/parser/type-processor.hxx b/xsde/cxx/parser/type-processor.hxx index de16a82..a3ccbf9 100644 --- a/xsde/cxx/parser/type-processor.hxx +++ b/xsde/cxx/parser/type-processor.hxx @@ -6,24 +6,20 @@ #ifndef CXX_PARSER_TYPE_PROCESSOR_HXX #define CXX_PARSER_TYPE_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <type-map/type-map.hxx> - #include <cxx/parser/options.hxx> namespace CXX { namespace Parser { - using namespace Cult::Types; - class TypeProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, TypeMap::Namespaces&); diff --git a/xsde/cxx/parser/validator.cxx b/xsde/cxx/parser/validator.cxx index bf5dffb..636dba4 100644 --- a/xsde/cxx/parser/validator.cxx +++ b/xsde/cxx/parser/validator.cxx @@ -3,6 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <set> +#include <iostream> + #include <cxx/parser/validator.hxx> #include <xsd-frontend/semantic-graph.hxx> @@ -10,9 +13,7 @@ #include <cxx/parser/elements.hxx> -#include <iostream> - -using std::wcerr; +using namespace std; namespace CXX { @@ -27,7 +28,7 @@ namespace CXX SemanticGraph::Path const& path, Parser::options const& options, const WarningSet& disabled_warnings, - Boolean& valid_) + bool& valid_) : Context (std::wcerr, root, path, options, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), @@ -40,8 +41,8 @@ namespace CXX } public: - Boolean - is_disabled (Char const* w) + bool + is_disabled (char const* w) { return disabled_warnings_all_ || disabled_warnings_.find (w) != disabled_warnings_.end (); @@ -76,10 +77,10 @@ namespace CXX protected: const WarningSet& disabled_warnings_; - Boolean disabled_warnings_all_; - Boolean& valid; - Boolean& subst_group_warning_issued; - Boolean subst_group_warning_issued_; + bool disabled_warnings_all_; + bool& valid; + bool& subst_group_warning_issued; + bool subst_group_warning_issued_; }; // @@ -100,18 +101,18 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Any; - Boolean q (e.qualified_p ()); + bool q (e.qualified_p ()); String ns (q ? e.namespace_ ().name () : ""); for (Any::NamespaceIterator i (any_.namespace_begin ()); i != any_.namespace_end (); ++i) { - Boolean failed (false); + bool failed (false); if (*i == L"##any") { @@ -184,14 +185,14 @@ namespace CXX { } - virtual Void + virtual void post (Type& c) { // Go down the inheritance hierarchy. // if (down_) { - Boolean up = up_; + bool up = up_; up_ = false; if (c.inherits_p ()) @@ -204,7 +205,7 @@ namespace CXX // if (up_) { - Boolean down = down_; + bool down = down_; down_ = false; for (Type::BegetsIterator i (c.begets_begin ()); @@ -218,10 +219,10 @@ namespace CXX } private: - Boolean up_, down_; + bool up_, down_; }; - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Compositor; @@ -279,7 +280,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -325,7 +326,7 @@ namespace CXX Complex::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -334,7 +335,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("P002")) @@ -358,7 +359,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -378,7 +379,7 @@ namespace CXX } private: - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -399,12 +400,12 @@ namespace CXX // struct AnonymousMember: protected ValidationContext { - AnonymousMember (ValidationContext& c, Boolean& error_issued) + AnonymousMember (ValidationContext& c, bool& error_issued) : ValidationContext (c), error_issued_ (error_issued) { } - Boolean + bool traverse_common (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -446,18 +447,18 @@ namespace CXX } private: - Boolean& error_issued_; + bool& error_issued_; }; struct AnonymousElement: Traversal::Element, AnonymousMember { - AnonymousElement (ValidationContext& c, Boolean& error_issued) + AnonymousElement (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (traverse_common (e)) @@ -477,12 +478,12 @@ namespace CXX struct AnonymousAttribute: Traversal::Attribute, AnonymousMember { - AnonymousAttribute (ValidationContext& c, Boolean& error_issued) + AnonymousAttribute (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (Type& a) { if (traverse_common (a)) @@ -521,9 +522,9 @@ namespace CXX } private: - Boolean error_issued_; + bool error_issued_; - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -547,7 +548,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!valid) @@ -590,14 +591,14 @@ namespace CXX }; } - Boolean Validator:: + bool Validator:: validate (options const& ops, SemanticGraph::Schema& root, SemanticGraph::Path const& path, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings) { - Boolean valid (true); + bool valid (true); ValidationContext ctx (root, path, ops, disabled_warnings, valid); // @@ -624,9 +625,9 @@ namespace CXX // // { - Boolean ref (ops.root_element_first ()); - Boolean rel (ops.root_element_last ()); - Boolean re (ops.root_element ()); + bool ref (ops.root_element_first ()); + bool rel (ops.root_element_last ()); + bool re (ops.root_element ()); if ((ref && rel) || (ref && re) || (rel && re)) { diff --git a/xsde/cxx/parser/validator.hxx b/xsde/cxx/parser/validator.hxx index 2cd7931..c17c048 100644 --- a/xsde/cxx/parser/validator.hxx +++ b/xsde/cxx/parser/validator.hxx @@ -6,28 +6,25 @@ #ifndef CXX_PARSER_VALIDATOR_HXX #define CXX_PARSER_VALIDATOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph/schema.hxx> #include <cxx/parser/options.hxx> #include <xsde.hxx> +#include <types.hxx> namespace CXX { namespace Parser { - using namespace Cult::Types; - class Validator { public: - Boolean + bool validate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& tu, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings); }; } |