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/serializer | |
parent | b2efa0d81f7e28017789082138cb547e6bea4028 (diff) |
Get rid of dependency on libcult
Diffstat (limited to 'xsde/cxx/serializer')
29 files changed, 626 insertions, 640 deletions
diff --git a/xsde/cxx/serializer/attribute-validation-source.cxx b/xsde/cxx/serializer/attribute-validation-source.cxx index 699d4c9..f66eff0 100644 --- a/xsde/cxx/serializer/attribute-validation-source.cxx +++ b/xsde/cxx/serializer/attribute-validation-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& ns (a.definition_namespace ().name ()); @@ -97,7 +97,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (ename (a)); @@ -230,7 +230,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << "while (this->" << enext (a) << " ())" @@ -394,7 +394,7 @@ namespace CXX names_attribute_ >> attribute_; } - virtual Void + virtual void traverse (Type& c) { if (!has<Traversal::Attribute> (c) && @@ -404,7 +404,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> ()); @@ -447,7 +447,7 @@ namespace CXX }; } - Void + void generate_attribute_validation_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/serializer/attribute-validation-source.hxx b/xsde/cxx/serializer/attribute-validation-source.hxx index 94b7617..5951262 100644 --- a/xsde/cxx/serializer/attribute-validation-source.hxx +++ b/xsde/cxx/serializer/attribute-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_attribute_validation_source (Context&); } } diff --git a/xsde/cxx/serializer/driver-source.cxx b/xsde/cxx/serializer/driver-source.cxx index 3ec2207..6f609c2 100644 --- a/xsde/cxx/serializer/driver-source.cxx +++ b/xsde/cxx/serializer/driver-source.cxx @@ -3,15 +3,16 @@ // 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/serializer/driver-source.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 { @@ -19,11 +20,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. @@ -37,7 +35,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -49,7 +47,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -144,7 +142,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -156,7 +154,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -170,7 +168,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -192,13 +190,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"); @@ -206,7 +204,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -214,79 +212,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"); @@ -294,19 +292,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"); @@ -314,49 +312,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"); @@ -365,7 +363,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -374,19 +372,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"); @@ -394,7 +392,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -402,13 +400,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"); @@ -417,55 +415,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"); @@ -473,20 +471,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 ()) @@ -504,7 +502,7 @@ namespace CXX String base_name (escape (raw_name + L"_s")); 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; @@ -542,12 +540,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_) @@ -560,17 +558,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_) @@ -583,7 +581,7 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct ArgList : Traversal::Complex, @@ -607,7 +605,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -619,7 +617,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!first_) @@ -643,7 +641,7 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; + bool first_; }; struct SerializerConnect: Traversal::List, @@ -673,7 +671,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (type_set_.find (&l) == type_set_.end ()) @@ -686,7 +684,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (type_set_.find (&c) == type_set_.end ()) @@ -715,7 +713,7 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -738,7 +736,7 @@ namespace CXX private: TypeInstanceMap& map_; - Cult::Containers::Set<SemanticGraph::Type*> type_set_; + set<SemanticGraph::Type*> type_set_; BaseType base_; Traversal::Inherits inherits_; @@ -761,7 +759,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options.root_element_first ()) @@ -783,7 +781,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/serializer/driver-source.hxx b/xsde/cxx/serializer/driver-source.hxx index f96b4b8..5f87857 100644 --- a/xsde/cxx/serializer/driver-source.hxx +++ b/xsde/cxx/serializer/driver-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_driver_source (Context&); } } diff --git a/xsde/cxx/serializer/element-validation-source.cxx b/xsde/cxx/serializer/element-validation-source.cxx index 4be8db9..329c7b9 100644 --- a/xsde/cxx/serializer/element-validation-source.cxx +++ b/xsde/cxx/serializer/element-validation-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (a.definition_namespace ().name ()); @@ -98,12 +98,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. // - UnsignedLong min (a.min ()); + size_t min (a.min ()); if (min == 0) os << "if (this->" << epresent (a) << " ())" @@ -122,12 +122,12 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -234,10 +234,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -312,10 +312,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& name (ename (e)); @@ -351,7 +351,7 @@ namespace CXX String const& arg (arg_type (e.type ())); String fq_type (fq_name (e.type ())); - Boolean poly (poly_code && !anonymous (e.type ())); + bool poly (poly_code && !anonymous (e.type ())); String inst (poly ? String (L"s") : L"this->" + emember (e)); if (poly) @@ -613,10 +613,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min == 0 && max == 1) { @@ -833,7 +833,7 @@ namespace CXX contains_particle_ >> particle_; } - virtual Void + virtual void traverse (Type& c) { if (!has<Traversal::Element> (c) && @@ -843,7 +843,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> ()); @@ -888,7 +888,7 @@ namespace CXX }; } - Void + void generate_element_validation_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/serializer/element-validation-source.hxx b/xsde/cxx/serializer/element-validation-source.hxx index 55c9b3f..b2c24e2 100644 --- a/xsde/cxx/serializer/element-validation-source.hxx +++ b/xsde/cxx/serializer/element-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_element_validation_source (Context&); } } diff --git a/xsde/cxx/serializer/elements.cxx b/xsde/cxx/serializer/elements.cxx index 7cbdbcf..061a1ae 100644 --- a/xsde/cxx/serializer/elements.cxx +++ b/xsde/cxx/serializer/elements.cxx @@ -197,7 +197,7 @@ namespace CXX return t.context ().get<String> ("s:impl"); } - Boolean Context:: + bool Context:: has_facets (SemanticGraph::Complex& c) { if (validation && restriction_p (c)) @@ -257,20 +257,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/serializer/elements.hxx b/xsde/cxx/serializer/elements.hxx index 694abd8..65a7c00 100644 --- a/xsde/cxx/serializer/elements.hxx +++ b/xsde/cxx/serializer/elements.hxx @@ -92,7 +92,7 @@ namespace CXX } public: - Boolean + bool restriction_p (SemanticGraph::Complex& c) const { if (c.inherits_p () && @@ -177,7 +177,7 @@ namespace CXX eimpl (SemanticGraph::Type&); public: - Boolean + bool has_facets (SemanticGraph::Complex& c); public: @@ -188,14 +188,14 @@ namespace CXX String& complex_base; String& serializer_map; - Boolean validation; - Boolean exceptions; - Boolean stl; - Boolean poly_code; - Boolean poly_runtime; - Boolean reset; - Boolean mixin; - Boolean tiein; + bool validation; + bool exceptions; + bool stl; + bool poly_code; + bool poly_runtime; + bool reset; + bool mixin; + bool tiein; Regex const* hxx_expr; Regex const* ixx_expr; @@ -227,13 +227,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_); @@ -241,74 +241,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_; }; @@ -317,12 +317,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 ()) @@ -330,7 +330,7 @@ namespace CXX } private: - Boolean& result_; + bool& result_; }; @@ -339,9 +339,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), @@ -350,12 +350,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 ())) @@ -384,15 +384,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), @@ -400,12 +400,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) @@ -428,16 +428,16 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool* result_; }; struct SerializerParamDecl : Traversal::Complex, Traversal::List, Context { - SerializerParamDecl (Context& c, Boolean name_arg, Boolean poly) + SerializerParamDecl (Context& c, bool name_arg, bool poly) : Context (c), particle_ (c, first_, name_arg, poly), attribute_ (c, first_, name_arg), @@ -456,7 +456,7 @@ namespace CXX names_ >> attribute_; } - SerializerParamDecl (Context& c, Boolean* result, Boolean poly) + SerializerParamDecl (Context& c, bool* result, bool poly) : Context (c), particle_ (c, result, poly), attribute_ (c, result), @@ -473,7 +473,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -485,7 +485,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -521,20 +521,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 SerializerParamTest { - SerializerParamTest (Context& c, Boolean& result, Boolean poly) + SerializerParamTest (Context& c, bool& result, bool poly) : impl_ (c, &result, poly) { } - Void + void traverse (SemanticGraph::Complex& c) { impl_.traverse (c); @@ -548,16 +548,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, @@ -579,20 +579,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: @@ -615,7 +615,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options_.root_element_first ()) diff --git a/xsde/cxx/serializer/generator.cxx b/xsde/cxx/serializer/generator.cxx index 479293c..1b1a468 100644 --- a/xsde/cxx/serializer/generator.cxx +++ b/xsde/cxx/serializer/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> @@ -68,7 +65,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" @@ -89,7 +86,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" @@ -99,7 +96,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 serializer implementation was generated by CodeSynthesis XSD/e,\n" @@ -108,14 +105,14 @@ namespace CXX "//\n\n"; } - Void Serializer::Generator:: + void Serializer::Generator:: usage () { CXX::Serializer::options::print_usage (wcout); CXX::options::print_usage (wcout); } - Void Serializer::Generator:: + void Serializer::Generator:: process_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -127,7 +124,7 @@ namespace CXX namespace { template <typename S> - Void + void open (S& ifs, NarrowString const& path) { try @@ -152,7 +149,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -172,7 +169,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def) @@ -188,13 +185,13 @@ namespace CXX } - UnsignedLong Serializer::Generator:: + size_t Serializer::Generator:: generate (Serializer::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) @@ -205,7 +202,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 @@ -221,8 +218,8 @@ namespace CXX } } - Boolean impl (!generate_xml_schema && ops.generate_empty_impl ()); - Boolean driver (gen_driver && !generate_xml_schema && + bool impl (!generate_xml_schema && ops.generate_empty_impl ()); + bool driver (gen_driver && !generate_xml_schema && ops.generate_test_driver ()); // Evaluate the graph for possibility of generating something useful. @@ -243,7 +240,7 @@ namespace CXX // // - Boolean validation (!ops.suppress_validation ()); + bool validation (!ops.suppress_validation ()); // Read-in type maps. // @@ -397,8 +394,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 ()); @@ -698,7 +695,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -741,7 +738,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/serializer/generator.hxx b/xsde/cxx/serializer/generator.hxx index e9601be..4df1540 100644 --- a/xsde/cxx/serializer/generator.hxx +++ b/xsde/cxx/serializer/generator.hxx @@ -6,14 +6,12 @@ #ifndef CXX_SERIALIZER_GENERATOR_HXX #define CXX_SERIALIZER_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> @@ -23,17 +21,15 @@ namespace CXX { namespace Serializer { - 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 +38,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/serializer/impl-header.cxx b/xsde/cxx/serializer/impl-header.cxx index 93cd982..bacfbc1 100644 --- a/xsde/cxx/serializer/impl-header.cxx +++ b/xsde/cxx/serializer/impl-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -71,7 +71,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -115,7 +115,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -155,7 +155,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -170,12 +170,12 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -198,10 +198,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -229,10 +229,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); if (min == 0 && max == 1) { @@ -254,10 +254,10 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min == 0 && max == 1) { @@ -302,7 +302,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.optional_p ()) @@ -319,7 +319,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << "virtual bool" << endl @@ -364,21 +364,21 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { // In case of an inheritance-by-restriction, we don't need to // generate serializer callbacks, etc. since they are the same // as in the base. We only need the serialization/validation code. // - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (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)); - 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)); String const& name (eimpl (c)); String const& arg (arg_type (c)); @@ -456,7 +456,7 @@ namespace CXX }; } - Void + void generate_impl_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/serializer/impl-header.hxx b/xsde/cxx/serializer/impl-header.hxx index ffbf761..8420ccc 100644 --- a/xsde/cxx/serializer/impl-header.hxx +++ b/xsde/cxx/serializer/impl-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_impl_header (Context&); } } diff --git a/xsde/cxx/serializer/impl-source.cxx b/xsde/cxx/serializer/impl-source.cxx index f03768d..33193fe 100644 --- a/xsde/cxx/serializer/impl-source.cxx +++ b/xsde/cxx/serializer/impl-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -99,7 +99,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -167,7 +167,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -223,7 +223,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -244,12 +244,12 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); SemanticGraph::Complex& t (scope (c)); String const& s (eimpl (t)); @@ -287,10 +287,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); String const& sc (eimpl (scope (s))); @@ -342,10 +342,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& s ( eimpl (dynamic_cast<SemanticGraph::Complex&> (e.scope ()))); @@ -381,10 +381,10 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); String const& s ( eimpl (dynamic_cast<SemanticGraph::Complex&> (a.scope ()))); @@ -449,7 +449,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& s ( @@ -475,7 +475,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& s ( @@ -535,10 +535,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& arg (arg_type (c)); @@ -634,7 +634,7 @@ namespace CXX }; } - Void + void generate_impl_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/serializer/impl-source.hxx b/xsde/cxx/serializer/impl-source.hxx index 0135c39..33376b3 100644 --- a/xsde/cxx/serializer/impl-source.hxx +++ b/xsde/cxx/serializer/impl-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_impl_source (Context&); } } diff --git a/xsde/cxx/serializer/name-processor.cxx b/xsde/cxx/serializer/name-processor.cxx index 6d60c37..dc24f91 100644 --- a/xsde/cxx/serializer/name-processor.cxx +++ b/xsde/cxx/serializer/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/serializer/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 { @@ -62,7 +64,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; @@ -83,18 +85,18 @@ 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. @@ -103,12 +105,12 @@ namespace CXX Traversal::Any, 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; @@ -126,7 +128,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -148,19 +150,19 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct PrimaryAttribute: Traversal::Attribute, Traversal::AnyAttribute, 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; @@ -180,7 +182,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { using SemanticGraph::AnyAttribute; @@ -202,7 +204,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; // Secondary names. @@ -214,12 +216,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; @@ -240,7 +242,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -261,7 +263,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -281,7 +283,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -303,7 +305,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryCompositor: Traversal::All, @@ -311,7 +313,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), @@ -320,7 +322,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} @@ -335,7 +337,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -388,7 +390,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { SemanticGraph::Context& sc (s.context ()); @@ -434,7 +436,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; ParticleTag particle_tag_; Traversal::ContainsParticle contain_particle_tag_; @@ -444,22 +446,22 @@ namespace CXX Traversal::Any, 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 ()); if (!restriction_) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& base (ec.get<String> ("s:name")); @@ -482,7 +484,7 @@ namespace CXX "xsd-frontend-restriction-correspondence")); SemanticGraph::Context& bc (b.context ()); - UnsignedLong min (b.min ()), max (b.max ()); + size_t min (b.min ()), max (b.max ()); if (min == 0 && max == 1) ec.set ("s:present", bc.get<String> ("s:present")); @@ -508,7 +510,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -517,7 +519,7 @@ namespace CXX if (!restriction_) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); String const& base (ac.get<String> ("s:name")); if (min == 0 && max == 1) @@ -537,7 +539,7 @@ namespace CXX *ac.get<Any*> ("xsd-frontend-restriction-correspondence")); SemanticGraph::Context& bc (b.context ()); - UnsignedLong min (b.min ()), max (b.max ()); + size_t min (b.min ()), max (b.max ()); if (min == 0 && max == 1) { @@ -563,19 +565,19 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryAttribute: Traversal::Attribute, Traversal::AnyAttribute, 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; @@ -606,7 +608,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { using SemanticGraph::AnyAttribute; @@ -634,7 +636,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; // @@ -646,7 +648,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -668,7 +670,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 ()) { @@ -762,7 +764,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { String const& n (t.name ()); @@ -793,7 +795,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -889,13 +891,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"); @@ -903,7 +905,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set_names (t, "boolean"); @@ -911,79 +913,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"); @@ -991,19 +993,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"); @@ -1011,49 +1013,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"); @@ -1062,7 +1064,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set_names (t, "qname"); @@ -1071,19 +1073,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"); @@ -1091,7 +1093,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set_names (t, "uri"); @@ -1099,13 +1101,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"); @@ -1114,55 +1116,55 @@ 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"); @@ -1170,13 +1172,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"); @@ -1195,12 +1197,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::serializer::validating::" : L"::xsde::cxx::serializer::non_validating::"; @@ -1226,7 +1228,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -1238,7 +1240,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1250,7 +1252,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1268,7 +1270,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1281,11 +1283,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); @@ -1379,11 +1381,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/serializer/name-processor.hxx b/xsde/cxx/serializer/name-processor.hxx index b170705..6a33fe8 100644 --- a/xsde/cxx/serializer/name-processor.hxx +++ b/xsde/cxx/serializer/name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_SERIALIZER_NAME_PROCESSOR_HXX #define CXX_SERIALIZER_NAME_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <cxx/serializer/options.hxx> namespace CXX { namespace Serializer { - 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/serializer/options.cli b/xsde/cxx/serializer/options.cli index ddb6c60..e4e35a1 100644 --- a/xsde/cxx/serializer/options.cli +++ b/xsde/cxx/serializer/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>. @@ -105,7 +103,7 @@ namespace CXX implementation." }; - Cult::Types::NarrowString --root-element + NarrowString --root-element { "<element>", "Indicate that <element> is the document root. This information is @@ -114,21 +112,21 @@ namespace CXX // Suffixes. // - Cult::Types::NarrowString --skel-type-suffix = "_sskel" + NarrowString --skel-type-suffix = "_sskel" { "<suffix>", "Use the provided <suffix> instead of the default \cb{_sskel} to construct the names of generated serializer skeletons." }; - Cult::Types::NarrowString --skel-file-suffix = "-sskel" + NarrowString --skel-file-suffix = "-sskel" { "<suffix>", "Use the provided <suffix> instead of the default \cb{-sskel} to construct the names of generated serializer skeleton files." }; - Cult::Types::NarrowString --impl-type-suffix = "_simpl" + NarrowString --impl-type-suffix = "_simpl" { "<suffix>", "Use the provided <suffix> instead of the default \cb{_simpl} to @@ -136,7 +134,7 @@ namespace CXX XML Schema types and sample serializer implementations." }; - Cult::Types::NarrowString --impl-file-suffix = "-simpl" + NarrowString --impl-file-suffix = "-simpl" { "<suffix>", "Use the provided <suffix> instead of the default \cb{-simpl} to diff --git a/xsde/cxx/serializer/serializer-forward.cxx b/xsde/cxx/serializer/serializer-forward.cxx index 1ee7f9a..076eb97 100644 --- a/xsde/cxx/serializer/serializer-forward.cxx +++ b/xsde/cxx/serializer/serializer-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_serializer_forward (Context& ctx) { ctx.os << "// Forward declarations" << endl diff --git a/xsde/cxx/serializer/serializer-forward.hxx b/xsde/cxx/serializer/serializer-forward.hxx index c3cf17d..26b441d 100644 --- a/xsde/cxx/serializer/serializer-forward.hxx +++ b/xsde/cxx/serializer/serializer-forward.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_serializer_forward (Context&); } } diff --git a/xsde/cxx/serializer/serializer-header.cxx b/xsde/cxx/serializer/serializer-header.cxx index 930ce72..ef59c25 100644 --- a/xsde/cxx/serializer/serializer-header.cxx +++ b/xsde/cxx/serializer/serializer-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/serializer/serializer-header.hxx> +#include <set> -#include <cult/containers/set.hxx> +#include <cxx/serializer/serializer-header.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Serializer @@ -30,12 +32,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (max != 1 && min != 0) { @@ -55,10 +57,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (max != 1 && min != 0) { @@ -80,10 +82,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); if (max != 1 && min != 0) { @@ -102,10 +104,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min != 0 && !a.contained_particle ().compositor ().is_a< @@ -146,7 +148,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& ret (ret_type (a.type ())); @@ -181,7 +183,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { // pre @@ -196,14 +198,14 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { SemanticGraph::Type& t (e); traverse (t); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { SemanticGraph::Type& t (l); @@ -221,7 +223,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { SemanticGraph::Type& t (u); @@ -234,7 +236,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { SemanticGraph::Type& t (c); @@ -270,21 +272,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 @@ -371,8 +373,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) @@ -397,7 +398,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -517,7 +518,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -598,7 +599,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& p) { if (first_) @@ -610,7 +611,7 @@ namespace CXX } private: - Boolean first_; + bool first_; }; struct CompositorCallback: Traversal::All, @@ -623,7 +624,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context ().count ("xsd-frontend-restriction-correspondence")) @@ -641,7 +642,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) @@ -651,7 +652,7 @@ namespace CXX // Add the *_present callback if this is a restriction // of sequence to optional. // - UnsignedLong cmin (c.min ()), bmax (b->max ()); + size_t cmin (c.min ()), bmax (b->max ()); if (bmax != 1 && cmin == 0) { @@ -662,7 +663,7 @@ namespace CXX } else { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -699,7 +700,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Root compositor that models inheritance by extension @@ -713,8 +714,8 @@ namespace CXX // Add the *_present callback if this is a restriction // of sequence to optional. // - UnsignedLong smin (s.min ()); - UnsignedLong bmax (b->max ()); + size_t smin (s.min ()); + size_t bmax (b->max ()); if (bmax != 1 && smin == 0) { @@ -725,7 +726,7 @@ namespace CXX } else { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -754,7 +755,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (SemanticGraph::Element* b = correspondent (e)) @@ -771,7 +772,7 @@ namespace CXX } else { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); if (min == 0 && max == 1) { @@ -796,7 +797,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (SemanticGraph::Any* b = correspondent (a)) @@ -813,12 +814,12 @@ namespace CXX } else { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); // Generate pure virtual callbacks unless we are optional // or in choice. // - Boolean pv ( + bool pv ( min != 0 && !a.contained_particle ().compositor ().is_a< SemanticGraph::Choice> ()); @@ -867,7 +868,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.optional_p ()) @@ -886,7 +887,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << "virtual bool" << endl @@ -923,7 +924,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& serializer (eserializer (e)); @@ -948,7 +949,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "void" << endl @@ -967,7 +968,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String type (fq_name (e.type ())); @@ -989,7 +990,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << fq_name (a.type ()) << "* " << emember (a) << ";"; @@ -1039,7 +1040,7 @@ namespace CXX names_attribute_member_ >> attribute_member_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename (c)); @@ -1048,17 +1049,17 @@ namespace CXX // generate serializer callbacks, etc. since they are the same // as in the base. We only need the serialization/validation code. // - Boolean restriction (restriction_p (c)); - Boolean facets (has_facets (c)); + bool restriction (restriction_p (c)); + bool facets (has_facets (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)); - 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); @@ -1085,7 +1086,7 @@ namespace CXX // pre // String const& arg (arg_type (c)); - Boolean same (hb && arg == arg_type (c.inherits ().base ())); + bool same (hb && arg == arg_type (c.inherits ().base ())); if (same) { @@ -1164,7 +1165,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); SerializerParamTest test (*this, r, true); test.traverse (c); @@ -1408,13 +1409,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_); @@ -1422,7 +1423,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { gen_typedef (t, "bool"); @@ -1430,79 +1431,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"); @@ -1510,19 +1511,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"); @@ -1530,31 +1531,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 serialize individual @@ -1566,19 +1567,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_); @@ -1586,7 +1587,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { gen_typedef (t, qname_type_); @@ -1594,19 +1595,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 serialize individual items. @@ -1619,7 +1620,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_typedef (t, string_type_); @@ -1627,13 +1628,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_); @@ -1642,55 +1643,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"); @@ -1698,18 +1699,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) @@ -1748,8 +1749,8 @@ namespace CXX String long_type_; String unsigned_long_type_; - Boolean idref_; - Boolean nmtoken_; + bool idref_; + bool nmtoken_; }; struct FundNamespace : Namespace, Context @@ -1896,8 +1897,8 @@ namespace CXX }; } - Void - generate_serializer_header (Context& ctx, Boolean generate_xml_schema) + void + generate_serializer_header (Context& ctx, bool generate_xml_schema) { NarrowString extern_xml_schema; @@ -1915,12 +1916,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("s:includes")) { - typedef Cult::Containers::Set<String> Includes; + typedef set<String> Includes; Includes& is ( ctx.schema_root.context ().get<Includes> ("s:includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; @@ -2007,12 +2008,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("s:includes")) { - typedef Cult::Containers::Set<String> Includes; + typedef set<String> Includes; Includes& is ( ctx.schema_root.context ().get<Includes> ("s: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/serializer/serializer-header.hxx b/xsde/cxx/serializer/serializer-header.hxx index bd359d3..5f98d26 100644 --- a/xsde/cxx/serializer/serializer-header.hxx +++ b/xsde/cxx/serializer/serializer-header.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Serializer { - Void - generate_serializer_header (Context&, Boolean generate_xml_schema); + void + generate_serializer_header (Context&, bool generate_xml_schema); } } diff --git a/xsde/cxx/serializer/serializer-inline.cxx b/xsde/cxx/serializer/serializer-inline.cxx index 9ef7fc0..47feafc 100644 --- a/xsde/cxx/serializer/serializer-inline.cxx +++ b/xsde/cxx/serializer/serializer-inline.cxx @@ -14,7 +14,7 @@ namespace CXX { namespace { - Void + void facet_calls (SemanticGraph::Complex& c, Context& ctx) { using SemanticGraph::Restricts; @@ -108,19 +108,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 ()); @@ -128,7 +128,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 @@ -182,8 +182,8 @@ namespace CXX } private: - Void - facet_calls (Type& e, UnsignedLong enum_count) + void + facet_calls (Type& e, size_t enum_count) { Serializer::facet_calls (e, *this); @@ -203,7 +203,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -271,7 +271,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { if (tiein) @@ -314,7 +314,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& scope (ename (e.scope ())); @@ -346,7 +346,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -365,12 +365,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_) @@ -383,7 +383,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; }; struct AttributeMemberSet: Traversal::Attribute, Context @@ -393,7 +393,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "this->" << emember (a) << " = &" << ename (a) << ";"; @@ -404,13 +404,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_); @@ -422,7 +422,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -436,19 +436,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_) @@ -466,17 +466,17 @@ namespace CXX } 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_) @@ -487,14 +487,14 @@ namespace CXX os << emember (a) << " (0)"; } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; @@ -545,14 +545,14 @@ namespace CXX contains_particle_set_poly_ >> particle_set_poly_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean he (has<Traversal::Element> (c)); - Boolean ha (has<Traversal::Attribute> (c)); - Boolean restriction (restriction_p (c)); - Boolean facets (has_facets (c)); + bool hb (c.inherits_p ()); + bool he (has<Traversal::Element> (c)); + bool ha (has<Traversal::Attribute> (c)); + bool restriction (restriction_p (c)); + bool facets (has_facets (c)); if (!(tiein || facets || (!restriction && (he || ha)))) return; @@ -601,7 +601,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); SerializerParamTest test (*this, r, true); test.traverse (c); @@ -647,7 +647,7 @@ namespace CXX if (tiein || (!restriction && (he || ha))) os << ": "; - Boolean comma (false); + bool comma (false); if (hb && tiein) { @@ -717,7 +717,7 @@ namespace CXX os << " " << etiein (c) << " (impl)"; - Boolean comma (true); + bool comma (true); if (!restriction && (he || ha)) { @@ -794,7 +794,7 @@ namespace CXX }; } - Void + void generate_serializer_inline (Context& ctx) { // Emit "weak" header includes that are used in the file-per-type diff --git a/xsde/cxx/serializer/serializer-inline.hxx b/xsde/cxx/serializer/serializer-inline.hxx index 4fdbcbc..370772a 100644 --- a/xsde/cxx/serializer/serializer-inline.hxx +++ b/xsde/cxx/serializer/serializer-inline.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_serializer_inline (Context&); } } diff --git a/xsde/cxx/serializer/serializer-source.cxx b/xsde/cxx/serializer/serializer-source.cxx index 227005d..70d0235 100644 --- a/xsde/cxx/serializer/serializer-source.cxx +++ b/xsde/cxx/serializer/serializer-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/serializer/serializer-source.hxx> +#include <set> -#include <cult/containers/set.hxx> +#include <cxx/serializer/serializer-source.hxx> #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Serializer @@ -30,12 +32,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min != 0) { @@ -71,10 +73,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (max != 1 && min != 0) { @@ -120,10 +122,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& impl ( etiein (dynamic_cast<SemanticGraph::Type&> (e.scope ()))); @@ -155,10 +157,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min != 0 && !a.contained_particle ().compositor ().is_a< @@ -223,7 +225,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& ret (ret_type (a.type ())); @@ -270,7 +272,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { // pre @@ -290,14 +292,14 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { SemanticGraph::Type& t (e); traverse (t); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { SemanticGraph::Type& t (l); @@ -321,7 +323,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { SemanticGraph::Type& t (u); @@ -339,7 +341,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { SemanticGraph::Type& t (c); @@ -377,14 +379,14 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); String const& arg (arg_type (e)); SemanticGraph::Type& base (e.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); @@ -436,7 +438,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 @@ -487,7 +489,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 ()), @@ -498,7 +500,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); @@ -516,7 +518,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -758,7 +760,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -822,7 +824,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& m (emember (e)); @@ -849,7 +851,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& m (emember (a)); @@ -872,12 +874,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. // - UnsignedLong min (a.min ()); + size_t min (a.min ()); if (min == 0) os << "if (this->" << epresent (a) << " ())" @@ -898,12 +900,12 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () != c.contains_end ()) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0 && max == 1) { @@ -972,10 +974,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0 && max == 1) { @@ -1014,10 +1016,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& name (ename (e)); @@ -1039,7 +1041,7 @@ namespace CXX String const& arg (arg_type (e.type ())); String fq_type (fq_name (e.type ())); - Boolean poly (poly_code && !anonymous (e.type ())); + bool poly (poly_code && !anonymous (e.type ())); String inst (poly ? String (L"s") : L"this->" + emember (e)); if (poly) @@ -1295,10 +1297,10 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min == 0 && max == 1) { @@ -1437,7 +1439,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (ename (a)); @@ -1566,7 +1568,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { os << "while (this->" << enext (a) << " ())" @@ -1699,7 +1701,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context ().count ("xsd-frontend-restriction-correspondence")) @@ -1733,13 +1735,13 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (SemanticGraph::Compositor* b = correspondent (c)) { - UnsignedLong smin (c.min ()); - UnsignedLong bmax (b->max ()); + size_t smin (c.min ()); + size_t bmax (b->max ()); if (bmax != 1 && smin == 0) { @@ -1768,7 +1770,7 @@ namespace CXX } else { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (min == 0) { @@ -1833,13 +1835,13 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (SemanticGraph::Compositor* b = correspondent (s)) { - UnsignedLong smin (s.min ()); - UnsignedLong bmax (b->max ()); + size_t smin (s.min ()); + size_t bmax (b->max ()); if (bmax != 1 && smin == 0) { @@ -1868,7 +1870,7 @@ namespace CXX } else { - UnsignedLong min (s.min ()), max (s.max ()); + size_t min (s.min ()), max (s.max ()); if (min == 0) { @@ -1940,7 +1942,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (SemanticGraph::Element* b = correspondent (e)) @@ -1970,7 +1972,7 @@ namespace CXX } else { - UnsignedLong min (e.min ()), max (e.max ()); + size_t min (e.min ()), max (e.max ()); String const& s (ename (e.scope ())); String impl; @@ -2034,7 +2036,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (SemanticGraph::Any* b = correspondent (a)) @@ -2064,7 +2066,7 @@ namespace CXX } else { - UnsignedLong min (a.min ()), max (a.max ()); + size_t min (a.min ()), max (a.max ()); if (min == 0 || a.contained_particle ().compositor ().is_a< @@ -2169,7 +2171,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& s (ename (a.scope ())); @@ -2215,7 +2217,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& s (ename (a.scope ())); @@ -2330,18 +2332,18 @@ namespace CXX names_attribute_ >> attribute_; } - 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)); - 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)); String const& arg (arg_type (c)); - Boolean same (hb && arg == arg_type (c.inherits ().base ())); + bool same (hb && arg == arg_type (c.inherits ().base ())); String const& name (ename (c)); @@ -2456,7 +2458,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 @@ -2515,7 +2517,7 @@ namespace CXX // Don't use restriction_p here since we don't want special // treatment of anyType. // - Boolean restriction ( + bool restriction ( hb && c.inherits ().is_a<SemanticGraph::Restricts> ()); // _serialize_attributes @@ -2641,7 +2643,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (e.substitutes_p ()) @@ -2680,7 +2682,7 @@ namespace CXX }; } - Void + void generate_serializer_source (Context& ctx) { if (ctx.tiein) diff --git a/xsde/cxx/serializer/serializer-source.hxx b/xsde/cxx/serializer/serializer-source.hxx index 6369182..71fd63e 100644 --- a/xsde/cxx/serializer/serializer-source.hxx +++ b/xsde/cxx/serializer/serializer-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Serializer { - Void + void generate_serializer_source (Context&); } } diff --git a/xsde/cxx/serializer/type-processor.cxx b/xsde/cxx/serializer/type-processor.cxx index c331309..16d5760 100644 --- a/xsde/cxx/serializer/type-processor.cxx +++ b/xsde/cxx/serializer/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/serializer/elements.hxx> #include <cxx/serializer/type-processor.hxx> @@ -11,6 +11,8 @@ #include <xsd-frontend/semantic-graph.hxx> #include <xsd-frontend/traversal.hxx> +using namespace std; + namespace CXX { namespace Serializer @@ -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 ("s: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,8 +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 ()); if (!sc.count ("s:includes")) @@ -189,14 +190,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::names (c); @@ -215,7 +216,7 @@ namespace CXX *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { type_.dispatch (c); @@ -238,8 +239,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), base_hierarchy_ (type_) { inherits_ >> type_; @@ -260,20 +261,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); @@ -282,7 +283,7 @@ namespace CXX Complex::names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { type_.traverse (e); @@ -301,12 +302,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") @@ -329,7 +330,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 @@ -370,7 +371,7 @@ namespace CXX } } - Void TypeProcessor:: + void TypeProcessor:: process (options const& ops, XSDFrontend::SemanticGraph::Schema& s, TypeMap::Namespaces& tm) diff --git a/xsde/cxx/serializer/type-processor.hxx b/xsde/cxx/serializer/type-processor.hxx index f0fceed..46c99da 100644 --- a/xsde/cxx/serializer/type-processor.hxx +++ b/xsde/cxx/serializer/type-processor.hxx @@ -6,24 +6,20 @@ #ifndef CXX_SERIALIZER_TYPE_PROCESSOR_HXX #define CXX_SERIALIZER_TYPE_PROCESSOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph.hxx> +#include <types.hxx> #include <type-map/type-map.hxx> - #include <cxx/serializer/options.hxx> namespace CXX { namespace Serializer { - using namespace Cult::Types; - class TypeProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, TypeMap::Namespaces&); diff --git a/xsde/cxx/serializer/validator.cxx b/xsde/cxx/serializer/validator.cxx index af4dfd1..492c192 100644 --- a/xsde/cxx/serializer/validator.cxx +++ b/xsde/cxx/serializer/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/serializer/validator.hxx> #include <xsd-frontend/semantic-graph.hxx> @@ -10,9 +13,7 @@ #include <cxx/serializer/elements.hxx> -#include <iostream> - -using std::wcerr; +using namespace std; namespace CXX { @@ -27,7 +28,7 @@ namespace CXX SemanticGraph::Path const& path, Serializer::options const& ops, const WarningSet& disabled_warnings, - Boolean& valid_) + bool& valid_) : Context (std::wcerr, root, path, ops, 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_; }; // @@ -97,7 +98,7 @@ namespace CXX *this >> schema_names_ >> ns_ >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -141,7 +142,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -150,7 +151,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("S001")) @@ -174,7 +175,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -194,7 +195,7 @@ namespace CXX } private: - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -208,12 +209,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 ()); @@ -255,18 +256,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)) @@ -286,12 +287,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)) @@ -330,9 +331,9 @@ namespace CXX } private: - Boolean error_issued_; + bool error_issued_; - Containers::Set<String> types_; + set<String> types_; Sources sources_; @@ -356,7 +357,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!valid) @@ -399,14 +400,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); // @@ -422,9 +423,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/serializer/validator.hxx b/xsde/cxx/serializer/validator.hxx index 601ada3..0e59b3d 100644 --- a/xsde/cxx/serializer/validator.hxx +++ b/xsde/cxx/serializer/validator.hxx @@ -6,28 +6,25 @@ #ifndef CXX_SERIALIZER_VALIDATOR_HXX #define CXX_SERIALIZER_VALIDATOR_HXX -#include <cult/types.hxx> - #include <xsd-frontend/semantic-graph/schema.hxx> -#include <cxx/serializer/options.hxx> - #include <xsde.hxx> +#include <types.hxx> + +#include <cxx/serializer/options.hxx> namespace CXX { namespace Serializer { - 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); }; } |