From 54110801525371740298d5cae378bfc778749935 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Jun 2012 11:50:03 +0200 Subject: Get rid of dependency on libcult --- xsd/cxx/parser/driver-source.cxx | 138 +++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 70 deletions(-) (limited to 'xsd/cxx/parser/driver-source.cxx') diff --git a/xsd/cxx/parser/driver-source.cxx b/xsd/cxx/parser/driver-source.cxx index 4d0294e..6a69442 100644 --- a/xsd/cxx/parser/driver-source.cxx +++ b/xsd/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 +#include +#include + #include #include #include #include -#include -#include - -#include +using namespace std; namespace CXX { @@ -20,11 +21,8 @@ namespace CXX { namespace { - typedef - Cult::Containers::Map - TypeInstanceMap; - - typedef Cult::Containers::Set InstanceSet; + typedef map TypeInstanceMap; + typedef set 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); @@ -47,7 +45,7 @@ namespace CXX names (c); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -130,7 +128,7 @@ namespace CXX names_ >> member_ >> belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -142,7 +140,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -156,7 +154,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -175,13 +173,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"); @@ -189,7 +187,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -197,79 +195,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"); @@ -277,19 +275,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"); @@ -297,49 +295,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"); @@ -348,7 +346,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -357,19 +355,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"); @@ -377,7 +375,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -385,13 +383,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"); @@ -400,55 +398,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"); @@ -456,20 +454,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 ()) @@ -487,7 +485,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; @@ -527,7 +525,7 @@ namespace CXX names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -536,7 +534,7 @@ namespace CXX names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!first_) @@ -547,7 +545,7 @@ namespace CXX os << map_[&l.argumented ().type ()]; } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { if (skip (m)) @@ -567,7 +565,7 @@ namespace CXX Traversal::Inherits inherits_; Traversal::Names names_; - Boolean first_; + bool first_; }; struct ParserConnect: Traversal::List, @@ -585,7 +583,7 @@ namespace CXX names_ >> member_ >> belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (type_set_.find (&l) == type_set_.end ()) @@ -598,7 +596,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (type_set_.find (&c) == type_set_.end ()) @@ -624,7 +622,7 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -647,7 +645,7 @@ namespace CXX private: TypeInstanceMap& map_; - Cult::Containers::Set type_set_; + set type_set_; BaseType base_; Traversal::Inherits inherits_; @@ -658,7 +656,7 @@ namespace CXX }; } - Void + void generate_driver_source (Context& ctx) { // Figure out the root element. Validator should have made sure -- cgit v1.1