From 973221821ac8e20da4eadbf4ad552f686b1ace48 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Jun 2012 15:07:35 +0200 Subject: Get rid of dependency on libcult --- xsde/cxx/elements.cxx | 190 +++++----- xsde/cxx/elements.hxx | 194 +++++----- xsde/cxx/hybrid/aggregate-elements.hxx | 8 +- xsde/cxx/hybrid/aggregate-include.hxx | 24 +- xsde/cxx/hybrid/default-value.cxx | 126 +++---- xsde/cxx/hybrid/default-value.hxx | 84 ++--- xsde/cxx/hybrid/elements.cxx | 32 +- xsde/cxx/hybrid/elements.hxx | 397 ++++++++++----------- xsde/cxx/hybrid/extraction-header.cxx | 24 +- xsde/cxx/hybrid/extraction-header.hxx | 2 +- xsde/cxx/hybrid/extraction-source.cxx | 62 ++-- xsde/cxx/hybrid/extraction-source.hxx | 2 +- xsde/cxx/hybrid/generator.cxx | 98 +++-- xsde/cxx/hybrid/generator.hxx | 29 +- xsde/cxx/hybrid/insertion-header.cxx | 24 +- xsde/cxx/hybrid/insertion-header.hxx | 2 +- xsde/cxx/hybrid/insertion-source.cxx | 40 +-- xsde/cxx/hybrid/insertion-source.hxx | 2 +- xsde/cxx/hybrid/options.cli | 68 ++-- xsde/cxx/hybrid/parser-aggregate-header.cxx | 128 +++---- xsde/cxx/hybrid/parser-aggregate-header.hxx | 2 +- xsde/cxx/hybrid/parser-aggregate-source.cxx | 75 ++-- xsde/cxx/hybrid/parser-aggregate-source.hxx | 2 +- xsde/cxx/hybrid/parser-header.cxx | 44 +-- xsde/cxx/hybrid/parser-header.hxx | 2 +- xsde/cxx/hybrid/parser-name-processor.cxx | 82 ++--- xsde/cxx/hybrid/parser-name-processor.hxx | 9 +- xsde/cxx/hybrid/parser-source.cxx | 62 ++-- xsde/cxx/hybrid/parser-source.hxx | 2 +- xsde/cxx/hybrid/serializer-aggregate-header.cxx | 129 +++---- xsde/cxx/hybrid/serializer-aggregate-header.hxx | 2 +- xsde/cxx/hybrid/serializer-aggregate-source.cxx | 76 ++-- xsde/cxx/hybrid/serializer-aggregate-source.hxx | 2 +- xsde/cxx/hybrid/serializer-header.cxx | 46 +-- xsde/cxx/hybrid/serializer-header.hxx | 2 +- xsde/cxx/hybrid/serializer-name-processor.cxx | 77 ++-- xsde/cxx/hybrid/serializer-name-processor.hxx | 9 +- xsde/cxx/hybrid/serializer-source.cxx | 72 ++-- xsde/cxx/hybrid/serializer-source.hxx | 2 +- xsde/cxx/hybrid/tree-forward.cxx | 110 +++--- xsde/cxx/hybrid/tree-forward.hxx | 4 +- xsde/cxx/hybrid/tree-header.cxx | 208 +++++------ xsde/cxx/hybrid/tree-header.hxx | 2 +- xsde/cxx/hybrid/tree-inline.cxx | 66 ++-- xsde/cxx/hybrid/tree-inline.hxx | 2 +- xsde/cxx/hybrid/tree-name-processor.cxx | 299 ++++++++-------- xsde/cxx/hybrid/tree-name-processor.hxx | 9 +- xsde/cxx/hybrid/tree-size-processor.cxx | 248 +++++++------ xsde/cxx/hybrid/tree-size-processor.hxx | 11 +- xsde/cxx/hybrid/tree-source.cxx | 134 +++---- xsde/cxx/hybrid/tree-source.hxx | 2 +- xsde/cxx/hybrid/tree-type-map.cxx | 23 +- xsde/cxx/hybrid/tree-type-map.hxx | 8 +- xsde/cxx/hybrid/validator.cxx | 78 ++-- xsde/cxx/hybrid/validator.hxx | 11 +- xsde/cxx/options.cli | 78 ++-- xsde/cxx/parser/attribute-validation-source.cxx | 22 +- xsde/cxx/parser/attribute-validation-source.hxx | 2 +- xsde/cxx/parser/characters-validation-source.cxx | 4 +- xsde/cxx/parser/characters-validation-source.hxx | 2 +- xsde/cxx/parser/driver-source.cxx | 150 ++++---- xsde/cxx/parser/driver-source.hxx | 2 +- xsde/cxx/parser/element-validation-source.cxx | 194 +++++----- xsde/cxx/parser/element-validation-source.hxx | 2 +- xsde/cxx/parser/elements.cxx | 8 +- xsde/cxx/parser/elements.hxx | 116 +++--- xsde/cxx/parser/generator.cxx | 41 +-- xsde/cxx/parser/generator.hxx | 19 +- xsde/cxx/parser/impl-header.cxx | 20 +- xsde/cxx/parser/impl-header.hxx | 2 +- xsde/cxx/parser/impl-source.cxx | 16 +- xsde/cxx/parser/impl-source.hxx | 2 +- xsde/cxx/parser/name-processor.cxx | 194 +++++----- xsde/cxx/parser/name-processor.hxx | 9 +- xsde/cxx/parser/options.cli | 16 +- xsde/cxx/parser/parser-forward.cxx | 10 +- xsde/cxx/parser/parser-forward.hxx | 2 +- xsde/cxx/parser/parser-header.cxx | 194 +++++----- xsde/cxx/parser/parser-header.hxx | 4 +- xsde/cxx/parser/parser-inline.cxx | 83 +++-- xsde/cxx/parser/parser-inline.hxx | 2 +- xsde/cxx/parser/parser-source.cxx | 76 ++-- xsde/cxx/parser/parser-source.hxx | 2 +- xsde/cxx/parser/print-impl-common.hxx | 118 +++--- xsde/cxx/parser/state-processor.cxx | 67 ++-- xsde/cxx/parser/state-processor.hxx | 7 +- xsde/cxx/parser/type-processor.cxx | 42 +-- xsde/cxx/parser/type-processor.hxx | 8 +- xsde/cxx/parser/validator.cxx | 79 ++-- xsde/cxx/parser/validator.hxx | 9 +- .../cxx/serializer/attribute-validation-source.cxx | 12 +- .../cxx/serializer/attribute-validation-source.hxx | 2 +- xsde/cxx/serializer/driver-source.cxx | 150 ++++---- xsde/cxx/serializer/driver-source.hxx | 2 +- xsde/cxx/serializer/element-validation-source.cxx | 30 +- xsde/cxx/serializer/element-validation-source.hxx | 2 +- xsde/cxx/serializer/elements.cxx | 8 +- xsde/cxx/serializer/elements.hxx | 118 +++--- xsde/cxx/serializer/generator.cxx | 41 +-- xsde/cxx/serializer/generator.hxx | 16 +- xsde/cxx/serializer/impl-header.cxx | 44 +-- xsde/cxx/serializer/impl-header.hxx | 2 +- xsde/cxx/serializer/impl-source.cxx | 34 +- xsde/cxx/serializer/impl-source.hxx | 2 +- xsde/cxx/serializer/name-processor.cxx | 208 +++++------ xsde/cxx/serializer/name-processor.hxx | 9 +- xsde/cxx/serializer/options.cli | 16 +- xsde/cxx/serializer/serializer-forward.cxx | 10 +- xsde/cxx/serializer/serializer-forward.hxx | 2 +- xsde/cxx/serializer/serializer-header.cxx | 219 ++++++------ xsde/cxx/serializer/serializer-header.hxx | 4 +- xsde/cxx/serializer/serializer-inline.cxx | 72 ++-- xsde/cxx/serializer/serializer-inline.hxx | 2 +- xsde/cxx/serializer/serializer-source.cxx | 130 +++---- xsde/cxx/serializer/serializer-source.hxx | 2 +- xsde/cxx/serializer/type-processor.cxx | 45 +-- xsde/cxx/serializer/type-processor.hxx | 8 +- xsde/cxx/serializer/validator.cxx | 63 ++-- xsde/cxx/serializer/validator.hxx | 13 +- 119 files changed, 3111 insertions(+), 3205 deletions(-) (limited to 'xsde/cxx') diff --git a/xsde/cxx/elements.cxx b/xsde/cxx/elements.cxx index e466ff1..07917e6 100644 --- a/xsde/cxx/elements.cxx +++ b/xsde/cxx/elements.cxx @@ -24,7 +24,7 @@ namespace CXX namespace { - WideChar const* keywords[] = { + wchar_t const* keywords[] = { L"NULL", L"and", L"asm", @@ -111,7 +111,7 @@ namespace CXX SemanticGraph::Schema& root, SemanticGraph::Path const& path, options_type const& ops, - Char const* name_key, + char const* name_key, NarrowString const& char_type__) : os (o), schema_root (root), @@ -204,7 +204,7 @@ namespace CXX // Split the string in two parts at the last '='. // - Size pos (s.rfind ('=')); + size_t pos (s.rfind ('=')); if (pos == String::npos) throw InvalidNamespaceMapping (s, "delimiter ('=') not found"); @@ -237,7 +237,7 @@ namespace CXX // Split the string in two parts at '='. // - Size pos (s.find ('=')); + size_t pos (s.find ('=')); if (pos == String::npos) reserved_name_map_[s] = L""; @@ -247,7 +247,7 @@ namespace CXX // Populate the keyword set. // - for (Size i (0); i < sizeof (keywords) / sizeof (char*); ++i) + for (size_t i (0); i < sizeof (keywords) / sizeof (char*); ++i) keyword_set_.insert (keywords[i]); } @@ -261,7 +261,7 @@ namespace CXX using SemanticGraph::Sources; String tmp; - MapMapping::ConstIterator i (nsm_mapping.find (ns.name ())); + MapMapping::const_iterator i (nsm_mapping.find (ns.name ())); if (i != nsm_mapping.end ()) { @@ -308,7 +308,7 @@ namespace CXX // Check cache first // - MappingCache::ConstIterator i (ns_mapping_cache.find (pair)); + MappingCache::const_iterator i (ns_mapping_cache.find (pair)); if (i != ns_mapping_cache.end ()) { @@ -321,10 +321,10 @@ namespace CXX if (trace) wcerr << "namespace: '" << pair << "'" << endl; - Boolean found (false); + bool found (false); Regex colon (L"#/#::#"); - for (RegexMapping::ConstReverseIterator e (nsr_mapping.rbegin ()); + for (RegexMapping::const_reverse_iterator e (nsr_mapping.rbegin ()); e != nsr_mapping.rend (); ++e) { if (trace) @@ -468,7 +468,7 @@ namespace CXX } String Context:: - fq_name (SemanticGraph::Nameable& n, Char const* name_key) const + fq_name (SemanticGraph::Nameable& n, char const* name_key) const { using namespace SemanticGraph; @@ -565,17 +565,17 @@ namespace CXX escape (String const& name) const { String r; - Size n (name.size ()); + size_t n (name.size ()); // In most common cases we will have that many chars. // r.reserve (n); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - Boolean first (i == 0); + bool first (i == 0); - UnsignedLong u (unicode_char (name, i)); // May advance i. + unsigned int u (unicode_char (name, i)); // May advance i. if (first) { @@ -591,7 +591,7 @@ namespace CXX u == '_')) r.push_back ('_'); else - r.push_back (static_cast (u)); + r.push_back (static_cast (u)); } if (r.empty ()) @@ -599,7 +599,7 @@ namespace CXX // Custom reserved words. // - ReservedNameMap::ConstIterator i (reserved_name_map.find (r)); + ReservedNameMap::const_iterator i (reserved_name_map.find (r)); if (i != reserved_name_map.end ()) { @@ -635,14 +635,14 @@ namespace CXX // String - charlit (UnsignedLong u) + charlit (unsigned int u) { String r ("\\x"); - Boolean lead (true); + bool lead (true); - for (Long i (7); i >= 0; --i) + for (int i (7); i >= 0; --i) { - UnsignedLong x ((u >> (i * 4)) & 0x0F); + unsigned int x ((u >> (i * 4)) & 0x0F); if (lead) { @@ -658,7 +658,7 @@ namespace CXX return r; } - const UnsignedLong utf8_first_char_mask[5] = + const unsigned int utf8_first_char_mask[5] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0 }; @@ -667,7 +667,7 @@ namespace CXX strlit_utf8 (String const& str) { String r; - Size n (str.size ()); + size_t n (str.size ()); // In most common cases we will have that many chars. // @@ -675,11 +675,11 @@ namespace CXX r += '"'; - Boolean escape (false); + bool escape (false); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - UnsignedLong u (Context::unicode_char (str, i)); // May advance i. + unsigned int u (Context::unicode_char (str, i)); // May advance i. // [128 - ] - UTF-8 // 127 - \x7F @@ -760,15 +760,15 @@ namespace CXX } default: { - r += static_cast (u); + r += static_cast (u); break; } } } else { - UnsignedLong count; - UnsignedLong tmp[4]; + unsigned int count; + unsigned int tmp[4]; if (u < 0x800) count = 2; @@ -800,7 +800,7 @@ namespace CXX } } - for (UnsignedLong j (0); j < count; ++j) + for (unsigned int j (0); j < count; ++j) r += charlit (tmp[j]); escape = true; @@ -816,7 +816,7 @@ namespace CXX strlit_iso8859_1 (String const& str) { String r; - Size n (str.size ()); + size_t n (str.size ()); // In most common cases we will have that many chars. // @@ -824,11 +824,11 @@ namespace CXX r += '"'; - Boolean escape (false); + bool escape (false); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - UnsignedLong u (Context::unicode_char (str, i)); // May advance i. + unsigned int u (Context::unicode_char (str, i)); // May advance i. // [256 - ] - unrepresentable // [127 - 255] - \xXX @@ -909,7 +909,7 @@ namespace CXX } default: { - r += static_cast (u); + r += static_cast (u); break; } } @@ -936,7 +936,7 @@ namespace CXX strlit_utf32 (String const& str) { String r; - Size n (str.size ()); + size_t n (str.size ()); // In most common cases we will have that many chars. // @@ -944,11 +944,11 @@ namespace CXX r += '"'; - Boolean escape (false); + bool escape (false); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - UnsignedLong u (Context::unicode_char (str, i)); // May advance i. + unsigned int u (Context::unicode_char (str, i)); // May advance i. // [128 - ] - \xUUUUUUUU // 127 - \x7F @@ -1029,7 +1029,7 @@ namespace CXX } default: { - r += static_cast (u); + r += static_cast (u); break; } } @@ -1065,16 +1065,16 @@ namespace CXX { String r; - WideChar const* s (str.c_str ()); - Size size (str.size ()); + wchar_t const* s (str.c_str ()); + size_t size (str.size ()); // In most common cases we will have that many chars. // r.reserve (size); - for (WideChar const* p (s); p < s + size; ++p) + for (wchar_t const* p (s); p < s + size; ++p) { - UnsignedLong u (unicode_char (p)); // May advance p. + unsigned int u (unicode_char (p)); // May advance p. // We are going to treat \v, \f and \n as unrepresentable // here even though they can be present in C++ source code. @@ -1082,7 +1082,7 @@ namespace CXX if (u > 127 || (u < 32 && u != '\t')) r += L'?'; else - r += static_cast (u); + r += static_cast (u); } return r; @@ -1098,9 +1098,9 @@ namespace CXX wcerr << "include: '" << path << "'" << endl; String r; - Boolean found (false); + bool found (false); - for (RegexMapping::ConstReverseIterator e (include_mapping.rbegin ()); + for (RegexMapping::const_reverse_iterator e (include_mapping.rbegin ()); e != include_mapping.rend (); ++e) { if (trace) @@ -1127,8 +1127,8 @@ namespace CXX if (!r.empty () && r[0] != L'"' && r[0] != L'<') { - WideChar op (options.include_with_brackets () ? L'<' : L'"'); - WideChar cl (options.include_with_brackets () ? L'>' : L'"'); + wchar_t op (options.include_with_brackets () ? L'<' : L'"'); + wchar_t cl (options.include_with_brackets () ? L'>' : L'"'); r = op + r + cl; } @@ -1138,7 +1138,7 @@ namespace CXX // Namespace // - Void Namespace:: + void Namespace:: pre (Type& n) { String ns (ctx_.ns_name (n)); @@ -1173,7 +1173,7 @@ namespace CXX } while (true); } - Void Namespace:: + void Namespace:: post (Type& n) { String ns (ctx_.ns_name (n)); @@ -1214,14 +1214,14 @@ namespace CXX // LiteralValue // - Void LiteralValue:: + void LiteralValue:: normalize (String& s) { - Size n (s.size ()); + size_t n (s.size ()); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - WideChar& c (s[i]); + wchar_t& c (s[i]); if (c == 0x0D || // carriage return c == 0x09 || // tab @@ -1230,15 +1230,15 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: collapse (String& s) { - Size n (s.size ()), j (0); - Boolean subs (false), trim (true); + size_t n (s.size ()), j (0); + bool subs (false), trim (true); - for (Size i (0); i < n; ++i) + for (size_t i (0); i < n; ++i) { - WideChar c (s[i]); + wchar_t c (s[i]); if (c == 0x20 || c == 0x09 || c == 0x0A) subs = true; @@ -1262,21 +1262,21 @@ namespace CXX s.resize (j); } - Void LiteralValue:: + void LiteralValue:: strip_zeros (String& s) { - Size n (s.size ()), i (0); + size_t n (s.size ()), i (0); if (n > 0 && (s[i] == '-' || s[i] == '+')) i++; - Size j (i); + size_t j (i); - Boolean strip (true); + bool strip (true); for (; i < n; ++i) { - WideChar c (s[i]); + wchar_t c (s[i]); if (c == '0') { @@ -1298,7 +1298,7 @@ namespace CXX s.resize (j); } - Void LiteralValue:: + void LiteralValue:: make_float (String& s) { if (s.find ('.') == String::npos && @@ -1308,7 +1308,7 @@ namespace CXX } LiteralValue:: - LiteralValue (Context& c, Boolean str) + LiteralValue (Context& c, bool str) : Context (c), str_ (str) { } @@ -1322,7 +1322,7 @@ namespace CXX return literal_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::AnySimpleType&) { if (str_) @@ -1331,7 +1331,7 @@ namespace CXX // Boolean. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Boolean&) { collapse (value_); @@ -1340,7 +1340,7 @@ namespace CXX // Integral types. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Byte&) { collapse (value_); @@ -1348,7 +1348,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedByte&) { collapse (value_); @@ -1356,7 +1356,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Short&) { collapse (value_); @@ -1364,7 +1364,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedShort&) { collapse (value_); @@ -1372,7 +1372,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Int&) { collapse (value_); @@ -1380,7 +1380,7 @@ namespace CXX literal_ = value_; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedInt&) { collapse (value_); @@ -1388,7 +1388,7 @@ namespace CXX literal_ = value_ + L"U"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Long&) { collapse (value_); @@ -1397,7 +1397,7 @@ namespace CXX literal_ += long_long ? L"LL" : L"L"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::UnsignedLong&) { collapse (value_); @@ -1406,7 +1406,7 @@ namespace CXX literal_ += long_long ? L"ULL" : L"UL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Integer&) { collapse (value_); @@ -1414,7 +1414,7 @@ namespace CXX literal_ = value_ + L"L"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { collapse (value_); @@ -1422,7 +1422,7 @@ namespace CXX literal_ = value_ + L"L"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { collapse (value_); @@ -1430,7 +1430,7 @@ namespace CXX literal_ = value_ + L"UL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::PositiveInteger&) { collapse (value_); @@ -1438,7 +1438,7 @@ namespace CXX literal_ = value_ + L"UL"; } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NegativeInteger&) { collapse (value_); @@ -1448,7 +1448,7 @@ namespace CXX // Floats. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Float&) { collapse (value_); @@ -1473,7 +1473,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Double&) { collapse (value_); @@ -1498,7 +1498,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Decimal&) { collapse (value_); @@ -1509,14 +1509,14 @@ namespace CXX // Strings. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::String&) { if (str_) literal_ = strlit (value_); } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NormalizedString&) { if (str_) @@ -1526,7 +1526,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Token&) { if (str_) @@ -1536,7 +1536,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NameToken&) { if (str_) @@ -1546,7 +1546,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Name&) { if (str_) @@ -1556,7 +1556,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::NCName&) { if (str_) @@ -1566,7 +1566,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Language&) { if (str_) @@ -1579,7 +1579,7 @@ namespace CXX // ID/IDREF. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Id&) { if (str_) @@ -1589,7 +1589,7 @@ namespace CXX } } - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::IdRef&) { if (str_) @@ -1601,7 +1601,7 @@ namespace CXX // URI. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::AnyURI&) { if (str_) @@ -1613,7 +1613,7 @@ namespace CXX // Entity. // - Void LiteralValue:: + void LiteralValue:: traverse (SemanticGraph::Fundamental::Entity&) { if (str_) diff --git a/xsde/cxx/elements.hxx b/xsde/cxx/elements.hxx index 5dbb1cd..fb73960 100644 --- a/xsde/cxx/elements.hxx +++ b/xsde/cxx/elements.hxx @@ -6,15 +6,13 @@ #ifndef CXX_ELEMENTS_HXX #define CXX_ELEMENTS_HXX +#include +#include +#include #include #include -#include -#include -#include -#include - #include #include @@ -26,8 +24,6 @@ namespace CXX { using std::endl; - typedef WideString String; - // On some platforms std::toupper can be something other than a // function with C++ linkage. @@ -41,7 +37,7 @@ namespace CXX struct UnrepresentableCharacter { - UnrepresentableCharacter (String const& str, Size pos) + UnrepresentableCharacter (String const& str, size_t pos) : str_ (str), pos_ (pos) { } @@ -52,7 +48,7 @@ namespace CXX return str_; } - Size + size_t position () const { return pos_; @@ -60,14 +56,14 @@ namespace CXX private: String str_; - Size pos_; + size_t pos_; }; struct NoNamespaceMapping { NoNamespaceMapping (SemanticGraph::Path const& file, - UnsignedLong line, - UnsignedLong column, + size_t line, + size_t column, String const& ns) : file_ (file), line_ (line), @@ -82,13 +78,13 @@ namespace CXX return file_; } - UnsignedLong + size_t line () const { return line_; } - UnsignedLong + size_t column () const { return column_; @@ -102,8 +98,8 @@ namespace CXX private: SemanticGraph::Path file_; - UnsignedLong line_; - UnsignedLong column_; + size_t line_; + size_t column_; String ns_; }; @@ -140,12 +136,12 @@ namespace CXX public: typedef cutl::re::wregex RegexPat; typedef cutl::re::wregexsub Regex; - typedef Cult::Containers::Vector RegexMapping; - typedef Cult::Containers::Map MapMapping; - typedef Cult::Containers::Map MappingCache; + typedef std::vector RegexMapping; + typedef std::map MapMapping; + typedef std::map MappingCache; - typedef Cult::Containers::Map ReservedNameMap; - typedef Cult::Containers::Set KeywordSet; + typedef std::map ReservedNameMap; + typedef std::set KeywordSet; typedef CXX::options options_type; @@ -154,7 +150,7 @@ namespace CXX SemanticGraph::Schema& root, SemanticGraph::Path const& path, options_type const&, - Char const* name_key, + char const* name_key, NarrowString const& char_type); protected: @@ -224,11 +220,11 @@ namespace CXX // advanced by 1 if this Unicode character takes more than one // underlying character. // - static UnsignedLong - unicode_char (String const& str, Size& pos); + static unsigned int + unicode_char (String const& str, size_t& pos); - static UnsignedLong - unicode_char (WideChar const*& p); + static unsigned int + unicode_char (wchar_t const*& p); // Escape C++ keywords and illegal characters. // @@ -275,7 +271,7 @@ namespace CXX // Fully-qualified C++ name. // String - fq_name (SemanticGraph::Nameable& n, Char const* name_key = 0) const; + fq_name (SemanticGraph::Nameable& n, char const* name_key = 0) const; public: static SemanticGraph::Type& @@ -286,7 +282,7 @@ namespace CXX process_include_path (String const&) const; public: - static Boolean + static bool anonymous (SemanticGraph::Type& t) { return t.context ().count ("anonymous"); @@ -331,8 +327,8 @@ namespace CXX String& inst_exp; String& inl; - Boolean custom_alloc; - Boolean long_long; + bool custom_alloc; + bool long_long; public: MappingCache& ns_mapping_cache; @@ -374,16 +370,16 @@ namespace CXX KeywordSet keyword_set_; }; - inline UnsignedLong Context:: - unicode_char (String const& str, Size& pos) + inline unsigned int Context:: + unicode_char (String const& str, size_t& pos) { - if (sizeof (WideChar) == 4) + if (sizeof (wchar_t) == 4) { return str[pos]; } - else if (sizeof (WideChar) == 2) + else if (sizeof (wchar_t) == 2) { - WideChar x (str[pos]); + wchar_t x (str[pos]); if (x < 0xD800 || x > 0xDBFF) return x; @@ -394,16 +390,16 @@ namespace CXX return 0; } - inline UnsignedLong Context:: - unicode_char (WideChar const*& p) + inline unsigned int Context:: + unicode_char (wchar_t const*& p) { - if (sizeof (WideChar) == 4) + if (sizeof (wchar_t) == 4) { return *p; } - else if (sizeof (WideChar) == 2) + else if (sizeof (wchar_t) == 2) { - WideChar x (*p); + wchar_t x (*p); if (x < 0xD800 || x > 0xDBFF) return x; @@ -426,7 +422,7 @@ namespace CXX } private: - Cult::Containers::Set schemas_; + std::set schemas_; }; // Usual namespace mapping. @@ -438,10 +434,10 @@ namespace CXX virtual ~ScopeTracker () {} - virtual Void + virtual void enter (String const&) = 0; - virtual Void + virtual void leave () = 0; }; @@ -456,10 +452,10 @@ namespace CXX { } - virtual Void + virtual void pre (Type&); - virtual Void + virtual void post (Type&); private: @@ -473,30 +469,30 @@ namespace CXX template struct Has : X { - Has (Boolean& result) + Has (bool& result) : result_ (result) { } - virtual Void + virtual void traverse (typename X::Type&) { result_ = true; } private: - Boolean& result_; + bool& result_; }; // Checks if scope 'Y' names any of 'X' // template - Boolean + bool has (Y& y) { using SemanticGraph::Scope; - Boolean result (false); + bool result (false); Has t (result); for (Scope::NamesIterator i (y.names_begin ()), e (y.names_end ()); @@ -509,12 +505,12 @@ namespace CXX // Checks if the compositor has any particle of 'X' // template - Boolean + bool has_particle (SemanticGraph::Compositor& y) { using SemanticGraph::Compositor; - Boolean result (false); + bool result (false); Has t (result); for (Compositor::ContainsIterator i (y.contains_begin ()), @@ -534,7 +530,7 @@ namespace CXX // Specialization for Complex // template - Boolean + bool has_particle (SemanticGraph::Complex& c) { return c.contains_compositor_p () && @@ -553,61 +549,61 @@ namespace CXX Traversal::Fundamental::Id, Traversal::Fundamental::IdRef { - virtual Void + virtual void fundamental_type (SemanticGraph::Fundamental::Type& t) = 0; - virtual Void + virtual void fundamental_template (SemanticGraph::Fundamental::Type& t) = 0; - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Type& t) { fundamental_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { fundamental_template (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { fundamental_template (t); @@ -651,127 +647,127 @@ namespace CXX Context { - LiteralValue (Context&, Boolean str); + LiteralValue (Context&, bool str); String dispatch (SemanticGraph::Node& type, String const& value); - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&); // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&); // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&); // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&); // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&); // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&); // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&); // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&); public: - static Void + static void normalize (String&); - static Void + static void collapse (String&); - static Void + static void strip_zeros (String&); - static Void + static void make_float (String&); private: - Boolean str_; + bool str_; String value_; String literal_; }; diff --git a/xsde/cxx/hybrid/aggregate-elements.hxx b/xsde/cxx/hybrid/aggregate-elements.hxx index a7ac9c7..c73696e 100644 --- a/xsde/cxx/hybrid/aggregate-elements.hxx +++ b/xsde/cxx/hybrid/aggregate-elements.hxx @@ -6,7 +6,7 @@ #ifndef CXX_HYBRID_AGGREGATE_ELEMENTS_HXX #define CXX_HYBRID_AGGREGATE_ELEMENTS_HXX -#include +#include #include @@ -14,9 +14,7 @@ namespace CXX { namespace Hybrid { - typedef - Cult::Containers::Map - TypeInstanceMap; + typedef std::map TypeInstanceMap; struct InstanceInfo { @@ -24,7 +22,7 @@ namespace CXX String name; }; - typedef Cult::Containers::Map TypeIdInstanceMap; + typedef std::map TypeIdInstanceMap; } } diff --git a/xsde/cxx/hybrid/aggregate-include.hxx b/xsde/cxx/hybrid/aggregate-include.hxx index 03a5198..01ec3c9 100644 --- a/xsde/cxx/hybrid/aggregate-include.hxx +++ b/xsde/cxx/hybrid/aggregate-include.hxx @@ -6,7 +6,7 @@ #ifndef CXX_HYBRID_AGGREGATE_INCLUDE_HXX #define CXX_HYBRID_AGGREGATE_INCLUDE_HXX -#include +#include #include #include @@ -31,7 +31,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -71,7 +71,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (types_.find (&t) != types_.end ()) @@ -83,7 +83,7 @@ namespace CXX collect (t); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (types_.find (&c) != types_.end ()) @@ -104,7 +104,7 @@ namespace CXX } private: - virtual Void + virtual void collect (SemanticGraph::Type& t) { using SemanticGraph::Type; @@ -120,7 +120,7 @@ namespace CXX } } - virtual Void + virtual void emit (SemanticGraph::Type& t) { using SemanticGraph::Schema; @@ -173,8 +173,8 @@ namespace CXX } private: - Cult::Containers::Set types_; - Cult::Containers::Set schemas_; + std::set types_; + std::set schemas_; BaseInclude base_; Traversal::Inherits inherits_; @@ -194,19 +194,19 @@ namespace CXX Traversal::Element, Context { - AggregateInclude (Context& c, Char const* key) + AggregateInclude (Context& c, char const* key) : Context (c), key_ (key), type_include_ (c) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.context ().count (key_)) type_include_.dispatch (t); } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.context ().count (key_)) @@ -214,7 +214,7 @@ namespace CXX } private: - Char const* key_; + char const* key_; TypeInclude type_include_; }; } diff --git a/xsde/cxx/hybrid/default-value.cxx b/xsde/cxx/hybrid/default-value.cxx index d6287a8..f45ff4b 100644 --- a/xsde/cxx/hybrid/default-value.cxx +++ b/xsde/cxx/hybrid/default-value.cxx @@ -24,18 +24,18 @@ namespace CXX { } - Void InitValue:: + void InitValue:: dispatch (SemanticGraph::Node& type, String const& value) { value_ = value; Traversal::NodeBase::dispatch (type); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::List& l) { SemanticGraph::Type& t (l.argumented ().type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); LiteralValue::collapse (value_); @@ -45,9 +45,9 @@ namespace CXX String ov (value_); String om (member_); - Size b (0); + size_t b (0); - for (Size e (ov.find (' ')); ; e = ov.find (' ', b)) + for (size_t e (ov.find (' ')); ; e = ov.find (' ', b)) { String v (ov, b, e != String::npos ? e - b : e); @@ -146,7 +146,7 @@ namespace CXX value_ = ov; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Union& u) { String const& value (u.context ().get ("value")); @@ -178,13 +178,13 @@ namespace CXX } } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Complex& c) { Traversal::NodeBase::dispatch (ultimate_base (c)); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Enumeration& e) { using SemanticGraph::Enumerator; @@ -215,7 +215,7 @@ namespace CXX // String const& vt (e.context ().get ("value-type")); - Size n (0); + size_t n (0); { Enumeration const& tmp (x); for (Enumeration::NamesConstIterator i (tmp.names_begin ()); @@ -233,7 +233,7 @@ namespace CXX os << ");"; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Type& t) { // This is a fall-back case where we handle all other (literal) @@ -245,7 +245,7 @@ namespace CXX // anySimpleType. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::AnySimpleType& t) { string_type (t); @@ -253,49 +253,49 @@ namespace CXX // Strings. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::String& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NormalizedString& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Token& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NameToken& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NameTokens&) { string_sequence_type (); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Name& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::NCName& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Language& t) { string_type (t); @@ -303,13 +303,13 @@ namespace CXX // Qualified name. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::QName&) { // Newer version of the XSD frontend provide resolved values // in the form #. // - Size p (value_.rfind ('#')); + size_t p (value_.rfind ('#')); if (p != String::npos) value_ = String (value_, p + 1, value_.size () - p - 1); @@ -348,19 +348,19 @@ namespace CXX // ID/IDREF. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Id& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::IdRef& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::IdRefs&) { string_sequence_type (); @@ -368,7 +368,7 @@ namespace CXX // URI. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::AnyURI& t) { string_type (t); @@ -376,7 +376,7 @@ namespace CXX // Binary. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Base64Binary&) { LiteralValue::collapse (value_); @@ -386,7 +386,7 @@ namespace CXX << endl; } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::HexBinary&) { LiteralValue::collapse (value_); @@ -399,15 +399,15 @@ namespace CXX // Date/time. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Date&) { // date := [-]CCYY[N]*-MM-DD[Z|(+|-)HH:MM] // LiteralValue::collapse (value_); - Size b (0); - Size e (value_.find ('-', value_[0] == '-' ? 5 : 4)); + size_t b (0); + size_t e (value_.find ('-', value_[0] == '-' ? 5 : 4)); String year (value_, 0, e); b = e + 1; @@ -427,15 +427,15 @@ namespace CXX time_zone (b + 2); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::DateTime&) { // date_time := [-]CCYY[N]*-MM-DDTHH:MM:SS[.S+][Z|(+|-)HH:MM] // LiteralValue::collapse (value_); - Size b (0); - Size e (value_.find ('-', value_[0] == '-' ? 5 : 4)); + size_t b (0); + size_t e (value_.find ('-', value_[0] == '-' ? 5 : 4)); String year (value_, 0, e); b = e + 1; @@ -454,7 +454,7 @@ namespace CXX e = b + 2; for (; e < value_.size (); ++e) { - WideChar c (value_[e]); + wchar_t c (value_[e]); if (c == 'Z' || c == '+' || c == '-') break; @@ -482,12 +482,12 @@ namespace CXX namespace { - Size - find_delim (String const& s, Size pos) + size_t + find_delim (String const& s, size_t pos) { for (; pos < s.size (); ++pos) { - WideChar c (s[pos]); + wchar_t c (s[pos]); if (c == 'Y' || c == 'D' || c == 'M' || c == 'H' || c == 'M' || c == 'S' || c == 'T') @@ -498,14 +498,14 @@ namespace CXX } } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Duration&) { // duration := [-]P[nY][nM][nD][TnHnMn[.n+]S] // LiteralValue::collapse (value_); - Size b (1), e, n (value_.size ()); + size_t b (1), e, n (value_.size ()); if (value_[0] == '-') { @@ -583,7 +583,7 @@ namespace CXX } } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Day&) { // gday := ---DD[Z|(+|-)HH:MM] @@ -598,7 +598,7 @@ namespace CXX time_zone (5); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Month&) { // gmonth := --MM[Z|(+|-)HH:MM] @@ -613,7 +613,7 @@ namespace CXX time_zone (4); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::MonthDay&) { // gmonth_day := --MM-DD[Z|(+|-)HH:MM] @@ -632,17 +632,17 @@ namespace CXX time_zone (7); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Year&) { // gyear := [-]CCYY[N]*[Z|(+|-)HH:MM] // LiteralValue::collapse (value_); - Size pos (value_[0] == '-' ? 5 : 4); + size_t pos (value_[0] == '-' ? 5 : 4); for (; pos < value_.size (); ++pos) { - WideChar c (value_[pos]); + wchar_t c (value_[pos]); if (c == 'Z' || c == '+' || c == '-') break; @@ -656,14 +656,14 @@ namespace CXX time_zone (pos); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::YearMonth&) { // gyear_month := [-]CCYY[N]*-MM[Z|(+|-)HH:MM] // LiteralValue::collapse (value_); - Size pos (value_.find ('-', value_[0] == '-' ? 5 : 4)); + size_t pos (value_.find ('-', value_[0] == '-' ? 5 : 4)); String year (value_, 0, pos); String month (value_, pos + 1, 2); @@ -677,7 +677,7 @@ namespace CXX time_zone (pos + 3); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Time&) { // time := HH:MM:SS[.S+][Z|(+|-)HH:MM] @@ -687,10 +687,10 @@ namespace CXX String hours (value_, 0, 2); String minutes (value_, 3, 2); - Size e (8); + size_t e (8); for (; e < value_.size (); ++e) { - WideChar c (value_[e]); + wchar_t c (value_[e]); if (c == 'Z' || c == '+' || c == '-') break; @@ -710,8 +710,8 @@ namespace CXX time_zone (e); } - Void InitValue:: - time_zone (Size pos) + void InitValue:: + time_zone (size_t pos) { // time_zone := Z|(+|-)HH:MM // @@ -746,19 +746,19 @@ namespace CXX // Entity. // - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Entity& t) { string_type (t); } - Void InitValue:: + void InitValue:: traverse (SemanticGraph::Fundamental::Entities&) { string_sequence_type (); } - Void InitValue:: + void InitValue:: string_type (SemanticGraph::Type& t) { // In case STL is disabled, strings are returned as literals @@ -795,7 +795,7 @@ namespace CXX } } - Void InitValue:: + void InitValue:: string_sequence_type () { LiteralValue::collapse (value_); @@ -803,9 +803,9 @@ namespace CXX if (!value_) return; - Size b (0); + size_t b (0); - for (Size e (value_.find (' ')); ; e = value_.find (' ', b)) + for (size_t e (value_.find (' ')); ; e = value_.find (' ', b)) { String v (value_, b, e != String::npos ? e - b : e); @@ -856,7 +856,7 @@ namespace CXX { } - Void CompareValue:: + void CompareValue:: dispatch (SemanticGraph::Node& type, String const& lhs, String const& rhs) { lhs_ = &lhs; @@ -864,7 +864,7 @@ namespace CXX Traversal::NodeBase::dispatch (type); } - Void CompareValue:: + void CompareValue:: traverse (SemanticGraph::Union& u) { String const& value (u.context ().get ("value")); @@ -873,13 +873,13 @@ namespace CXX " ()"; } - Void CompareValue:: + void CompareValue:: traverse (SemanticGraph::Complex& c) { Traversal::NodeBase::dispatch (ultimate_base (c)); } - Void CompareValue:: + void CompareValue:: traverse (SemanticGraph::Enumeration& e) { // First see if we should delegate this one to the Complex @@ -894,7 +894,7 @@ namespace CXX os << *lhs_ << " == " << *rhs_; } - Void CompareValue:: + void CompareValue:: traverse (SemanticGraph::Type&) { // This is a fall-back case where we handle all other types. diff --git a/xsde/cxx/hybrid/default-value.hxx b/xsde/cxx/hybrid/default-value.hxx index 2a806bd..562279b 100644 --- a/xsde/cxx/hybrid/default-value.hxx +++ b/xsde/cxx/hybrid/default-value.hxx @@ -60,130 +60,130 @@ namespace CXX { InitValue (Context&); - Void + void dispatch (SemanticGraph::Node& type, String const& value); - virtual Void + virtual void traverse (SemanticGraph::List&); - virtual Void + virtual void traverse (SemanticGraph::Union&); - virtual Void + virtual void traverse (SemanticGraph::Complex&); - virtual Void + virtual void traverse (SemanticGraph::Enumeration&); - virtual Void + virtual void traverse (SemanticGraph::Type& t); // anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&); // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&); // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName&); // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs&); // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&); // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary&); // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time&); // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&); - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&); private: - Void + void string_type (SemanticGraph::Type&); - Void + void string_sequence_type (); - Void - time_zone (Size pos); + void + time_zone (size_t pos); private: String member_; @@ -202,21 +202,21 @@ namespace CXX { CompareValue (Context&); - Void + void dispatch (SemanticGraph::Node& type, String const& lhs, String const& rhs); - virtual Void + virtual void traverse (SemanticGraph::Union&); - virtual Void + virtual void traverse (SemanticGraph::Complex&); - virtual Void + virtual void traverse (SemanticGraph::Enumeration&); - virtual Void + virtual void traverse (SemanticGraph::Type& t); private: diff --git a/xsde/cxx/hybrid/elements.cxx b/xsde/cxx/hybrid/elements.cxx index 9356b66..fe1e533 100644 --- a/xsde/cxx/hybrid/elements.cxx +++ b/xsde/cxx/hybrid/elements.cxx @@ -350,7 +350,7 @@ namespace CXX // // String Context:: - scope (SemanticGraph::Compositor& c, Boolean fq) const + scope (SemanticGraph::Compositor& c, bool fq) const { using namespace SemanticGraph; @@ -403,7 +403,7 @@ namespace CXX } String Context:: - scope (SemanticGraph::Element& e, Boolean fq) const + scope (SemanticGraph::Element& e, bool fq) const { SemanticGraph::Compositor& c (e.contained_particle ().compositor ()); @@ -414,7 +414,7 @@ namespace CXX } String Context:: - scope (SemanticGraph::Attribute& a, Boolean fq) const + scope (SemanticGraph::Attribute& a, bool fq) const { using SemanticGraph::Complex; @@ -425,7 +425,7 @@ namespace CXX : ename_custom (t); } - Boolean Context:: + bool Context:: recursive_base (SemanticGraph::Complex& c) { using namespace SemanticGraph; @@ -443,17 +443,17 @@ namespace CXX return false; } - Void Context:: + void Context:: close_ns () { - for (Size i (0), n (ns_stack.size () - 1); i < n; ++i) + for (size_t i (0), n (ns_stack.size () - 1); i < n; ++i) os << "}"; } - Void Context:: + void Context:: open_ns () { - for (NamespaceStack::Iterator i (ns_stack.begin () + 1); + for (NamespaceStack::iterator i (ns_stack.begin () + 1); i != ns_stack.end (); ++i) { @@ -484,11 +484,11 @@ namespace CXX return os; } - Boolean Context:: + bool Context:: enum_mapping (SemanticGraph::Enumeration& e, SemanticGraph::Enumeration** base) { - Boolean gen (false); + bool gen (false); StringBasedType t (gen); t.dispatch (e); @@ -515,18 +515,18 @@ namespace CXX // Namespace // Namespace:: - Namespace (Context& c, Boolean track_scope) + Namespace (Context& c, bool track_scope) : CXX::Namespace (c, track_scope ? this : 0), ctx_ (c) { } - Void Namespace:: + void Namespace:: enter (String const& name) { ctx_.ns_stack.push_back (name); } - Void Namespace:: + void Namespace:: leave () { ctx_.ns_stack.pop_back (); @@ -534,7 +534,7 @@ namespace CXX // Includes // - Void TypeForward:: + void TypeForward:: traverse (SemanticGraph::Type& t) { SemanticGraph::Context& ctx (t.context ()); @@ -558,7 +558,7 @@ namespace CXX os << "class " << ename (t) << ";"; } - Void Includes:: + void Includes:: traverse_ (SemanticGraph::Uses& u) { // Support for weak (forward) inclusion used in the file-per-type @@ -566,7 +566,7 @@ namespace CXX // Type t (type_); SemanticGraph::Schema& s (u.schema ()); - Boolean weak (u.context ().count ("weak")); + bool weak (u.context ().count ("weak")); if (weak && (t == header || t == impl_header)) { diff --git a/xsde/cxx/hybrid/elements.hxx b/xsde/cxx/hybrid/elements.hxx index f4b00e8..a1fb22e 100644 --- a/xsde/cxx/hybrid/elements.hxx +++ b/xsde/cxx/hybrid/elements.hxx @@ -6,12 +6,11 @@ #ifndef CXX_HYBRID_ELEMENTS_HXX #define CXX_HYBRID_ELEMENTS_HXX +#include #include #include -#include - #include #include @@ -253,10 +252,10 @@ namespace CXX return c.context ().get ("arm-tag"); } - static UnsignedLong const& + static size_t const& arm_tag_count (SemanticGraph::Choice& c) { - return c.context ().get ("arm-tag-count"); + return c.context ().get ("arm-tag-count"); } static String const& @@ -515,16 +514,16 @@ namespace CXX private: String - scope (SemanticGraph::Compositor&, Boolean fq) const; + scope (SemanticGraph::Compositor&, bool fq) const; String - scope (SemanticGraph::Element&, Boolean fq) const; + scope (SemanticGraph::Element&, bool fq) const; String - scope (SemanticGraph::Attribute&, Boolean fq) const; + scope (SemanticGraph::Attribute&, bool fq) const; public: - Boolean + bool restriction_p (SemanticGraph::Complex& c) const { if (c.inherits_p () && @@ -539,31 +538,31 @@ namespace CXX } public: - static Boolean + static bool fixed_length (SemanticGraph::Type& t) { - return t.context ().get ("fixed"); + return t.context ().get ("fixed"); } - static Boolean + static bool fixed_length (SemanticGraph::Compositor& c) { - return c.context ().get ("fixed"); + return c.context ().get ("fixed"); } - static Boolean + static bool recursive (SemanticGraph::Type& t) { return t.context ().count ("recursive"); } - static Boolean + static bool polymorphic (SemanticGraph::Type& t) { return t.context ().count ("polymorphic"); } - static Boolean + static bool recursive_base (SemanticGraph::Complex& c); public: @@ -574,38 +573,36 @@ namespace CXX ostream (NarrowString const& os) const; public: - Void + void close_ns (); - Void + void open_ns (); public: // Determine whether we are generating the enum mapping for this // enumeration. Also optionally return the base enum. // - static Boolean + static bool enum_mapping (SemanticGraph::Enumeration& e, SemanticGraph::Enumeration** base = 0); public: - typedef - Cult::Containers::Deque - NamespaceStack; + typedef std::deque NamespaceStack; public: options_type const& options; - Boolean exceptions; - Boolean stl; - Boolean poly_code; - Boolean poly_runtime; - Boolean reset; - Boolean clone; - Boolean detach; - Boolean typeinfo; - Boolean mixin; - Boolean tiein; - Boolean enum_; + bool exceptions; + bool stl; + bool poly_code; + bool poly_runtime; + bool reset; + bool clone; + bool detach; + bool typeinfo; + bool mixin; + bool tiein; + bool enum_; Regex const* fwd_expr; Regex const* hxx_expr; @@ -646,13 +643,13 @@ namespace CXX // struct Namespace: CXX::Namespace, CXX::Namespace::ScopeTracker { - Namespace (Context&, Boolean track_scope = false); + Namespace (Context&, bool track_scope = false); protected: - virtual Void + virtual void enter (String const& name); - virtual Void + virtual void leave (); protected: @@ -682,86 +679,86 @@ namespace CXX Traversal::Fundamental::Decimal { - FundamentalType (Boolean& result) + FundamentalType (bool& result) : r_ (result) { } // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&) { r_ = true; @@ -769,7 +766,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { r_ = true; @@ -777,26 +774,26 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&) { r_ = true; } private: - Boolean& r_; + bool& r_; }; // @@ -815,85 +812,85 @@ namespace CXX Traversal::Fundamental::AnyURI, Traversal::Fundamental::Entity { - StringType (Boolean& result) + StringType (bool& result) : r_ (result) { } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { r_ = true; } - 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_; }; // Check whether this is a string-based type (excluding ID, IDFER, @@ -908,13 +905,13 @@ namespace CXX Traversal::Fundamental::NCName, Traversal::Fundamental::Language { - StringBasedType (Boolean& r) + StringBasedType (bool& r) : r_ (r) { *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -922,50 +919,50 @@ 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; } private: - Boolean& r_; + bool& r_; Traversal::Inherits inherits_; }; @@ -984,7 +981,7 @@ namespace CXX inherits_ >> enum_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -999,7 +996,7 @@ namespace CXX *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (Type& e) { e_ = &e; @@ -1097,7 +1094,7 @@ namespace CXX xs_ns_ = xs_ns_name (); } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { type (t); @@ -1105,13 +1102,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { if (stl || use_ != base) @@ -1122,7 +1119,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { if (use_ != base) @@ -1133,7 +1130,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&) { if (use_ != base) @@ -1142,7 +1139,7 @@ namespace CXX os << xs_ns_ << "::byte_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&) { if (use_ != base) @@ -1151,7 +1148,7 @@ namespace CXX os << xs_ns_ << "::unsigned_byte_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&) { if (use_ != base) @@ -1160,7 +1157,7 @@ namespace CXX os << xs_ns_ << "::short_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&) { if (use_ != base) @@ -1169,7 +1166,7 @@ namespace CXX os << xs_ns_ << "::unsigned_short_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&) { if (use_ != base) @@ -1178,7 +1175,7 @@ namespace CXX os << xs_ns_ << "::int_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&) { if (use_ != base) @@ -1187,7 +1184,7 @@ namespace CXX os << xs_ns_ << "::unsigned_int_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&) { if (use_ != base) @@ -1201,7 +1198,7 @@ namespace CXX os << xs_ns_ << "::long_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&) { if (use_ != base) @@ -1215,7 +1212,7 @@ namespace CXX os << xs_ns_ << "::unsigned_long_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&) { if (use_ != base) @@ -1224,7 +1221,7 @@ namespace CXX os << xs_ns_ << "::integer_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { if (use_ != base) @@ -1233,7 +1230,7 @@ namespace CXX os << xs_ns_ << "::non_positive_integer_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { if (use_ != base) @@ -1242,7 +1239,7 @@ namespace CXX os << xs_ns_ << "::non_negative_integer_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&) { if (use_ != base) @@ -1251,7 +1248,7 @@ namespace CXX os << xs_ns_ << "::positive_integer_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&) { if (use_ != base) @@ -1262,7 +1259,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&) { if (use_ != base) @@ -1271,7 +1268,7 @@ namespace CXX os << xs_ns_ << "::float_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&) { if (use_ != base) @@ -1280,7 +1277,7 @@ namespace CXX os << xs_ns_ << "::double_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&) { if (use_ != base) @@ -1291,7 +1288,7 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { if (stl || use_ != base) @@ -1300,7 +1297,7 @@ namespace CXX os << xs_ns_ << "::string_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { if (stl || use_ != base) @@ -1309,7 +1306,7 @@ namespace CXX os << xs_ns_ << "::normalized_string_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { if (stl || use_ != base) @@ -1318,7 +1315,7 @@ namespace CXX os << xs_ns_ << "::token_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { if (stl || use_ != base) @@ -1327,13 +1324,13 @@ namespace CXX os << xs_ns_ << "::nmtoken_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { if (stl || use_ != base) @@ -1342,7 +1339,7 @@ namespace CXX os << xs_ns_ << "::name_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { if (stl || use_ != base) @@ -1351,7 +1348,7 @@ namespace CXX os << xs_ns_ << "::ncname_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { if (stl || use_ != base) @@ -1363,7 +1360,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { type (t); @@ -1372,7 +1369,7 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { if (stl || use_ != base) @@ -1381,7 +1378,7 @@ namespace CXX os << xs_ns_ << "::id_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { if (stl || use_ != base) @@ -1390,7 +1387,7 @@ namespace CXX os << xs_ns_ << "::idref_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { type (t); @@ -1398,7 +1395,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { if (stl || use_ != base) @@ -1409,13 +1406,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { type (t); @@ -1424,55 +1421,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { type (t); @@ -1480,7 +1477,7 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { if (stl || use_ != base) @@ -1489,14 +1486,14 @@ namespace CXX os << xs_ns_ << "::entity_base"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { type (t); } private: - Void + void type (SemanticGraph::Type& t) { String fq (fq_name (t)); @@ -1550,8 +1547,8 @@ namespace CXX } } - Void - fund_type (Char const* name) + void + fund_type (char const* name) { switch (use_) { @@ -1573,7 +1570,7 @@ namespace CXX } } - Void + void string_type () { switch (use_) @@ -1688,7 +1685,7 @@ namespace CXX Traversal::Fundamental::Entity, Traversal::Fundamental::Entities { - virtual Void + virtual void traverse (SemanticGraph::Type& t) { type (t); @@ -1696,13 +1693,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { string_type (t); @@ -1710,7 +1707,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t); @@ -1718,79 +1715,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { fund_type (t); @@ -1798,19 +1795,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { fund_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { fund_type (t); @@ -1818,49 +1815,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { string_type (t); @@ -1868,7 +1865,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { type (t); @@ -1876,19 +1873,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { type (t); @@ -1896,7 +1893,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { string_type (t); @@ -1904,13 +1901,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { type (t); @@ -1918,55 +1915,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { type (t); @@ -1974,26 +1971,26 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { string_type (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { type (t); } protected: - virtual Void + virtual void type (SemanticGraph::Type&) = 0; - virtual Void + virtual void fund_type (SemanticGraph::Type&) = 0; - virtual Void + virtual void string_type (SemanticGraph::Type&) = 0; }; @@ -2005,19 +2002,19 @@ namespace CXX } protected: - virtual Void + virtual void type (SemanticGraph::Type& t) { if (!fixed_length (t)) os << "*"; } - virtual Void + virtual void fund_type (SemanticGraph::Type&) { } - virtual Void + virtual void string_type (SemanticGraph::Type&) { } @@ -2030,7 +2027,7 @@ namespace CXX { } - Void + void dispatch (SemanticGraph::Node& type, String const& var) { var_ = var; @@ -2038,7 +2035,7 @@ namespace CXX } protected: - virtual Void + virtual void type (SemanticGraph::Type& t) { if (!custom_alloc) @@ -2054,13 +2051,13 @@ namespace CXX } } - virtual Void + virtual void fund_type (SemanticGraph::Type& t) { type (t); } - virtual Void + virtual void string_type (SemanticGraph::Type& t) { if (stl) @@ -2089,7 +2086,7 @@ namespace CXX // Copy member from 'this' to 'c'. // - Void + void dispatch (SemanticGraph::Node& type, SemanticGraph::Member& member) { member_ = &member; @@ -2097,7 +2094,7 @@ namespace CXX } protected: - virtual Void + virtual void type (SemanticGraph::Type& t) { String const& name (ename (*member_)); @@ -2115,13 +2112,13 @@ namespace CXX << "}"; } - virtual Void + virtual void fund_type (SemanticGraph::Type& t) { type (t); } - virtual Void + virtual void string_type (SemanticGraph::Type&) { // We can only get here if STL is disabled. @@ -2154,7 +2151,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t); }; @@ -2181,26 +2178,26 @@ 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: Context& ctx_; Type type_; - Boolean forward_; + bool forward_; Regex const* regex_; Traversal::Schema schema_; @@ -2214,19 +2211,19 @@ namespace CXX // struct AggregateTest: Traversal::Type, Traversal::Element { - AggregateTest (Boolean& generate, Char const* key) + AggregateTest (bool& generate, char const* key) : gen_ (generate), key_ (key) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (!gen_ && t.context ().count (key_)) gen_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!gen_ && e.context ().count (key_)) @@ -2234,8 +2231,8 @@ namespace CXX } private: - Boolean& gen_; - Char const* key_; + bool& gen_; + char const* key_; }; } } diff --git a/xsde/cxx/hybrid/extraction-header.cxx b/xsde/cxx/hybrid/extraction-header.cxx index 25b4b43..3ec42d1 100644 --- a/xsde/cxx/hybrid/extraction-header.cxx +++ b/xsde/cxx/hybrid/extraction-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -62,7 +62,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -91,7 +91,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -124,7 +124,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -149,12 +149,12 @@ namespace CXX struct Choice: Traversal::Choice, Context { - Choice (Context& c, Boolean in_choice) + Choice (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -179,18 +179,18 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; struct Sequence: Traversal::Sequence, Context { - Sequence (Context& c, Boolean in_choice) + Sequence (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -215,7 +215,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; struct Complex : Traversal::Complex, Context @@ -245,7 +245,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -285,7 +285,7 @@ namespace CXX }; } - Void + void generate_extraction_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/extraction-header.hxx b/xsde/cxx/hybrid/extraction-header.hxx index d6e1af3..1670f64 100644 --- a/xsde/cxx/hybrid/extraction-header.hxx +++ b/xsde/cxx/hybrid/extraction-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_extraction_header (Context&); } } diff --git a/xsde/cxx/hybrid/extraction-source.cxx b/xsde/cxx/hybrid/extraction-source.cxx index 413ffdc..cfdaf56 100644 --- a/xsde/cxx/hybrid/extraction-source.cxx +++ b/xsde/cxx/hybrid/extraction-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -75,7 +75,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -113,7 +113,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -159,7 +159,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { // Nothing is serialized for fixed attributes. @@ -169,8 +169,8 @@ namespace CXX SemanticGraph::Type& t (a.type ()); - Boolean fl (fixed_length (t)); - Boolean st (false); + bool fl (fixed_length (t)); + bool st (false); String const& name (ename (a)); @@ -309,7 +309,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { // See also ChoiceParticleData. @@ -328,8 +328,8 @@ namespace CXX { SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); - Boolean st (false); + bool fl (fixed_length (t)); + bool st (false); if (!fl) { @@ -434,7 +434,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -442,7 +442,7 @@ namespace CXX // if (a.min () == 0) { - Boolean fl (fixed_length (a)); + bool fl (fixed_length (a)); String const& name (ename (a)); String const& present (epresent (a)); @@ -524,7 +524,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { os << "case " << scope (e) << "::" << etag (e) << ":" @@ -546,8 +546,8 @@ namespace CXX { SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); - Boolean st (false); + bool fl (fixed_length (t)); + bool st (false); if (!fl) { @@ -643,7 +643,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { os << "case " << scope (c) << "::" << etag (c) << ":" @@ -665,7 +665,7 @@ namespace CXX } else { - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); if (c.min () == 0) { @@ -747,7 +747,7 @@ namespace CXX contains_data_ >> particle_data_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -762,7 +762,7 @@ namespace CXX } else if (c.min () == 0) { - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); String const& name (ename (c)); String const& present (epresent (c)); @@ -870,7 +870,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -885,7 +885,7 @@ namespace CXX } else if (s.min () == 0) { - Boolean fl (fixed_length (s)); + bool fl (fixed_length (s)); String const& name (ename (s)); String const& present (epresent (s)); @@ -969,7 +969,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1005,13 +1005,13 @@ namespace CXX struct Choice: Traversal::Choice, Context { - Choice (Context& c, Boolean in_choice) + Choice (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice), particle_data_ (c) { contains_data_ >> particle_data_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -1060,7 +1060,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; ChoiceParticleData particle_data_; Traversal::ContainsParticle contains_data_; @@ -1070,7 +1070,7 @@ namespace CXX struct Sequence: Traversal::Sequence, Context { Sequence (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_data) : Context (c), in_choice_ (in_choice), @@ -1078,7 +1078,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -1111,7 +1111,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_data_; }; @@ -1175,7 +1175,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -1186,7 +1186,7 @@ namespace CXX if (!name) return; - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); for (NarrowStrings::const_iterator i (istreams.begin ()); i != istreams.end (); ++i) @@ -1203,7 +1203,7 @@ namespace CXX { SemanticGraph::Type& b (c.inherits ().base ()); - Boolean c_str (false); + bool c_str (false); if (!stl) { @@ -1291,7 +1291,7 @@ namespace CXX }; } - Void + void generate_extraction_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/extraction-source.hxx b/xsde/cxx/hybrid/extraction-source.hxx index 363f5c1..0d28daa 100644 --- a/xsde/cxx/hybrid/extraction-source.hxx +++ b/xsde/cxx/hybrid/extraction-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_extraction_source (Context&); } } diff --git a/xsde/cxx/hybrid/generator.cxx b/xsde/cxx/hybrid/generator.cxx index c2289ae..eac7cf0 100644 --- a/xsde/cxx/hybrid/generator.cxx +++ b/xsde/cxx/hybrid/generator.cxx @@ -10,9 +10,6 @@ #include -#include -#include - #include #include #include @@ -75,7 +72,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" @@ -96,7 +93,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" @@ -107,7 +104,7 @@ namespace CXX "//\n\n"; } - Void Hybrid::Generator:: + void Hybrid::Generator:: usage () { CXX::Hybrid::options::print_usage (wcout); @@ -125,12 +122,12 @@ namespace CXX sloc_filter; NarrowString - find_value (NarrowStrings const& v, Char const* key) + find_value (NarrowStrings const& v, char const* key) { for (NarrowStrings::const_iterator i (v.begin ()), e (v.end ()); i != e; ++i) { - Size p (i->find ('=')); + size_t p (i->find ('=')); if (p == NarrowString::npos) { @@ -161,15 +158,15 @@ namespace CXX return NarrowString (); } - Void - copy_values (NarrowStrings& dst, NarrowStrings const& src, Char const* key) + void + copy_values (NarrowStrings& dst, NarrowStrings const& src, char const* key) { dst.clear (); for (NarrowStrings::const_iterator i (src.begin ()), e (src.end ()); i != e; ++i) { - Size p (i->find ('=')); + size_t p (i->find ('=')); if (p == NarrowString::npos) { @@ -201,7 +198,7 @@ namespace CXX struct FundNamespace: Namespace, Hybrid::Context { - FundNamespace (Hybrid::Context& c, Char type) + FundNamespace (Hybrid::Context& c, char type) : Namespace (c), Hybrid::Context (c), type_ (type) { } @@ -214,7 +211,7 @@ namespace CXX os << "using ::xsde::cxx::hybrid::any_type;" << endl; - Boolean us, ui; + bool us, ui; String skel, impl; if (type_ == 'p') @@ -250,7 +247,7 @@ namespace CXX } private: - Char type_; + char type_; }; } @@ -271,7 +268,7 @@ namespace CXX r->skel_type_suffix (h.pskel_type_suffix ()); r->impl_type_suffix (h.pimpl_type_suffix ()); - Char const* k = "pskel"; + char const* k = "pskel"; r->hxx_regex (find_value (h.hxx_regex (), k)); r->ixx_regex (find_value (h.ixx_regex (), k)); @@ -337,7 +334,7 @@ namespace CXX r->skel_type_suffix (h.sskel_type_suffix ()); r->impl_type_suffix (h.simpl_type_suffix ()); - Char const* k = "pskel"; + char const* k = "pskel"; r->hxx_regex (find_value (h.hxx_regex (), k)); r->ixx_regex (find_value (h.ixx_regex (), k)); @@ -386,7 +383,7 @@ namespace CXX return r; } - Void Hybrid::Generator:: + void Hybrid::Generator:: calculate_size (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file, @@ -400,7 +397,7 @@ namespace CXX throw Failed (); } - Void Hybrid::Generator:: + void Hybrid::Generator:: process_tree_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -409,7 +406,7 @@ namespace CXX proc.process (ops, schema, file, false); } - Void Hybrid::Generator:: + void Hybrid::Generator:: process_parser_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -419,7 +416,7 @@ namespace CXX throw Failed (); } - Void Hybrid::Generator:: + void Hybrid::Generator:: process_serializer_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -432,7 +429,7 @@ namespace CXX namespace { template - Void + void open (S& ifs, NarrowString const& path) { try @@ -457,7 +454,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -477,19 +474,19 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def, - Char const* primary_key, - Char const* def_key) + char const* primary_key, + char const* def_key) { for (NarrowStrings const* v = &primary; v != 0; v = (v == &def ? 0 : &def)) { - Boolean found (false); - Char const* key (v == &primary ? primary_key : def_key); + bool found (false); + char const* key (v == &primary ? primary_key : def_key); for (NarrowStrings::const_iterator i (v->begin ()), e (v->end ()); i != e; ++i) @@ -498,7 +495,7 @@ namespace CXX os << i->c_str () << endl; else { - Size p (i->find ('=')); + size_t p (i->find ('=')); if (p == NarrowString::npos) { @@ -535,22 +532,21 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def, - Char const* key) + char const* key) { append (os, primary, def, key, key); } } - - UnsignedLong Hybrid::Generator:: + size_t Hybrid::Generator:: generate_tree (Hybrid::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, const WarningSet& disabled_warnings, TypeMap::Namespaces& parser_type_map, TypeMap::Namespaces& serializer_type_map, @@ -562,7 +558,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 @@ -595,9 +591,9 @@ namespace CXX // Generate code. // - Boolean inline_ (ops.generate_inline () && !generate_xml_schema); - Boolean forward (ops.generate_forward () && !generate_xml_schema); - Boolean source (!generate_xml_schema); + bool inline_ (ops.generate_inline () && !generate_xml_schema); + bool forward (ops.generate_forward () && !generate_xml_schema); + bool source (!generate_xml_schema); NarrowString name (file_path.leaf ()); @@ -769,7 +765,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); if (forward) @@ -806,7 +802,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); // // @@ -1288,11 +1284,11 @@ namespace CXX } } - UnsignedLong Hybrid::Generator:: + size_t Hybrid::Generator:: generate_parser (Hybrid::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, const WarningSet&, FileList& file_list, AutoUnlinks& unlinks) @@ -1303,7 +1299,7 @@ namespace CXX try { { - Boolean gen_xml_schema (ops.generate_xml_schema ()); + bool gen_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 @@ -1450,7 +1446,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -1479,7 +1475,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); // // @@ -1493,7 +1489,7 @@ namespace CXX if (guard_prefix) guard_prefix += '_'; - Boolean aggr (ops.generate_aggregate ()); + bool aggr (ops.generate_aggregate ()); // HXX // @@ -1674,11 +1670,11 @@ namespace CXX } } - UnsignedLong Hybrid::Generator:: + size_t Hybrid::Generator:: generate_serializer (Hybrid::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, const WarningSet&, FileList& file_list, AutoUnlinks& unlinks) @@ -1689,7 +1685,7 @@ namespace CXX try { { - Boolean gen_xml_schema (ops.generate_xml_schema ()); + bool gen_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 @@ -1836,7 +1832,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -1865,7 +1861,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); // // @@ -1879,7 +1875,7 @@ namespace CXX if (guard_prefix) guard_prefix += '_'; - Boolean aggr (ops.generate_aggregate ()); + bool aggr (ops.generate_aggregate ()); // HXX // diff --git a/xsde/cxx/hybrid/generator.hxx b/xsde/cxx/hybrid/generator.hxx index cbef109..131c241 100644 --- a/xsde/cxx/hybrid/generator.hxx +++ b/xsde/cxx/hybrid/generator.hxx @@ -8,14 +8,11 @@ #include // std::auto_ptr -#include - -#include - #include // Path #include #include +#include #include #include @@ -26,14 +23,12 @@ namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class Generator { public: struct Failed {}; - static Void + static void usage (); static std::auto_ptr @@ -48,7 +43,7 @@ namespace CXX // Calculate type sizes. // - static Void + static void calculate_size ( options const&, XSDFrontend::SemanticGraph::Schema&, @@ -57,19 +52,19 @@ namespace CXX // Assign names to global declarations. // - static Void + static void process_tree_names ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&); - static Void + static void process_parser_names ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&); - static Void + static void process_serializer_names ( options const&, XSDFrontend::SemanticGraph::Schema&, @@ -77,34 +72,34 @@ namespace CXX // Generate code. // - static UnsignedLong + static size_t generate_tree ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, WarningSet const& disabled_warnings, TypeMap::Namespaces& parser_type_map, TypeMap::Namespaces& serializer_type_map, FileList&, AutoUnlinks&); - static UnsignedLong + static size_t generate_parser ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, WarningSet const& disabled_warnings, FileList&, AutoUnlinks&); - static UnsignedLong + static size_t generate_serializer ( options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, WarningSet const& disabled_warnings, FileList&, AutoUnlinks&); diff --git a/xsde/cxx/hybrid/insertion-header.cxx b/xsde/cxx/hybrid/insertion-header.cxx index a054d9e..8c11707 100644 --- a/xsde/cxx/hybrid/insertion-header.cxx +++ b/xsde/cxx/hybrid/insertion-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -62,7 +62,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -91,7 +91,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -124,7 +124,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -149,12 +149,12 @@ namespace CXX struct Choice: Traversal::Choice, Context { - Choice (Context& c, Boolean in_choice) + Choice (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -179,18 +179,18 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; struct Sequence: Traversal::Sequence, Context { - Sequence (Context& c, Boolean in_choice) + Sequence (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -215,7 +215,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; struct Complex : Traversal::Complex, Context @@ -245,7 +245,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -285,7 +285,7 @@ namespace CXX }; } - Void + void generate_insertion_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/insertion-header.hxx b/xsde/cxx/hybrid/insertion-header.hxx index b3ecc83..487de93 100644 --- a/xsde/cxx/hybrid/insertion-header.hxx +++ b/xsde/cxx/hybrid/insertion-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_insertion_header (Context&); } } diff --git a/xsde/cxx/hybrid/insertion-source.cxx b/xsde/cxx/hybrid/insertion-source.cxx index d579964..4002384 100644 --- a/xsde/cxx/hybrid/insertion-source.cxx +++ b/xsde/cxx/hybrid/insertion-source.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -66,7 +66,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -105,7 +105,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -142,7 +142,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { // Don't waste space on fixed attributes. @@ -203,7 +203,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () == 1 && e.min () == 0) @@ -241,7 +241,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -283,7 +283,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { os << "case " << scope (e) << "::" << etag (e) << ":" @@ -295,7 +295,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { os << "case " << scope (c) << "::" << etag (c) << ":" @@ -342,7 +342,7 @@ namespace CXX contains_data_ >> particle_data_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -412,7 +412,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -464,7 +464,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -500,13 +500,13 @@ namespace CXX struct Choice: Traversal::Choice, Context { - Choice (Context& c, Boolean in_choice) + Choice (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice), particle_data_ (c) { contains_data_ >> particle_data_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -552,7 +552,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; ChoiceParticleData particle_data_; Traversal::ContainsParticle contains_data_; @@ -562,7 +562,7 @@ namespace CXX struct Sequence: Traversal::Sequence, Context { Sequence (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_data) : Context (c), in_choice_ (in_choice), @@ -570,7 +570,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -603,7 +603,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_data_; }; @@ -667,7 +667,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -678,7 +678,7 @@ namespace CXX if (!name) return; - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); for (NarrowStrings::const_iterator i (ostreams.begin ()); i != ostreams.end (); ++i) @@ -754,7 +754,7 @@ namespace CXX }; } - Void + void generate_insertion_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/insertion-source.hxx b/xsde/cxx/hybrid/insertion-source.hxx index 166bfee..d5da94a 100644 --- a/xsde/cxx/hybrid/insertion-source.hxx +++ b/xsde/cxx/hybrid/insertion-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_insertion_source (Context&); } } diff --git a/xsde/cxx/hybrid/options.cli b/xsde/cxx/hybrid/options.cli index 33b05b0..64ae2fd 100644 --- a/xsde/cxx/hybrid/options.cli +++ b/xsde/cxx/hybrid/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 ; -include ; include ; // std::size_t -include ; // NarrowString +include ; // NarrowString, NarrowStrings include ; @@ -77,7 +75,7 @@ namespace CXX same tree or between different trees." }; - std::vector --generate-insertion + NarrowStrings --generate-insertion { "", "Generate data representation stream insertion operators for the @@ -89,7 +87,7 @@ namespace CXX \cb{--hxx-prologue*} options to include the necessary declarations." }; - std::vector --generate-extraction + NarrowStrings --generate-extraction { "", "Generate data representation stream extraction operators for the @@ -121,7 +119,7 @@ namespace CXX configured with polymorphism support." }; - std::vector --polymorphic-type + NarrowStrings --polymorphic-type { "", "Indicate that is a root of a polymorphic type hierarchy. The @@ -140,7 +138,7 @@ namespace CXX standard C++ RTTI mechanism to determine object's type at runtime." }; - std::vector --polymorphic-schema + NarrowStrings --polymorphic-schema { "", "Indicate that contains derivations of polymorphic types that @@ -164,7 +162,7 @@ namespace CXX // Custom data/type. // - std::vector --custom-data + NarrowStrings --custom-data { "", "Add the ability to store custom data to the C++ class generated for @@ -173,7 +171,7 @@ namespace CXX containing the compositor, for example, \cb{foo::sequence::choise1}." }; - std::vector --custom-type + NarrowStrings --custom-type { "", "Use a custom type implementation instead of the generated version. @@ -194,7 +192,7 @@ namespace CXX \ci{base} is specified) or instead of the generated version." }; - std::vector --custom-parser + NarrowStrings --custom-parser { "", "Use a custom parser implementation instead of the generated version. @@ -209,7 +207,7 @@ namespace CXX generated version." }; - std::vector --custom-serializer + NarrowStrings --custom-serializer { "", "Use a custom serializer implementation instead of the generated @@ -260,7 +258,7 @@ namespace CXX also the \cb{--generate-aggregate} option." }; - std::vector --root-element + NarrowStrings --root-element { "", "Treat only as a document root. This determines for which @@ -269,7 +267,7 @@ namespace CXX \cb{--generate-aggregate} option." }; - std::vector --root-type + NarrowStrings --root-type { "", "Generate parser/serializer aggregate for . Repeat this option @@ -279,70 +277,70 @@ namespace CXX // Suffixes. // - Cult::Types::NarrowString --pskel-type-suffix = "_pskel" + NarrowString --pskel-type-suffix = "_pskel" { "", "Use instead of the default \cb{_pskel} to construct the names of generated parser skeletons." }; - Cult::Types::NarrowString --sskel-type-suffix = "_sskel" + NarrowString --sskel-type-suffix = "_sskel" { "", "Use instead of the default \cb{_sskel} to construct the names of generated serializer skeletons." }; - Cult::Types::NarrowString --pskel-file-suffix = "-pskel" + NarrowString --pskel-file-suffix = "-pskel" { "", "Use instead of the default \cb{-pskel} to construct the names of generated parser skeleton files." }; - Cult::Types::NarrowString --sskel-file-suffix = "-sskel" + NarrowString --sskel-file-suffix = "-sskel" { "", "Use instead of the default \cb{-sskel} to construct the names of generated serializer skeleton files." }; - Cult::Types::NarrowString --pimpl-type-suffix = "_pimpl" + NarrowString --pimpl-type-suffix = "_pimpl" { "", "Use instead of the default \cb{_pimpl} to construct the names of generated parser implementations." }; - Cult::Types::NarrowString --simpl-type-suffix = "_simpl" + NarrowString --simpl-type-suffix = "_simpl" { "", "Use instead of the default \cb{_simpl} to construct the names of generated serializer implementations." }; - Cult::Types::NarrowString --pimpl-file-suffix = "-pimpl" + NarrowString --pimpl-file-suffix = "-pimpl" { "", "Use instead of the default \cb{-pimpl} to construct the names of generated parser implementation files." }; - Cult::Types::NarrowString --simpl-file-suffix = "-simpl" + NarrowString --simpl-file-suffix = "-simpl" { "", "Use instead of the default \cb{-simpl} to construct the names of generated serializer implementation files." }; - Cult::Types::NarrowString --paggr-type-suffix = "_paggr" + NarrowString --paggr-type-suffix = "_paggr" { "", "Use instead of the default \cb{_paggr} to construct the names of generated parser aggregates." }; - Cult::Types::NarrowString --saggr-type-suffix = "_saggr" + NarrowString --saggr-type-suffix = "_saggr" { "", "Use instead of the default \cb{_saggr} to construct the @@ -354,18 +352,18 @@ namespace CXX // "override" them here. Note that the documentation is still // specified in the common version. // - std::vector --hxx-regex; - std::vector --ixx-regex; - std::vector --cxx-regex; - - std::vector --hxx-prologue-file; - std::vector --ixx-prologue-file; - std::vector --cxx-prologue-file; - std::vector --prologue-file; - std::vector --hxx-epilogue-file; - std::vector --ixx-epilogue-file; - std::vector --cxx-epilogue-file; - std::vector --epilogue-file; + NarrowStrings --hxx-regex; + NarrowStrings --ixx-regex; + NarrowStrings --cxx-regex; + + NarrowStrings --hxx-prologue-file; + NarrowStrings --ixx-prologue-file; + NarrowStrings --cxx-prologue-file; + NarrowStrings --prologue-file; + NarrowStrings --hxx-epilogue-file; + NarrowStrings --ixx-epilogue-file; + NarrowStrings --cxx-epilogue-file; + NarrowStrings --epilogue-file; }; } } diff --git a/xsde/cxx/hybrid/parser-aggregate-header.cxx b/xsde/cxx/hybrid/parser-aggregate-header.cxx index 967f1db..c75e0eb 100644 --- a/xsde/cxx/hybrid/parser-aggregate-header.cxx +++ b/xsde/cxx/hybrid/parser-aggregate-header.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include #include @@ -10,7 +12,7 @@ #include #include -#include +using namespace std; namespace CXX { @@ -18,7 +20,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Set InstanceSet; + typedef set InstanceSet; // For base types we only want member's types, but not the // base itself. @@ -32,7 +34,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -44,7 +46,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -146,7 +148,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -158,7 +160,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -172,7 +174,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -196,7 +198,7 @@ namespace CXX } } - virtual Void + virtual void collect (SemanticGraph::Type& t) { using SemanticGraph::Type; @@ -227,7 +229,7 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { if (fund_type (t, "any_type")) @@ -237,7 +239,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { fund_type (t, "any_simple_type"); @@ -245,7 +247,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -253,79 +255,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"); @@ -333,19 +335,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"); @@ -353,49 +355,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"); @@ -404,7 +406,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -413,19 +415,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"); @@ -433,7 +435,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -441,13 +443,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"); @@ -456,55 +458,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"); @@ -512,20 +514,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 Boolean + virtual bool fund_type (SemanticGraph::Type& t, String const& name) { if (map_.find (&t) == map_.end ()) @@ -542,7 +544,7 @@ namespace CXX { String name (escape (raw_name + L"_p_")); - 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; @@ -584,7 +586,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -592,7 +594,7 @@ namespace CXX if (!tc.count ("paggr")) return; - Boolean poly (polymorphic (t)); + bool poly (polymorphic (t)); String const& name (tc.get ("paggr")); String pre (unclash (name, "pre")); @@ -752,7 +754,7 @@ namespace CXX os << "public:" << endl; - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) os << fq_name (*i->first, "p:impl") << " " << i->second << ";"; @@ -774,7 +776,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -783,7 +785,7 @@ namespace CXX return; SemanticGraph::Type& t (e.type ()); - Boolean poly (polymorphic (t)); + bool poly (polymorphic (t)); String const& name (ec.get ("paggr")); String pre (unclash (name, "pre")); @@ -960,7 +962,7 @@ namespace CXX os << "public:" << endl; - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) os << fq_name (*i->first, "p:impl") << " " << i->second << ";"; @@ -977,10 +979,10 @@ namespace CXX }; } - Void + void generate_parser_aggregate_header (Context& ctx) { - Boolean gen (false); + bool gen (false); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/parser-aggregate-header.hxx b/xsde/cxx/hybrid/parser-aggregate-header.hxx index 0e75792..5e5cad9 100644 --- a/xsde/cxx/hybrid/parser-aggregate-header.hxx +++ b/xsde/cxx/hybrid/parser-aggregate-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_parser_aggregate_header (Context&); } } diff --git a/xsde/cxx/hybrid/parser-aggregate-source.cxx b/xsde/cxx/hybrid/parser-aggregate-source.cxx index a1d9bf3..5c81eaa 100644 --- a/xsde/cxx/hybrid/parser-aggregate-source.cxx +++ b/xsde/cxx/hybrid/parser-aggregate-source.cxx @@ -9,7 +9,6 @@ #include #include -#include namespace CXX { @@ -23,8 +22,8 @@ namespace CXX { ParticleArg (Context& c, TypeInstanceMap& map, - Boolean& first, - Boolean poly, + bool& first, + bool poly, String const& arg) : Context (c), poly_ (poly), @@ -35,7 +34,7 @@ namespace CXX { } - ParticleArg (Context& c, Boolean& result, Boolean poly) + ParticleArg (Context& c, bool& result, bool poly) : Context (c), poly_ (poly), map_ (0), @@ -44,7 +43,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_ && anonymous (e.type ())) @@ -68,26 +67,26 @@ namespace CXX } private: - Boolean poly_; + bool poly_; TypeInstanceMap* map_; - Boolean* first_; - Boolean* result_; + bool* first_; + bool* result_; String arg_; }; 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), result_ (0) { } - AttributeArg (Context& c, Boolean& result) + AttributeArg (Context& c, bool& result) : Context (c), map_ (0), first_ (0), result_ (&result) { } - virtual Void + virtual void traverse (Type& a) { if (result_ != 0) @@ -106,8 +105,8 @@ namespace CXX private: TypeInstanceMap* map_; - Boolean* first_; - Boolean* result_; + bool* first_; + bool* result_; }; struct ArgList : Traversal::Complex, @@ -116,7 +115,7 @@ namespace CXX { ArgList (Context& c, TypeInstanceMap& map, - Boolean poly, + bool poly, String const& arg) : Context (c), poly_ (poly), @@ -137,7 +136,7 @@ namespace CXX names_ >> attribute_; } - ArgList (Context& c, Boolean& result, Boolean poly) + ArgList (Context& c, bool& result, bool poly) : Context (c), poly_ (poly), map_ (0), @@ -156,7 +155,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -168,7 +167,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -189,7 +188,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; TypeInstanceMap* map_; Traversal::Inherits inherits_; @@ -202,8 +201,8 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; - Boolean* result_; + bool first_; + bool* result_; }; struct ParserConnect: Traversal::List, @@ -212,13 +211,13 @@ namespace CXX { ParserConnect (Context& c, TypeInstanceMap& map, - Boolean poly, + bool poly, String const& map_inst = String ()) : Context (c), poly_ (poly), map_ (map), map_inst_ (map_inst) { } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -229,7 +228,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (has_members (c)) @@ -246,17 +245,17 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { - Boolean r (false); + bool r (false); ArgList test (*this, r, poly_); test.traverse (c); return r; } private: - Boolean poly_; + bool poly_; TypeInstanceMap& map_; String map_inst_; }; @@ -271,7 +270,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -312,9 +311,9 @@ namespace CXX { String const& entry (tc.get ("paggr-parser-map-entries")); - Size n (0); + size_t n (0); - for (TypeIdInstanceMap::Iterator i (tid_map->begin ()); + for (TypeIdInstanceMap::iterator i (tid_map->begin ()); i != tid_map->end (); ++i, ++n) { @@ -330,7 +329,7 @@ namespace CXX // ParserConnect connect (*this, map, false); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); @@ -341,7 +340,7 @@ namespace CXX ParserConnect connect ( *this, map, true, tc.get ("paggr-parser-map")); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); } @@ -357,7 +356,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -398,9 +397,9 @@ namespace CXX { String const& entry (ec.get ("paggr-parser-map-entries")); - Size n (0); + size_t n (0); - for (TypeIdInstanceMap::Iterator i (tid_map->begin ()); + for (TypeIdInstanceMap::iterator i (tid_map->begin ()); i != tid_map->end (); ++i, ++n) { @@ -416,7 +415,7 @@ namespace CXX // ParserConnect connect (*this, map, false); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); @@ -427,7 +426,7 @@ namespace CXX ParserConnect connect ( *this, map, true, ec.get ("paggr-parser-map")); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); } @@ -457,10 +456,10 @@ namespace CXX }; } - Void + void generate_parser_aggregate_source (Context& ctx) { - Boolean gen (false); + bool gen (false); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/parser-aggregate-source.hxx b/xsde/cxx/hybrid/parser-aggregate-source.hxx index bac9fed..e4237fe 100644 --- a/xsde/cxx/hybrid/parser-aggregate-source.hxx +++ b/xsde/cxx/hybrid/parser-aggregate-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_parser_aggregate_source (Context&); } } diff --git a/xsde/cxx/hybrid/parser-header.cxx b/xsde/cxx/hybrid/parser-header.cxx index 64a7f55..4a1ec35 100644 --- a/xsde/cxx/hybrid/parser-header.cxx +++ b/xsde/cxx/hybrid/parser-header.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (c.inherits_p ()) @@ -52,7 +52,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -73,8 +73,8 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (e)); - Boolean val (!options.suppress_validation () && + bool fl (fixed_length (e)); + bool val (!options.suppress_validation () && !options.suppress_parser_val ()); SemanticGraph::Type& b (e.inherits ().base ()); @@ -232,7 +232,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (epimpl_custom (l)); @@ -323,7 +323,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (epimpl_custom (u)); @@ -333,7 +333,7 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (u)); + bool fl (fixed_length (u)); os << "class " << name << ": public " << (mixin ? "virtual " : "") << epskel (u) @@ -437,7 +437,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { if (c.max () != 1) @@ -467,7 +467,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -482,7 +482,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { os << "virtual void" << endl @@ -492,7 +492,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -519,7 +519,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& arg (parg_type (e.type ())); @@ -542,7 +542,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.fixed_p ()) @@ -595,7 +595,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (epimpl_custom (c)); @@ -605,14 +605,14 @@ namespace CXX // if (name) { - Boolean hb (c.inherits_p ()); - Boolean he (has (c)); - Boolean ha (has (c)); - Boolean hae (has_particle (c)); + bool hb (c.inherits_p ()); + bool he (has (c)); + bool ha (has (c)); + bool hae (has_particle (c)); - Boolean restriction (restriction_p (c)); - Boolean fixed (fixed_length (c)); - Boolean rec (recursive (c)); + bool restriction (restriction_p (c)); + bool fixed (fixed_length (c)); + bool rec (recursive (c)); String const& ret (pret_type (c)); @@ -784,7 +784,7 @@ namespace CXX }; } - Void + void generate_parser_header (Context& ctx) { ctx.os << "#include " << endl diff --git a/xsde/cxx/hybrid/parser-header.hxx b/xsde/cxx/hybrid/parser-header.hxx index 230ba49..62a1b06 100644 --- a/xsde/cxx/hybrid/parser-header.hxx +++ b/xsde/cxx/hybrid/parser-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_parser_header (Context&); } } diff --git a/xsde/cxx/hybrid/parser-name-processor.cxx b/xsde/cxx/hybrid/parser-name-processor.cxx index d5f7edd..9c0f9fd 100644 --- a/xsde/cxx/hybrid/parser-name-processor.cxx +++ b/xsde/cxx/hybrid/parser-name-processor.cxx @@ -3,6 +3,11 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include +#include +#include + #include #include #include @@ -10,11 +15,7 @@ #include #include -#include -#include - -#include -#include +using namespace std; namespace CXX { @@ -22,10 +23,7 @@ namespace CXX { namespace { - // - // - typedef Cult::Containers::Set NameSet; - + typedef set NameSet; struct Failed {}; class Context: public CXX::Context @@ -61,7 +59,7 @@ namespace CXX // Split the string in two parts at the last '='. // - Size pos (s.rfind ('=')); + size_t pos (s.rfind ('=')); // If no delimiter found then both base and include are empty. // @@ -107,13 +105,13 @@ namespace CXX } public: - Boolean + bool fixed_length (SemanticGraph::Type& t) { - return t.context ().get ("fixed"); + return t.context ().get ("fixed"); } - Boolean + bool recursive (SemanticGraph::Type& t) { return t.context ().count ("recursive"); @@ -125,7 +123,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; @@ -212,25 +210,23 @@ namespace CXX String include; }; - typedef - Cult::Containers::Map - CustomParserMap; + typedef map CustomParserMap; private: String const impl_suffix_; String const aggr_suffix_; CustomParserMap custom_parser_map_; - Cult::Containers::Map global_type_names_; + map global_type_names_; public: options_type const& options; - Boolean aggregate; + bool aggregate; String const& impl_suffix; String const& aggr_suffix; CustomParserMap const& custom_parser_map; - Cult::Containers::Map& global_type_names; + map& global_type_names; }; // @@ -242,7 +238,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -268,7 +264,7 @@ namespace CXX if (!name) return; - Boolean fl (fixed_length (e)); + bool fl (fixed_length (e)); NameSet set; set.insert (name); @@ -297,7 +293,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { SemanticGraph::Context& lc (l.context ()); @@ -331,7 +327,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Context& uc (u.context ()); @@ -368,7 +364,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { if (c.max () != 1) @@ -393,7 +389,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -409,7 +405,7 @@ namespace CXX // // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) restriction = c.inherits ().is_a () && @@ -472,7 +468,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -482,8 +478,8 @@ namespace CXX // See if this parser is being customized. // - Boolean custom (false); - CustomParserMap::ConstIterator i (custom_parser_map.find (name)); + bool custom (false); + CustomParserMap::const_iterator i (custom_parser_map.find (name)); if (i != custom_parser_map.end ()) { @@ -550,10 +546,10 @@ namespace CXX process (*last_); } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - Boolean p (false); + bool p (false); if (last_ == 0 && options.root_element_first ()) p = true; @@ -595,7 +591,7 @@ namespace CXX } private: - Void + void process (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -618,7 +614,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -669,7 +665,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -681,7 +677,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -693,7 +689,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -705,16 +701,16 @@ namespace CXX } } - static Char const* seen_key; + static char const* seen_key; }; - Char const* Uses::seen_key = "cxx-hybrid-parser-name-processor-seen"; + char const* Uses::seen_key = "cxx-hybrid-parser-name-processor-seen"; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -776,11 +772,11 @@ namespace CXX } } - Boolean ParserNameProcessor:: + bool ParserNameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { try { diff --git a/xsde/cxx/hybrid/parser-name-processor.hxx b/xsde/cxx/hybrid/parser-name-processor.hxx index 20721ee..d5fd390 100644 --- a/xsde/cxx/hybrid/parser-name-processor.hxx +++ b/xsde/cxx/hybrid/parser-name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_HYBRID_PARSER_NAME_PROCESSOR_HXX #define CXX_HYBRID_PARSER_NAME_PROCESSOR_HXX -#include - #include +#include #include namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class ParserNameProcessor { public: - Boolean + bool process (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/hybrid/parser-source.cxx b/xsde/cxx/hybrid/parser-source.cxx index 3b6ed31..a5df5bc 100644 --- a/xsde/cxx/hybrid/parser-source.cxx +++ b/xsde/cxx/hybrid/parser-source.cxx @@ -23,10 +23,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { - Boolean clear (false); + bool clear (false); if (scope_ == 0) { @@ -70,7 +70,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { using SemanticGraph::Enumeration; @@ -96,7 +96,7 @@ namespace CXX names_ >> enumerator_; } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -119,9 +119,9 @@ namespace CXX << "//" << endl << endl; - Boolean fl (fixed_length (e)); + bool fl (fixed_length (e)); - Boolean val (!options.suppress_validation () && + bool val (!options.suppress_validation () && !options.suppress_parser_val ()); SemanticGraph::Context& ec (e.context ()); @@ -430,7 +430,7 @@ namespace CXX os << type << "* r = this->" << state << ".x_;" << "this->" << state << ".x_ = 0;"; - Boolean flb (fixed_length (b)); + bool flb (fixed_length (b)); // Copy the value if our base is fixed-length. // @@ -486,7 +486,7 @@ namespace CXX << "}"; } - virtual Void + virtual void comma (Type&) { os << "else "; @@ -509,7 +509,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (epimpl_custom (l)); @@ -662,7 +662,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (epimpl_custom (u)); @@ -863,13 +863,13 @@ namespace CXX // for the current element in the container is returned. // String - access_seq (SemanticGraph::Particle& p, Boolean element = true) + access_seq (SemanticGraph::Particle& p, bool element = true) { using namespace SemanticGraph; String r; - Boolean seq (false); + bool seq (false); Compositor* c; @@ -957,7 +957,7 @@ namespace CXX if (!seq) { - Boolean fixed (fixed_length (t)); + bool fixed (fixed_length (t)); String const& s (epstate_member (t)); if (!r) @@ -1036,24 +1036,24 @@ namespace CXX struct CompositorTest: Traversal::Compositor { - CompositorTest (Boolean& p) + CompositorTest (bool& p) : p_ (p) { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // We are only interested in var-length required compositors. // if (c.max () == 1 && c.min () == 1 && - !c.context ().get ("fixed")) + !c.context ().get ("fixed")) p_ = true; } private: - Boolean& p_; + bool& p_; }; // @@ -1070,7 +1070,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -1129,7 +1129,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { String const& s (epimpl_custom (scope (c))); @@ -1350,7 +1350,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -1487,7 +1487,7 @@ namespace CXX } private: - Boolean init_; + bool init_; CompositorTest compositor_test_; }; @@ -1498,7 +1498,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Complex; @@ -1547,7 +1547,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Complex; @@ -1598,7 +1598,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (epimpl_custom (c)); @@ -1606,15 +1606,15 @@ namespace CXX if (!name) return; - Boolean hb (c.inherits_p ()); - Boolean restriction (restriction_p (c)); - Boolean fixed (fixed_length (c)); - Boolean rec (recursive (c)); + bool hb (c.inherits_p ()); + bool restriction (restriction_p (c)); + bool fixed (fixed_length (c)); + bool rec (recursive (c)); - Boolean validation (!options.suppress_validation () && + bool validation (!options.suppress_validation () && !options.suppress_parser_val ()); - Boolean c_string_base (false); + bool c_string_base (false); if (!stl && hb) { StringType test (c_string_base); @@ -2086,7 +2086,7 @@ namespace CXX }; } - Void + void generate_parser_source (Context& ctx, Regex const& hxx_obj_expr) { if (ctx.enum_) diff --git a/xsde/cxx/hybrid/parser-source.hxx b/xsde/cxx/hybrid/parser-source.hxx index b664041..5a02361 100644 --- a/xsde/cxx/hybrid/parser-source.hxx +++ b/xsde/cxx/hybrid/parser-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_parser_source (Context&, Regex const& hxx_obj_expr); } } diff --git a/xsde/cxx/hybrid/serializer-aggregate-header.cxx b/xsde/cxx/hybrid/serializer-aggregate-header.cxx index cfcb203..e8316b7 100644 --- a/xsde/cxx/hybrid/serializer-aggregate-header.cxx +++ b/xsde/cxx/hybrid/serializer-aggregate-header.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include #include @@ -10,8 +12,7 @@ #include #include -#include -#include +using namespace std; namespace CXX { @@ -19,7 +20,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Set InstanceSet; + typedef set InstanceSet; // For base types we only want member's types, but not the // base itself. @@ -33,7 +34,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -45,7 +46,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -147,7 +148,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -159,7 +160,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -172,7 +173,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -196,7 +197,7 @@ namespace CXX } } - virtual Void + virtual void collect (SemanticGraph::Type& t) { using SemanticGraph::Type; @@ -227,7 +228,7 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { if (fund_type (t, "any_type")) @@ -237,7 +238,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { fund_type (t, "any_simple_type"); @@ -245,7 +246,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -253,79 +254,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"); @@ -333,19 +334,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"); @@ -353,49 +354,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"); @@ -404,7 +405,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -413,19 +414,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"); @@ -433,7 +434,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -441,13 +442,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"); @@ -456,55 +457,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"); @@ -512,20 +513,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 Boolean + virtual bool fund_type (SemanticGraph::Type& t, String const& name) { if (map_.find (&t) == map_.end ()) @@ -542,7 +543,7 @@ namespace CXX { String name (escape (raw_name + L"_s_")); - 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; @@ -584,7 +585,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -592,7 +593,7 @@ namespace CXX if (!tc.count ("saggr")) return; - Boolean poly (polymorphic (t)); + bool poly (polymorphic (t)); String const& name (tc.get ("saggr")); String pre (unclash (name, "pre")); @@ -757,7 +758,7 @@ namespace CXX os << "public:" << endl; - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) os << fq_name (*i->first, "s:impl") << " " << i->second << ";"; @@ -781,7 +782,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -790,7 +791,7 @@ namespace CXX return; SemanticGraph::Type& t (e.type ()); - Boolean poly (polymorphic (t)); + bool poly (polymorphic (t)); String const& name (ec.get ("saggr")); String pre (unclash (name, "pre")); @@ -972,7 +973,7 @@ namespace CXX os << "public:" << endl; - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) os << fq_name (*i->first, "s:impl") << " " << i->second << ";"; @@ -990,10 +991,10 @@ namespace CXX }; } - Void + void generate_serializer_aggregate_header (Context& ctx) { - Boolean gen (false); + bool gen (false); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/serializer-aggregate-header.hxx b/xsde/cxx/hybrid/serializer-aggregate-header.hxx index 7c0d73a..8836261 100644 --- a/xsde/cxx/hybrid/serializer-aggregate-header.hxx +++ b/xsde/cxx/hybrid/serializer-aggregate-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_serializer_aggregate_header (Context&); } } diff --git a/xsde/cxx/hybrid/serializer-aggregate-source.cxx b/xsde/cxx/hybrid/serializer-aggregate-source.cxx index e9edeea..ef7ff76 100644 --- a/xsde/cxx/hybrid/serializer-aggregate-source.cxx +++ b/xsde/cxx/hybrid/serializer-aggregate-source.cxx @@ -9,8 +9,6 @@ #include #include -#include - namespace CXX { namespace Hybrid @@ -21,8 +19,8 @@ namespace CXX { ParticleArg (Context& c, TypeInstanceMap& map, - Boolean& first, - Boolean poly, + bool& first, + bool poly, String const& arg) : Context (c), poly_ (poly), @@ -33,7 +31,7 @@ namespace CXX { } - ParticleArg (Context& c, Boolean& result, Boolean poly) + ParticleArg (Context& c, bool& result, bool poly) : Context (c), poly_ (poly), map_ (0), @@ -42,7 +40,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_ && anonymous (e.type ())) @@ -66,26 +64,26 @@ namespace CXX } private: - Boolean poly_; + bool poly_; TypeInstanceMap* map_; - Boolean* first_; - Boolean* result_; + bool* first_; + bool* result_; String arg_; }; 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), result_ (0) { } - AttributeArg (Context& c, Boolean& result) + AttributeArg (Context& c, bool& result) : Context (c), map_ (0), first_ (0), result_ (&result) { } - virtual Void + virtual void traverse (Type& a) { if (result_ != 0) @@ -104,8 +102,8 @@ namespace CXX private: TypeInstanceMap* map_; - Boolean* first_; - Boolean* result_; + bool* first_; + bool* result_; }; struct ArgList : Traversal::Complex, @@ -114,7 +112,7 @@ namespace CXX { ArgList (Context& c, TypeInstanceMap& map, - Boolean poly, + bool poly, String const& arg) : Context (c), poly_ (poly), @@ -135,7 +133,7 @@ namespace CXX names_ >> attribute_; } - ArgList (Context& c, Boolean& result, Boolean poly) + ArgList (Context& c, bool& result, bool poly) : Context (c), poly_ (poly), map_ (0), @@ -154,7 +152,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -166,7 +164,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -187,7 +185,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; TypeInstanceMap* map_; Traversal::Inherits inherits_; @@ -200,8 +198,8 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; - Boolean* result_; + bool first_; + bool* result_; }; struct SerializerConnect: Traversal::List, @@ -210,13 +208,13 @@ namespace CXX { SerializerConnect (Context& c, TypeInstanceMap& map, - Boolean poly, + bool poly, String const& map_inst = String ()) : Context (c), poly_ (poly), map_ (map), map_inst_ (map_inst) { } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -227,7 +225,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (has_members (c)) @@ -244,17 +242,17 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { - Boolean r (false); + bool r (false); ArgList test (*this, r, poly_); test.traverse (c); return r; } private: - Boolean poly_; + bool poly_; TypeInstanceMap& map_; String map_inst_; }; @@ -268,7 +266,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -310,9 +308,9 @@ namespace CXX String const& entry ( tc.get ("saggr-serializer-map-entries")); - Size n (0); + size_t n (0); - for (TypeIdInstanceMap::Iterator i (tid_map->begin ()); + for (TypeIdInstanceMap::iterator i (tid_map->begin ()); i != tid_map->end (); ++i, ++n) { @@ -328,7 +326,7 @@ namespace CXX // SerializerConnect connect (*this, map, false); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); @@ -339,7 +337,7 @@ namespace CXX SerializerConnect connect ( *this, map, true, tc.get ("saggr-serializer-map")); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); } @@ -355,7 +353,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -397,9 +395,9 @@ namespace CXX String const& entry ( ec.get ("saggr-serializer-map-entries")); - Size n (0); + size_t n (0); - for (TypeIdInstanceMap::Iterator i (tid_map->begin ()); + for (TypeIdInstanceMap::iterator i (tid_map->begin ()); i != tid_map->end (); ++i, ++n) { @@ -415,7 +413,7 @@ namespace CXX // SerializerConnect connect (*this, map, false); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); @@ -426,7 +424,7 @@ namespace CXX SerializerConnect connect ( *this, map, true, ec.get ("saggr-serializer-map")); - for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); + for (TypeInstanceMap::iterator i (map.begin ()), end (map.end ()); i != end; ++i) connect.dispatch (*i->first); } @@ -456,10 +454,10 @@ namespace CXX }; } - Void + void generate_serializer_aggregate_source (Context& ctx) { - Boolean gen (false); + bool gen (false); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/serializer-aggregate-source.hxx b/xsde/cxx/hybrid/serializer-aggregate-source.hxx index ba2357d..11bfd97 100644 --- a/xsde/cxx/hybrid/serializer-aggregate-source.hxx +++ b/xsde/cxx/hybrid/serializer-aggregate-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_serializer_aggregate_source (Context&); } } diff --git a/xsde/cxx/hybrid/serializer-header.cxx b/xsde/cxx/hybrid/serializer-header.cxx index 2297474..7a4117f 100644 --- a/xsde/cxx/hybrid/serializer-header.cxx +++ b/xsde/cxx/hybrid/serializer-header.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (c.inherits_p ()) @@ -52,7 +52,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -156,7 +156,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (esimpl_custom (l)); @@ -236,7 +236,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (esimpl_custom (u)); @@ -298,7 +298,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { if (c.max () != 1) @@ -323,7 +323,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -353,7 +353,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -368,12 +368,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) { @@ -396,10 +396,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) { @@ -425,10 +425,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) { @@ -458,7 +458,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.optional_p ()) @@ -513,7 +513,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (esimpl_custom (c)); @@ -527,16 +527,16 @@ 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)); + bool restriction (restriction_p (c)); - Boolean hb (c.inherits_p ()); - Boolean he (has (c)); - Boolean ha (has (c)); + bool hb (c.inherits_p ()); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); - Boolean haa (has (c)); + bool hae (has_particle (c)); + bool haa (has (c)); - Boolean rec (recursive (c)); + bool rec (recursive (c)); String const& arg (sarg_type (c)); @@ -689,7 +689,7 @@ namespace CXX }; } - Void + void generate_serializer_header (Context& ctx) { ctx.os << "#include " << endl diff --git a/xsde/cxx/hybrid/serializer-header.hxx b/xsde/cxx/hybrid/serializer-header.hxx index ddf3ded..9e6f8d6 100644 --- a/xsde/cxx/hybrid/serializer-header.hxx +++ b/xsde/cxx/hybrid/serializer-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_serializer_header (Context&); } } diff --git a/xsde/cxx/hybrid/serializer-name-processor.cxx b/xsde/cxx/hybrid/serializer-name-processor.cxx index 4071ecb..b29b509 100644 --- a/xsde/cxx/hybrid/serializer-name-processor.cxx +++ b/xsde/cxx/hybrid/serializer-name-processor.cxx @@ -3,6 +3,11 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include +#include +#include + #include #include #include @@ -10,10 +15,7 @@ #include #include -#include - -#include -#include +using namespace std; namespace CXX { @@ -21,10 +23,7 @@ namespace CXX { namespace { - // - // - typedef Cult::Containers::Set NameSet; - + typedef set NameSet; struct Failed {}; class Context: public CXX::Context @@ -60,7 +59,7 @@ namespace CXX // Split the string in two parts at the last '='. // - Size pos (s.rfind ('=')); + size_t pos (s.rfind ('=')); // If no delimiter found then both base and include are empty. // @@ -111,7 +110,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; @@ -129,7 +128,7 @@ namespace CXX } public: - Boolean + bool recursive (SemanticGraph::Type& t) { return t.context ().count ("recursive"); @@ -205,25 +204,23 @@ namespace CXX String include; }; - typedef - Cult::Containers::Map - CustomSerializerMap; + typedef map CustomSerializerMap; private: String const impl_suffix_; String const aggr_suffix_; CustomSerializerMap custom_serializer_map_; - Cult::Containers::Map global_type_names_; + map global_type_names_; public: options_type const& options; - Boolean aggregate; + bool aggregate; String const& impl_suffix; String const& aggr_suffix; CustomSerializerMap const& custom_serializer_map; - Cult::Containers::Map& global_type_names; + map& global_type_names; }; // @@ -235,7 +232,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -283,7 +280,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { SemanticGraph::Context& lc (l.context ()); @@ -319,7 +316,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Context& uc (u.context ()); @@ -350,7 +347,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { if (c.max () != 1) @@ -375,7 +372,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -400,7 +397,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -416,7 +413,7 @@ namespace CXX // // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) restriction = c.inherits ().is_a () && @@ -479,7 +476,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& tc (t.context ()); @@ -489,8 +486,8 @@ namespace CXX // See if this serializer is being customized. // - Boolean custom (false); - CustomSerializerMap::ConstIterator i ( + bool custom (false); + CustomSerializerMap::const_iterator i ( custom_serializer_map.find (name)); if (i != custom_serializer_map.end ()) @@ -558,10 +555,10 @@ namespace CXX process (*last_); } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - Boolean p (false); + bool p (false); if (last_ == 0 && options.root_element_first ()) p = true; @@ -602,7 +599,7 @@ namespace CXX } private: - Void + void process (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -625,7 +622,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -676,7 +673,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -688,7 +685,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -700,7 +697,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -712,16 +709,16 @@ namespace CXX } } - static Char const* seen_key; + static char const* seen_key; }; - Char const* Uses::seen_key = "cxx-hybrid-serializer-name-processor-seen"; + char const* Uses::seen_key = "cxx-hybrid-serializer-name-processor-seen"; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -783,11 +780,11 @@ namespace CXX } } - Boolean SerializerNameProcessor:: + bool SerializerNameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { try { diff --git a/xsde/cxx/hybrid/serializer-name-processor.hxx b/xsde/cxx/hybrid/serializer-name-processor.hxx index 0840f52..f7e3ea4 100644 --- a/xsde/cxx/hybrid/serializer-name-processor.hxx +++ b/xsde/cxx/hybrid/serializer-name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_HYBRID_SERIALIZER_NAME_PROCESSOR_HXX #define CXX_HYBRID_SERIALIZER_NAME_PROCESSOR_HXX -#include - #include +#include #include namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class SerializerNameProcessor { public: - Boolean + bool process (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/hybrid/serializer-source.cxx b/xsde/cxx/hybrid/serializer-source.cxx index d99d167..d93ffa4 100644 --- a/xsde/cxx/hybrid/serializer-source.cxx +++ b/xsde/cxx/hybrid/serializer-source.cxx @@ -30,38 +30,38 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens&) { os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName&) { if (!stl) os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs&) { os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary&) { os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary&) { os << "&"; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&) { os << "&"; @@ -77,10 +77,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { - Boolean clear (false); + bool clear (false); if (scope_ == 0) { @@ -127,7 +127,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -239,7 +239,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (esimpl_custom (l)); @@ -306,7 +306,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (esimpl_custom (u)); @@ -367,13 +367,13 @@ namespace CXX // for the current element in the container is returned. // String - access_seq (SemanticGraph::Particle& p, Boolean element = true) + access_seq (SemanticGraph::Particle& p, bool element = true) { using namespace SemanticGraph; String r; - Boolean seq (false); + bool seq (false); Compositor* c; @@ -538,19 +538,19 @@ namespace CXX struct CompositorTest: Traversal::Choice, Traversal::Sequence { - CompositorTest (Boolean& seq) + CompositorTest (bool& seq) : seq_ (seq) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) seq_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -564,17 +564,17 @@ namespace CXX } private: - Boolean& seq_; + bool& seq_; }; struct ParticleTest: Traversal::Element { - ParticleTest (Boolean& seq) + ParticleTest (bool& seq) : seq_ (seq) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -582,7 +582,7 @@ namespace CXX } private: - Boolean& seq_; + bool& seq_; }; // @@ -598,7 +598,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -617,7 +617,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -650,7 +650,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -691,7 +691,7 @@ namespace CXX contains_particle_test_ >> particle_test_; } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -710,7 +710,7 @@ namespace CXX All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { SemanticGraph::Complex& t (scope (c)); @@ -831,7 +831,7 @@ namespace CXX Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { String const& sc (esimpl_custom (scope (s))); @@ -906,7 +906,7 @@ namespace CXX private: Traversal::ContainsParticle& init_; - Boolean seq_; + bool seq_; CompositorTest compositor_test_; ParticleTest particle_test_; Traversal::ContainsParticle contains_particle_test_; @@ -919,7 +919,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& s ( @@ -1039,7 +1039,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& s ( @@ -1056,7 +1056,7 @@ namespace CXX if (a.default_p ()) { - Boolean omit (options.omit_default_attributes ()); + bool omit (options.omit_default_attributes ()); if (a.fixed_p ()) os << "return " << (omit ? "false" : "true") << ";"; @@ -1132,7 +1132,7 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { String const& name (esimpl_custom (c)); @@ -1140,11 +1140,11 @@ namespace CXX if (!name) return; - Boolean hb (c.inherits_p ()); - Boolean rec (recursive (c)); - Boolean restriction (restriction_p (c)); + bool hb (c.inherits_p ()); + bool rec (recursive (c)); + bool restriction (restriction_p (c)); - Boolean validation (!options.suppress_validation () && + bool validation (!options.suppress_validation () && !options.suppress_serializer_val ()); String state; @@ -1392,7 +1392,7 @@ namespace CXX }; } - Void + void generate_serializer_source (Context& ctx, Regex const& hxx_obj_expr) { if (ctx.poly_code && !ctx.stl) diff --git a/xsde/cxx/hybrid/serializer-source.hxx b/xsde/cxx/hybrid/serializer-source.hxx index 17caaee..76a7ab4 100644 --- a/xsde/cxx/hybrid/serializer-source.hxx +++ b/xsde/cxx/hybrid/serializer-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_serializer_source (Context&, Regex const& hxx_obj_expr); } } diff --git a/xsde/cxx/hybrid/tree-forward.cxx b/xsde/cxx/hybrid/tree-forward.cxx index 6fbd424..bd2fdeb 100644 --- a/xsde/cxx/hybrid/tree-forward.cxx +++ b/xsde/cxx/hybrid/tree-forward.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -65,7 +65,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { SemanticGraph::Context& ctx (l.context ()); @@ -97,7 +97,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Context& ctx (u.context ()); @@ -129,7 +129,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& ctx (c.context ()); @@ -234,13 +234,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType&) { gen_using ("::xsde::cxx::hybrid::any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { gen_typedef ("any_simple_type", string_type_); @@ -253,7 +253,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { gen_typedef ("boolean", "bool"); @@ -263,7 +263,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&) { gen_typedef ("byte", "signed char"); @@ -271,7 +271,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&) { gen_typedef ("unsigned_byte", "unsigned char"); @@ -279,7 +279,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&) { gen_typedef ("short", "short"); @@ -287,7 +287,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&) { gen_typedef ("unsigned_short", "unsigned short"); @@ -295,7 +295,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&) { gen_typedef ("int", "int"); @@ -303,7 +303,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&) { gen_typedef ("unsigned_int", "unsigned int"); @@ -311,7 +311,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&) { gen_typedef ("long", long_type_); @@ -319,7 +319,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&) { gen_typedef ("unsigned_long", unsigned_long_type_); @@ -327,7 +327,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&) { gen_typedef ("integer", "long"); @@ -335,7 +335,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&) { gen_typedef ("negative_integer", "long"); @@ -343,7 +343,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { gen_typedef ("non_positive_integer", "long"); @@ -351,7 +351,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&) { gen_typedef ("positive_integer", "unsigned long"); @@ -359,7 +359,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { gen_typedef ("non_negative_integer", "unsigned long"); @@ -369,7 +369,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&) { gen_typedef ("float", "float"); @@ -377,7 +377,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&) { gen_typedef ("double", "double"); @@ -385,7 +385,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&) { gen_typedef ("decimal", "double"); @@ -395,7 +395,7 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { gen_typedef ("string", string_type_); @@ -406,7 +406,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { gen_typedef ("normalized_string", string_type_); @@ -417,7 +417,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { gen_typedef ("token", string_type_); @@ -426,7 +426,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { gen_typedef ("nmtoken", string_type_); @@ -435,14 +435,14 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens&) { gen_typedef ("nmtokens", "::xsde::cxx::string_sequence"); os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { gen_typedef ("name", string_type_); @@ -451,7 +451,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { gen_typedef ("ncname", string_type_); @@ -460,7 +460,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { gen_typedef ("language", string_type_); @@ -471,7 +471,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName&) { gen_using ("::xsde::cxx::qname"); @@ -480,7 +480,7 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { gen_typedef ("id", string_type_); @@ -489,7 +489,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { gen_typedef ("idref", string_type_); @@ -498,7 +498,7 @@ namespace CXX os << endl; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs&) { gen_typedef ("idrefs", "::xsde::cxx::string_sequence"); @@ -507,7 +507,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { gen_typedef ("uri", string_type_); @@ -518,14 +518,14 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary&) { gen_using ("::xsde::cxx::buffer"); gen_typedef ("base64_binary", "::xsde::cxx::buffer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary&) { gen_typedef ("hex_binary", "::xsde::cxx::buffer"); @@ -535,56 +535,56 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date&) { gen_using ("::xsde::cxx::time_zone"); gen_using ("::xsde::cxx::date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime&) { gen_using ("::xsde::cxx::date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration&) { gen_using ("::xsde::cxx::duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day&) { gen_using ("::xsde::cxx::gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month&) { gen_using ("::xsde::cxx::gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay&) { gen_using ("::xsde::cxx::gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year&) { gen_using ("::xsde::cxx::gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth&) { gen_using ("::xsde::cxx::gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time&) { gen_using ("::xsde::cxx::time"); @@ -592,24 +592,24 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&) { } private: - Void + void gen_typedef (String const& name, String const& type) { os << "typedef " << type << " " << escape (name) << ";"; } - Void + void gen_using (String const& name) { os << "using " << name << ";"; @@ -667,8 +667,8 @@ namespace CXX // Data representation stream types. // - Boolean icdr (false), ocdr (false); - Boolean ixdr (false), oxdr (false); + bool icdr (false), ocdr (false); + bool ixdr (false), oxdr (false); for (NarrowStrings::const_iterator i (istreams.begin ()); i != istreams.end (); ++i) @@ -721,8 +721,8 @@ namespace CXX }; } - Void - generate_tree_forward (Context& ctx, Boolean generate_xml_schema) + void + generate_tree_forward (Context& ctx, bool generate_xml_schema) { NarrowString xml_schema (ctx.options.extern_xml_schema ()); diff --git a/xsde/cxx/hybrid/tree-forward.hxx b/xsde/cxx/hybrid/tree-forward.hxx index 5b5fa84..84cf830 100644 --- a/xsde/cxx/hybrid/tree-forward.hxx +++ b/xsde/cxx/hybrid/tree-forward.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Hybrid { - Void - generate_tree_forward (Context&, Boolean generate_xml_schema); + void + generate_tree_forward (Context&, bool generate_xml_schema); } } diff --git a/xsde/cxx/hybrid/tree-header.cxx b/xsde/cxx/hybrid/tree-header.cxx index ae24feb..0cbbaf4 100644 --- a/xsde/cxx/hybrid/tree-header.cxx +++ b/xsde/cxx/hybrid/tree-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { os << ename (e); @@ -39,7 +39,7 @@ namespace CXX names_ >> enumerator_; } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -61,9 +61,9 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (e)); - Boolean cd (ec.count ("cd-name")); - Boolean poly (polymorphic (e)); + bool fl (fixed_length (e)); + bool cd (ec.count ("cd-name")); + bool poly (polymorphic (e)); String const& vt (ec.get ("value-type")); os << "// " << comment (e.name ()) << " (" << @@ -237,7 +237,7 @@ namespace CXX } } - virtual Void + virtual void comma (Type&) { os << "," << endl; @@ -258,7 +258,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { SemanticGraph::Context& lc (l.context ()); @@ -269,8 +269,8 @@ namespace CXX // if (name) { - Boolean cd (lc.count ("cd-name")); - Boolean poly (polymorphic (l)); + bool cd (lc.count ("cd-name")); + bool poly (polymorphic (l)); os << "// " << comment (l.name ()) << " (variable-length)" << endl << "//" << endl; @@ -397,7 +397,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Context& uc (u.context ()); @@ -408,9 +408,9 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (u)); - Boolean poly (polymorphic (u)); - Boolean cd (uc.count ("cd-name")); + bool fl (fixed_length (u)); + bool poly (polymorphic (u)); + bool cd (uc.count ("cd-name")); os << "// " << comment (u.name ()) << " (" << (fl ? "fixed-length" : "variable-length") << ")" << endl @@ -694,7 +694,7 @@ namespace CXX // length types. // - Void + void dispatch (SemanticGraph::Node& n) { rank_ = 1; @@ -705,19 +705,19 @@ namespace CXX os << type_; } - virtual Void + virtual void traverse (SemanticGraph::List&) { align_type ("size_t", 5); } - virtual Void + virtual void traverse (SemanticGraph::Union&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { Complex::inherits (c, inherits_); @@ -730,7 +730,7 @@ namespace CXX // anySimpleType // - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType&) { align_type ("size_t", 5); // std::string @@ -738,7 +738,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean&) { // In worst case scenario bool is 4 bytes. Assume that. @@ -748,43 +748,43 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte&) { align_type ("signed char", 1); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte&) { align_type ("unsigned char", 1); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short&) { align_type ("short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort&) { align_type ("unsigned short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int&) { align_type ("int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt&) { align_type ("unsigned int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long&) { if (options.no_long_long ()) @@ -793,7 +793,7 @@ namespace CXX align_type ("long long", 8); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong&) { if (options.no_long_long ()) @@ -802,31 +802,31 @@ namespace CXX align_type ("unsigned long long", 8); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer&) { align_type ("long", 5); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger&) { align_type ("long", 5); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger&) { align_type ("unsigned long", 5); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger&) { align_type ("unsigned long", 5); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger&) { align_type ("long", 5); @@ -834,19 +834,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float&) { align_type ("float", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double&) { align_type ("double", 7); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal&) { align_type ("double", 7); @@ -854,43 +854,43 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { align_type ("size_t", 5); // std::string @@ -898,7 +898,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName&) { align_type ("size_t", 5); // std::string @@ -906,13 +906,13 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { align_type ("size_t", 5); // std::string } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { align_type ("size_t", 5); // std::string @@ -920,7 +920,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { align_type ("size_t", 5); // std::string @@ -928,55 +928,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date&) { align_type ("int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime&) { align_type ("double", 7); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration&) { align_type ("double", 7); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day&) { align_type ("short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month&) { align_type ("short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay&) { align_type ("short", 2); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year&) { align_type ("int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth&) { align_type ("int", 4); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time&) { align_type ("double", 7); @@ -984,15 +984,15 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { align_type ("size_t", 5); // std::string } private: - Void - align_type (Char const* type, unsigned short rank) + void + align_type (char const* type, unsigned short rank) { if (rank > rank_) { @@ -1010,7 +1010,7 @@ namespace CXX struct Attribute: Traversal::Attribute { - virtual Void + virtual void traverse (Type& a) { if (!a.fixed_p ()) @@ -1035,7 +1035,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1062,7 +1062,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -1092,7 +1092,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () != 1) @@ -1147,7 +1147,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1178,7 +1178,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -1216,7 +1216,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // For choice in choice we always have a nested class. @@ -1263,7 +1263,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -1293,7 +1293,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // For sequence in choice we always have a nested class. @@ -1347,18 +1347,18 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { os << "// " << comment (a.name ()) << endl << "//" << endl; - Boolean def (a.default_p ()); - Boolean fix (a.fixed_p ()); + bool def (a.default_p ()); + bool fix (a.fixed_p ()); String const& name (ename (a)); SemanticGraph::Type& t (a.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); if (a.optional_p () && !fix) @@ -1447,7 +1447,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { os << "// " << comment (e.name ()) << endl @@ -1455,7 +1455,7 @@ namespace CXX String const& name (ename (e)); SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); if (e.max () != 1) { @@ -1558,7 +1558,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1566,8 +1566,8 @@ namespace CXX // if (a.min () == 0) { - Boolean fl (fixed_length (a)); - Boolean cd (a.context ().count ("cd-name")); + bool fl (fixed_length (a)); + bool cd (a.context ().count ("cd-name")); String const& name (ename (a)); String const& type (etype (a)); @@ -1733,31 +1733,31 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { emit_tag (etag (e)); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { emit_tag (etag (a)); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { emit_tag (etag (c)); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { emit_tag (etag (s)); } - virtual Void + virtual void emit_tag (String const& tag) { if (first_) @@ -1769,7 +1769,7 @@ namespace CXX } private: - Boolean first_; + bool first_; }; struct ChoiceInSequence: Traversal::Choice, Context @@ -1780,14 +1780,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); String const& name (ename (c)); - Boolean fl; + bool fl; String type; if (max != 1 || min == 0) @@ -1871,7 +1871,7 @@ namespace CXX if (max != 1 || min == 0) { - Boolean cd (c.context ().count ("cd-name")); + bool cd (c.context ().count ("cd-name")); // Custom data. // @@ -2029,16 +2029,16 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When shoice is in choice we generate nested class even // for min == max == 1. // - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); - Boolean fl (fixed_length (c)); - Boolean cd (c.context ().count ("cd-name")); + bool fl (fixed_length (c)); + bool cd (c.context ().count ("cd-name")); String const& name (ename (c)); String const& type (etype (c)); @@ -2268,10 +2268,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 == 1) { @@ -2279,8 +2279,8 @@ namespace CXX return; } - Boolean fl (fixed_length (s)); - Boolean cd (s.context ().count ("cd-name")); + bool fl (fixed_length (s)); + bool cd (s.context ().count ("cd-name")); String const& name (ename (s)); String const& type (etype (s)); @@ -2474,14 +2474,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even // for min == max == 1. // - Boolean fl (fixed_length (s)); - Boolean cd (s.context ().count ("cd-name")); + bool fl (fixed_length (s)); + bool cd (s.context ().count ("cd-name")); String const& name (ename (s)); String const& type (etype (s)); @@ -2740,7 +2740,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -2751,10 +2751,10 @@ namespace CXX // if (name) { - Boolean fl (fixed_length (c)); - Boolean poly (polymorphic (c)); - Boolean restriction (restriction_p (c)); - Boolean cd (cc.count ("cd-name")); + bool fl (fixed_length (c)); + bool poly (polymorphic (c)); + bool restriction (restriction_p (c)); + bool cd (cc.count ("cd-name")); os << "// " << comment (c.name ()) << " (" << (fl ? "fixed-length" : "variable-length") << ")" << endl @@ -2943,10 +2943,10 @@ namespace CXX }; } - Void + void generate_tree_header (Context& ctx) { - Boolean inline_ (ctx.options.generate_inline ()); + bool inline_ (ctx.options.generate_inline ()); // Emit header includes. // diff --git a/xsde/cxx/hybrid/tree-header.hxx b/xsde/cxx/hybrid/tree-header.hxx index 0259349..2ca8914 100644 --- a/xsde/cxx/hybrid/tree-header.hxx +++ b/xsde/cxx/hybrid/tree-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_tree_header (Context&); } } diff --git a/xsde/cxx/hybrid/tree-inline.cxx b/xsde/cxx/hybrid/tree-inline.cxx index 2f6815e..2d845f4 100644 --- a/xsde/cxx/hybrid/tree-inline.cxx +++ b/xsde/cxx/hybrid/tree-inline.cxx @@ -24,7 +24,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -131,7 +131,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -195,7 +195,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -361,11 +361,11 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { - Boolean def (a.default_p ()); - Boolean fix (a.fixed_p ()); + bool def (a.default_p ()); + bool fix (a.fixed_p ()); String const& name (ename (a)); String member; @@ -374,7 +374,7 @@ namespace CXX member = emember (a); SemanticGraph::Type& t (a.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); String scope (Context::scope (a)); if (a.optional_p () && !fix) @@ -566,14 +566,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (ename (e)); String const& member (emember (e)); SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); String scope (Context::scope (e)); if (e.max () != 1) @@ -720,7 +720,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (ename (e)); @@ -764,10 +764,10 @@ namespace CXX } else { - UnsignedLong min (e.min ()); + size_t min (e.min ()); SemanticGraph::Type& t (e.type ()); - Boolean fl (fixed_length (t)); + bool fl (fixed_length (t)); String const& tag (etag (e)); String const& arm_member (earm_member (c)); @@ -936,7 +936,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -949,7 +949,7 @@ namespace CXX String const& present (epresent (a)); String const& member (emember (a)); - Boolean fl (fixed_length (a)); + bool fl (fixed_length (a)); String scope (Context::scope (a)); @@ -1077,10 +1077,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { - UnsignedLong min (c.min ()), max (c.max ()); + size_t min (c.min ()), max (c.max ()); if (max == 1 && min == 1) { @@ -1131,7 +1131,7 @@ namespace CXX } else if (min == 0) { - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); String const& type (etype (c)); String const& present (epresent (c)); @@ -1258,10 +1258,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 == 1) { @@ -1300,7 +1300,7 @@ namespace CXX } else if (min == 0) { - Boolean fl (fixed_length (s)); + bool fl (fixed_length (s)); String const& type (etype (s)); String const& present (epresent (s)); @@ -1427,7 +1427,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // When compositor is in choice we generate nested class even @@ -1474,9 +1474,9 @@ namespace CXX } else { - UnsignedLong min (c.min ()); + size_t min (c.min ()); - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); String const& type (etype (c)); String const& tag (etag (c)); @@ -1632,7 +1632,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { CompositorInChoiceFunc::traverse (c); @@ -1646,7 +1646,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { CompositorInChoiceFunc::traverse (s); @@ -1664,7 +1664,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1717,7 +1717,7 @@ namespace CXX struct Choice: Traversal::Choice, Context { Choice (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_func) : Context (c), in_choice_ (in_choice), @@ -1725,7 +1725,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -1785,7 +1785,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_func_; }; @@ -1798,7 +1798,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1 || s.min () == 0) @@ -1855,7 +1855,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -1969,7 +1969,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& scope (ename_custom (c)); @@ -2062,7 +2062,7 @@ namespace CXX }; } - Void + void generate_tree_inline (Context& ctx) { // Generate includes. diff --git a/xsde/cxx/hybrid/tree-inline.hxx b/xsde/cxx/hybrid/tree-inline.hxx index 56f466c..214bfc7 100644 --- a/xsde/cxx/hybrid/tree-inline.hxx +++ b/xsde/cxx/hybrid/tree-inline.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_tree_inline (Context&); } } diff --git a/xsde/cxx/hybrid/tree-name-processor.cxx b/xsde/cxx/hybrid/tree-name-processor.cxx index 0558907..148033e 100644 --- a/xsde/cxx/hybrid/tree-name-processor.cxx +++ b/xsde/cxx/hybrid/tree-name-processor.cxx @@ -3,6 +3,13 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include +#include +#include + +#include + #include #include @@ -11,11 +18,8 @@ #include #include -#include -#include - -#include -#include +using namespace std; +using cutl::shared_ptr; namespace CXX { @@ -23,10 +27,8 @@ namespace CXX { namespace { - // - // - typedef Cult::Containers::Set NameSet; - Char const* member_set_key = "cxx-hybrid-name-processor-member-set"; + typedef set NameSet; + char const* member_set_key = "cxx-hybrid-name-processor-member-set"; class Context: public CXX::Context { @@ -62,10 +64,10 @@ namespace CXX e = name.find (L"::", b); String entry (name, b, e == String::npos ? e : e - b); - Shptr& p ((*map)[entry]); + shared_ptr& p ((*map)[entry]); if (p == 0) - p = Shptr (new CustomDataMap); + p = shared_ptr (new (shared) CustomDataMap); b = e; @@ -73,7 +75,7 @@ namespace CXX { // Last name. Add an empty string to indicate this. // - (*p)[L""] = Shptr (0); + (*p)[L""] = shared_ptr (); break; } @@ -99,7 +101,7 @@ namespace CXX // Split the string in two parts at the last '='. // - Size pos (s.rfind ('=')); + size_t pos (s.rfind ('=')); // If no delimiter found type, base, and include are empty. // @@ -173,19 +175,19 @@ namespace CXX } public: - Boolean + bool fixed_length (SemanticGraph::Type& t) { - return t.context ().get ("fixed"); + return t.context ().get ("fixed"); } - Boolean + bool fixed_length (SemanticGraph::Compositor& c) { - return c.context ().get ("fixed"); + return c.context ().get ("fixed"); } - Void + void mark_variable (SemanticGraph::Compositor& c) { SemanticGraph::Compositor* p (&c); @@ -199,7 +201,7 @@ namespace CXX p = &p->contained_particle ().compositor (); - if (!p->context ().get ("fixed")) + if (!p->context ().get ("fixed")) break; } } @@ -210,7 +212,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; @@ -228,10 +230,7 @@ namespace CXX } public: - struct CustomDataMap: - Cult::Containers::Map > - { - }; + struct CustomDataMap: map > {}; public: struct CustomType @@ -248,25 +247,23 @@ namespace CXX String include; }; - typedef - Cult::Containers::Map - CustomTypeMap; + typedef map CustomTypeMap; private: CustomDataMap custom_data_map_; CustomTypeMap custom_type_map_; - Cult::Containers::Map global_type_names_; + map global_type_names_; public: - Boolean stl; - Boolean detach; - Boolean enum_; + bool stl; + bool detach; + bool enum_; CustomDataMap& custom_data_map; CustomTypeMap& custom_type_map; - Cult::Containers::Map& global_type_names; + map& global_type_names; }; // @@ -280,7 +277,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { a.context ().set ("name", find_name (a.name (), set_)); @@ -297,7 +294,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { e.context ().set ("name", find_name (e.name (), set_)); @@ -314,7 +311,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -332,12 +329,12 @@ namespace CXX struct PrimaryChoice: Traversal::Choice, Context { - PrimaryChoice (Context& c, NameSet& set, Boolean in_choice) + PrimaryChoice (Context& c, NameSet& set, bool in_choice) : Context (c), set_ (set), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // In case of choice assign primary name even if there is @@ -352,17 +349,17 @@ namespace CXX private: NameSet& set_; - Boolean in_choice_; + bool in_choice_; }; struct PrimarySequence: Traversal::Sequence, Context { - PrimarySequence (Context& c, NameSet& set, Boolean in_choice) + PrimarySequence (Context& c, NameSet& set, bool in_choice) : Context (c), set_ (set), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we have nested class even @@ -376,7 +373,7 @@ namespace CXX private: NameSet& set_; - Boolean in_choice_; + bool in_choice_; }; // @@ -385,18 +382,18 @@ namespace CXX struct SecondaryAttribute: Traversal::Attribute, Context { - SecondaryAttribute (Context& c, NameSet& set, Boolean data_members) + SecondaryAttribute (Context& c, NameSet& set, bool data_members) : Context (c), set_ (set), data_members_ (data_members) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { SemanticGraph::Context& ac (a.context ()); - Boolean def (a.default_p ()); - Boolean fix (a.fixed_p ()); + bool def (a.default_p ()); + bool fix (a.fixed_p ()); String const& base (ac.get ("name")); @@ -438,17 +435,17 @@ namespace CXX private: NameSet& set_; - Boolean data_members_; + bool data_members_; }; struct SecondaryElement: Traversal::Element, Context { - SecondaryElement (Context& c, NameSet& set, Boolean data_members) + SecondaryElement (Context& c, NameSet& set, bool data_members) : Context (c), set_ (set), data_members_ (data_members) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Context& ec (e.context ()); @@ -495,7 +492,7 @@ namespace CXX private: NameSet& set_; - Boolean data_members_; + bool data_members_; }; struct SecondaryAll: Traversal::All, Context @@ -503,7 +500,7 @@ namespace CXX SecondaryAll (Context& c, NameSet& set, CustomDataMap* map, - Boolean data_members) + bool data_members) : Context (c), set_ (set), map_ (map), @@ -511,7 +508,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -530,7 +527,7 @@ namespace CXX if (map_) { - CustomDataMap::Iterator i (map_->find (base)); + CustomDataMap::iterator i (map_->find (base)); if (i != map_->end ()) map = i->second.get (); } @@ -621,7 +618,7 @@ namespace CXX private: NameSet& set_; CustomDataMap* map_; - Boolean data_members_; + bool data_members_; }; struct ParticleTag: Traversal::Element, @@ -635,27 +632,27 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& base (e.context ().get ("name")); e.context ().set ("tag", find_name (base, L"_tag", set_)); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { a.context ().set ("tag", find_name (L"any", L"_tag", set_)); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { String const& base (c.context ().get ("name")); c.context ().set ("tag", find_name (base, L"_tag", set_)); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { String const& base (s.context ().get ("name")); @@ -671,8 +668,8 @@ namespace CXX SecondaryChoice (Context& c, NameSet& set, CustomDataMap* map, - Boolean in_choice, - Boolean data_members) + bool in_choice, + bool data_members) : Context (c), set_ (set), map_ (map), @@ -681,17 +678,17 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice&); - Void + void traverse_nested (SemanticGraph::Choice&, NameSet&, CustomDataMap*); private: NameSet& set_; CustomDataMap* map_; - Boolean in_choice_; - Boolean data_members_; + bool in_choice_; + bool data_members_; }; struct SecondarySequence: Traversal::Sequence, Context @@ -699,8 +696,8 @@ namespace CXX SecondarySequence (Context& c, NameSet& set, CustomDataMap* map, - Boolean in_choice, - Boolean data_members) + bool in_choice, + bool data_members) : Context (c), set_ (set), map_ (map), @@ -709,21 +706,21 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence&); - Void + void traverse_nested (SemanticGraph::Sequence&, NameSet&, CustomDataMap*); private: NameSet& set_; CustomDataMap* map_; - Boolean in_choice_; - Boolean data_members_; + bool in_choice_; + bool data_members_; }; - Void SecondaryChoice:: + void SecondaryChoice:: traverse (SemanticGraph::Choice& c) { SemanticGraph::Context& cc (c.context ()); @@ -743,7 +740,7 @@ namespace CXX if (map_) { - CustomDataMap::Iterator i (map_->find (base)); + CustomDataMap::iterator i (map_->find (base)); if (i != map_->end ()) map = i->second.get (); } @@ -774,7 +771,7 @@ namespace CXX cc.set ("arm-tag", find_name (arm + L"_tag", name_set)); { - UnsignedLong count (name_set.size ()); + size_t count (name_set.size ()); ParticleTag particle (*this, name_set); Traversal::ContainsParticle contains (particle); @@ -869,7 +866,7 @@ namespace CXX cc.set ("arm-tag", find_name (arm + L"_tag", set_)); { - UnsignedLong count (set_.size ()); + size_t count (set_.size ()); ParticleTag particle (*this, set_); Traversal::ContainsParticle contains (particle); @@ -889,7 +886,7 @@ namespace CXX } } - Void SecondaryChoice:: + void SecondaryChoice:: traverse_nested (SemanticGraph::Choice& c, NameSet& name_set, CustomDataMap* map) @@ -948,7 +945,7 @@ namespace CXX Choice::contains (c, choice_contains_particle); } - Void SecondarySequence:: + void SecondarySequence:: traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we have nested class even @@ -968,7 +965,7 @@ namespace CXX if (map_) { - CustomDataMap::Iterator i (map_->find (base)); + CustomDataMap::iterator i (map_->find (base)); if (i != map_->end ()) map = i->second.get (); } @@ -1062,7 +1059,7 @@ namespace CXX Sequence::contains (s); } - Void SecondarySequence:: + void SecondarySequence:: traverse_nested (SemanticGraph::Sequence& s, NameSet& name_set, CustomDataMap* map) @@ -1130,7 +1127,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& n (e.name ()); @@ -1149,12 +1146,12 @@ namespace CXX Traversal::Enumeration, Context { - GlobalTypeMembers (Context& c, Boolean data_members) + GlobalTypeMembers (Context& c, bool data_members) : Context (c), data_members_ (data_members) { } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { // First see if we should delegate this one to Complex. @@ -1201,7 +1198,7 @@ namespace CXX // Check if this type has custom data. // - CustomDataMap::Iterator i (custom_data_map.find (e.name ())); + CustomDataMap::iterator i (custom_data_map.find (e.name ())); if (i != custom_data_map.end () && i->second->find (L"") != i->second->end ()) @@ -1232,7 +1229,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { SemanticGraph::Context& lc (l.context ()); @@ -1250,7 +1247,7 @@ namespace CXX { // Check if this type has custom data. // - CustomDataMap::Iterator i (custom_data_map.find (l.name ())); + CustomDataMap::iterator i (custom_data_map.find (l.name ())); if (i != custom_data_map.end () && i->second->find (L"") != i->second->end ()) @@ -1283,7 +1280,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { SemanticGraph::Context& uc (u.context ()); @@ -1311,7 +1308,7 @@ namespace CXX // Check if this type has custom data. // - CustomDataMap::Iterator i (custom_data_map.find (u.name ())); + CustomDataMap::iterator i (custom_data_map.find (u.name ())); if (i != custom_data_map.end () && i->second->find (L"") != i->second->end ()) @@ -1340,7 +1337,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (data_members_) @@ -1349,7 +1346,7 @@ namespace CXX assign_names (c); } - virtual Void + virtual void assign_names (SemanticGraph::Complex& c) { SemanticGraph::Context& cc (c.context ()); @@ -1368,7 +1365,7 @@ namespace CXX // CustomDataMap* map (0); { - CustomDataMap::Iterator i (custom_data_map.find (c.name ())); + CustomDataMap::iterator i (custom_data_map.find (c.name ())); if (i != custom_data_map.end ()) map = i->second.get (); } @@ -1380,7 +1377,7 @@ namespace CXX // Add our base's members to the initial list. // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) { @@ -1519,7 +1516,7 @@ namespace CXX } } - virtual Void + virtual void assign_data (SemanticGraph::Complex& c) { SemanticGraph::Context& cc (c.context ()); @@ -1535,7 +1532,7 @@ namespace CXX // // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) restriction = c.inherits ().is_a () && @@ -1606,7 +1603,7 @@ namespace CXX } private: - Boolean data_members_; + bool data_members_; }; // @@ -1621,7 +1618,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { String const& name (t.name ()); @@ -1631,7 +1628,7 @@ namespace CXX // See if this parser is being customized. // - CustomTypeMap::ConstIterator i (custom_type_map.find (name)); + CustomTypeMap::const_iterator i (custom_type_map.find (name)); if (i != custom_type_map.end ()) { @@ -1650,7 +1647,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { traverse (static_cast (u)); @@ -1674,7 +1671,7 @@ namespace CXX uc.set ("value", find_name ("value", set)); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { traverse (static_cast (e)); @@ -1720,7 +1717,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -1816,13 +1813,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { set_name (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { set_name (t, "any_simple_type"); @@ -1830,7 +1827,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set_name (t, "boolean"); @@ -1838,79 +1835,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { set_name (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { set_name (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { set_name (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { set_name (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { set_name (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { set_name (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { set_name (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { set_name (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { set_name (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { set_name (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { set_name (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { set_name (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { set_name (t, "negative_integer"); @@ -1918,19 +1915,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { set_name (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { set_name (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { set_name (t, "decimal"); @@ -1938,49 +1935,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { set_name (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { set_name (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { set_name (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { set_name (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { set_name (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { set_name (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { set_name (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { set_name (t, "language"); @@ -1989,7 +1986,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set_name (t, "qname"); @@ -1998,19 +1995,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { set_name (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { set_name (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { set_name (t, "idrefs"); @@ -2018,7 +2015,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set_name (t, "uri"); @@ -2026,13 +2023,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { set_name (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { set_name (t, "hex_binary"); @@ -2041,55 +2038,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { set_name (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { set_name (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { set_name (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { set_name (t, "gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { set_name (t, "gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { set_name (t, "gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { set_name (t, "gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { set_name (t, "gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { set_name (t, "time"); @@ -2097,20 +2094,20 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { set_name (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { set_name (t, "entities"); } private: - Void + void set_name (SemanticGraph::Type& t, String const& name) { SemanticGraph::Context& c (t.context ()); @@ -2125,7 +2122,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -2137,7 +2134,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -2149,7 +2146,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -2167,7 +2164,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -2180,11 +2177,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); @@ -2294,11 +2291,11 @@ namespace CXX } } - Void TreeNameProcessor:: + void TreeNameProcessor:: 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/hybrid/tree-name-processor.hxx b/xsde/cxx/hybrid/tree-name-processor.hxx index fff1fb8..5b488fa 100644 --- a/xsde/cxx/hybrid/tree-name-processor.hxx +++ b/xsde/cxx/hybrid/tree-name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_HYBRID_TREE_NAME_PROCESSOR_HXX #define CXX_HYBRID_TREE_NAME_PROCESSOR_HXX -#include - #include +#include #include namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class TreeNameProcessor { public: - Void + void process (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/hybrid/tree-size-processor.cxx b/xsde/cxx/hybrid/tree-size-processor.cxx index 0d734ca..2872bf6 100644 --- a/xsde/cxx/hybrid/tree-size-processor.cxx +++ b/xsde/cxx/hybrid/tree-size-processor.cxx @@ -3,19 +3,18 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include +#include +#include + #include #include #include #include -#include -#include -#include - -#include - -using std::wcerr; +using namespace std; namespace CXX { @@ -23,53 +22,52 @@ namespace CXX { namespace { - typedef Cult::Containers::Set TypeSet; - + typedef set TypeSet; struct CustomType { - Boolean fixed; + bool fixed; String base; }; - typedef Cult::Containers::Map CustomTypeMap; + typedef map CustomTypeMap; - Boolean + bool test (SemanticGraph::Type& t) { return t.context ().count ("fixed") != 0; } - Void - set (SemanticGraph::Type& t, Boolean v) + void + set (SemanticGraph::Type& t, bool v) { t.context ().set ("fixed", v); } - Void - set (SemanticGraph::Compositor& c, Boolean v) + void + set (SemanticGraph::Compositor& c, bool v) { c.context ().set ("fixed", v); } - Boolean + bool get (SemanticGraph::Type& t) { - return t.context ().get ("fixed"); + return t.context ().get ("fixed"); } // // struct Particle: Traversal::Element { - Particle (Boolean& fixed, - Boolean& poly, + Particle (bool& fixed, + bool& poly, Traversal::NodeBase& type_traverser) : fixed_ (fixed), poly_ (poly), type_traverser_ (type_traverser) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { // Check the type. We need to do it even if fixed_ is @@ -91,7 +89,7 @@ namespace CXX } /* - virtual Void + virtual void traverse (SemanticGraph::Any&) { // Types with wildcards are always variable length. @@ -102,8 +100,8 @@ namespace CXX */ private: - Boolean& fixed_; - Boolean& poly_; + bool& fixed_; + bool& poly_; Traversal::NodeBase& type_traverser_; }; @@ -111,14 +109,14 @@ namespace CXX Traversal::Choice, Traversal::Sequence { - Compositor (Boolean& fixed, - Boolean& poly, + Compositor (bool& fixed, + bool& poly, Traversal::NodeBase& type_traverser) : fixed_ (fixed), poly_ (poly), type_traverser_ (type_traverser) { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -127,7 +125,7 @@ namespace CXX // if (a.min () == 0) { - Boolean fixed = true; + bool fixed = true; { Particle particle (fixed, poly_, type_traverser_); @@ -147,13 +145,13 @@ namespace CXX All::contains (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // Here we need to assign the size for the nested class in // all three cases because this choice might be in choice. // - Boolean fixed = true; + bool fixed = true; { Particle particle (fixed, poly_, type_traverser_); @@ -172,13 +170,13 @@ namespace CXX fixed_ = false; } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Here we need to assign the size for the nested class in // all three cases because this sequence might be in choice. // - Boolean fixed = true; + bool fixed = true; { Particle particle (fixed, poly_, type_traverser_); @@ -198,19 +196,19 @@ namespace CXX } private: - Boolean& fixed_; - Boolean& poly_; + bool& fixed_; + bool& poly_; Traversal::NodeBase& type_traverser_; }; struct Attribute: Traversal::Attribute { - Attribute (Boolean& fixed, Traversal::NodeBase& type_traverser) + Attribute (bool& fixed, Traversal::NodeBase& type_traverser) : fixed_ (fixed), type_traverser_ (type_traverser) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { // Simple types cannot be recursive. @@ -227,7 +225,7 @@ namespace CXX } /* - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute&) { // Types with wildcards are always variable length. @@ -238,7 +236,7 @@ namespace CXX */ private: - Boolean& fixed_; + bool& fixed_; Traversal::NodeBase& type_traverser_; }; @@ -249,13 +247,13 @@ namespace CXX Traversal::Complex, Traversal::Enumeration { - Type (Boolean& valid, + Type (bool& valid, TypeSet& custom_data, CustomTypeMap& custom_type_map, TypeSet& poly_types, - Boolean stl_, - Boolean poly_, - Boolean enum_mapping) + bool stl_, + bool poly_, + bool enum_mapping) : valid_ (valid), custom_data_ (custom_data), custom_type_map_ (custom_type_map), @@ -266,19 +264,19 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!test (l)) set (l, false); } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { if (!test (u)) { - Boolean fixed (stl); + bool fixed (stl); // Check for custom data. // @@ -292,7 +290,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { if (!test (e)) @@ -313,7 +311,7 @@ namespace CXX return; } - Boolean fixed (true); + bool fixed (true); if (base_enum && !get (b)) fixed = false; @@ -330,7 +328,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { SemanticGraph::Context& ctx (c.context ()); @@ -344,7 +342,7 @@ namespace CXX // Mark all the types involved in the cycle as recursive. // - for (Path::ReverseIterator i (path_.rbegin ()); *i != &c; ++i) + for (Path::reverse_iterator i (path_.rbegin ()); *i != &c; ++i) { (*i)->context ().set ("recursive", true); } @@ -354,7 +352,7 @@ namespace CXX ctx.set ("recurse", true); path_.push_back (&c); - Boolean fixed = true; + bool fixed = true; // First check our base. // @@ -373,7 +371,7 @@ namespace CXX // if (c.contains_compositor_p ()) { - Boolean poly (false); + bool poly (false); Particle particle (fixed, poly, *this); Compositor compositor (fixed, poly, *this); @@ -424,8 +422,8 @@ namespace CXX } private: - Void - set (SemanticGraph::Type& t, Boolean v) + void + set (SemanticGraph::Type& t, bool v) { using SemanticGraph::Complex; @@ -441,7 +439,7 @@ namespace CXX { // If our base is polymorphic then we are as well. // - Boolean pb (false); + bool pb (false); if (Complex* c = dynamic_cast (&t)) { pb = c->inherits_p () && @@ -460,7 +458,7 @@ namespace CXX // Check if this is a custom type. // - CustomTypeMap::Iterator i = custom_type_map_.find (name); + CustomTypeMap::iterator i = custom_type_map_.find (name); if (i != custom_type_map_.end ()) { @@ -481,15 +479,15 @@ namespace CXX } private: - Boolean& valid_; + bool& valid_; TypeSet& custom_data_; CustomTypeMap& custom_type_map_; TypeSet& poly_types_; - Boolean stl; - Boolean poly; - Boolean enum_; + bool stl; + bool poly; + bool enum_; - typedef Containers::Vector Path; + typedef vector Path; Path path_; }; @@ -550,14 +548,14 @@ namespace CXX Traversal::Fundamental::Entities { - FundType (Boolean stl_, TypeSet& poly_types) + FundType (bool stl_, TypeSet& poly_types) : stl (stl_), poly_types_ (poly_types) { } // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { set (t, false); @@ -568,7 +566,7 @@ namespace CXX t.context ().set ("polymorphic", true); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { set (t, stl); @@ -576,7 +574,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set (t, true); @@ -584,79 +582,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { set (t, true); @@ -664,19 +662,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { set (t, true); @@ -684,49 +682,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { set (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { set (t, stl); @@ -735,7 +733,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set (t, stl); @@ -744,19 +742,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { set (t, false); @@ -764,7 +762,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set (t, stl); @@ -772,13 +770,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { set (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { set (t, false); @@ -787,55 +785,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { set (t, true); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { set (t, true); @@ -843,27 +841,27 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { set (t, stl); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { set (t, false); } private: - Boolean stl; + bool stl; TypeSet& poly_types_; }; struct GlobalElement: Traversal::Element { GlobalElement (TypeSet& poly_types, - Boolean& valid, + bool& valid, const WarningSet& disabled_warnings) : poly_types_ (poly_types), valid_ (valid), warning_ (true) { @@ -872,7 +870,7 @@ namespace CXX warning_ = false; } - virtual Void + virtual void traverse (Type& e) { using SemanticGraph::Schema; @@ -945,7 +943,7 @@ namespace CXX private: // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -966,8 +964,8 @@ namespace CXX private: TypeSet& poly_types_; - Boolean& valid_; - Boolean warning_; + bool& valid_; + bool warning_; }; // Go into sourced/included/imported schemas while making sure @@ -977,12 +975,12 @@ namespace CXX Traversal::Includes, Traversal::Imports { - Uses (Char const* seen_key) + Uses (char const* seen_key) : seen_key_ (seen_key) { } - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -994,7 +992,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1006,7 +1004,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1019,21 +1017,21 @@ namespace CXX } private: - Char const* seen_key_; + char const* seen_key_; }; - Char const* pass_one_key = "cxx-hybrid-size-processor-seen-one"; - Char const* pass_two_key = "cxx-hybrid-size-processor-seen-two"; + char const* pass_one_key = "cxx-hybrid-size-processor-seen-one"; + char const* pass_two_key = "cxx-hybrid-size-processor-seen-two"; - Boolean + bool process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const&, const WarningSet& disabled_warnings) { - Boolean valid (true); - Boolean stl (!ops.no_stl ()); - Boolean poly (ops.generate_polymorphic ()); + bool valid (true); + bool stl (!ops.no_stl ()); + bool poly (ops.generate_polymorphic ()); // Prepare a set of polymorphic types. // @@ -1127,7 +1125,7 @@ namespace CXX // Split the string in two parts at the last '='. // - Size pos (s.rfind ('=')); + size_t pos (s.rfind ('=')); if (pos == String::npos) continue; @@ -1238,7 +1236,7 @@ namespace CXX } } - Boolean TreeSizeProcessor:: + bool TreeSizeProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, diff --git a/xsde/cxx/hybrid/tree-size-processor.hxx b/xsde/cxx/hybrid/tree-size-processor.hxx index 6f13401..0023904 100644 --- a/xsde/cxx/hybrid/tree-size-processor.hxx +++ b/xsde/cxx/hybrid/tree-size-processor.hxx @@ -6,24 +6,21 @@ #ifndef CXX_HYBRID_TREE_SIZE_PROCESSOR_HXX #define CXX_HYBRID_TREE_SIZE_PROCESSOR_HXX -#include - #include -#include - #include +#include + +#include namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class TreeSizeProcessor { public: - Boolean + bool process (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file, diff --git a/xsde/cxx/hybrid/tree-source.cxx b/xsde/cxx/hybrid/tree-source.cxx index dac6528..d6aed3a 100644 --- a/xsde/cxx/hybrid/tree-source.cxx +++ b/xsde/cxx/hybrid/tree-source.cxx @@ -22,7 +22,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { os << strlit (e.name ()); @@ -40,7 +40,7 @@ namespace CXX names_ >> enumerator_; } - virtual Void + virtual void traverse (Type& e) { // First see if we should delegate this one to the Complex @@ -251,7 +251,7 @@ namespace CXX } } - virtual Void + virtual void comma (Type&) { os << "," << endl; @@ -273,7 +273,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename_custom (l)); @@ -284,7 +284,7 @@ namespace CXX if (!name) return; - Boolean poly (polymorphic (l)); + bool poly (polymorphic (l)); SemanticGraph::Context& lc (l.context ()); if (poly || clone) @@ -453,7 +453,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename_custom (u)); @@ -464,7 +464,7 @@ namespace CXX if (!name) return; - Boolean poly (polymorphic (u)); + bool poly (polymorphic (u)); SemanticGraph::Context& uc (u.context ()); os << "// " << comment (u.name ()) << endl @@ -647,7 +647,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (a.default_p ()) @@ -722,12 +722,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Type& t (e.type ()); - Boolean fund (false); + bool fund (false); { FundamentalType test (fund); test.dispatch (t); @@ -909,7 +909,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { String const& member (emember (c)); @@ -1044,7 +1044,7 @@ namespace CXX struct ChoiceFunc: Traversal::Choice, Context { - ChoiceFunc (Context& c, Boolean in_choice) + ChoiceFunc (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice), particle_free_ (c, ChoiceParticle::free), @@ -1054,14 +1054,14 @@ namespace CXX contains_alloc_ >> particle_alloc_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!in_choice_ && c.max () == 1 && c.min () == 1) { String const& arm_tag (earm_tag (c)); String const& arm_member (earm_member (c)); - UnsignedLong bad_tag (arm_tag_count (c)); + size_t bad_tag (arm_tag_count (c)); // void // arm (arm_tag) @@ -1097,7 +1097,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; ChoiceParticle particle_free_; Traversal::ContainsParticle contains_free_; @@ -1108,12 +1108,12 @@ namespace CXX struct SequenceFunc: Traversal::Sequence, Context { - SequenceFunc (Context& c, Boolean in_choice) + SequenceFunc (Context& c, bool in_choice) : Context (c), in_choice_ (in_choice) { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -1124,7 +1124,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; }; // @@ -1138,13 +1138,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) { - Boolean def (a.default_p ()); - Boolean fl (fixed_length (a.type ())); + bool def (a.default_p ()); + bool fl (fixed_length (a.type ())); if (!fl) { @@ -1170,12 +1170,12 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () == 1) { - Boolean fl (fixed_length (e.type ())); + bool fl (fixed_length (e.type ())); if (!fl) os << "this->" << emember (e) << " = 0;"; @@ -1193,7 +1193,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1218,7 +1218,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () == 1) @@ -1246,7 +1246,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () == 1) @@ -1275,7 +1275,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1299,7 +1299,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (e.max () == 1) @@ -1322,7 +1322,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1356,7 +1356,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () == 1) @@ -1393,7 +1393,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () == 1) @@ -1431,7 +1431,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1458,7 +1458,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& member (emember (e)); @@ -1482,7 +1482,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (a.min () == 0) @@ -1507,7 +1507,7 @@ namespace CXX contains_copy_ >> particle_copy_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.min () == 0) @@ -1547,7 +1547,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.min () == 0) @@ -1575,7 +1575,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1602,7 +1602,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& member (emember (e)); @@ -1626,7 +1626,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (a.min () == 0) @@ -1651,7 +1651,7 @@ namespace CXX contains_assign_ >> particle_assign_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.min () == 0) @@ -1691,7 +1691,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.min () == 0) @@ -1719,7 +1719,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { if (!a.fixed_p ()) @@ -1727,7 +1727,7 @@ namespace CXX String const& name (ename (a)); SemanticGraph::Type& t (a.type ()); - Boolean opt (a.optional_p () && !a.default_p ()); + bool opt (a.optional_p () && !a.default_p ()); if (opt) os << "if (this->" << epresent (a) << " ())"; @@ -1753,7 +1753,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (ename (e)); @@ -1772,7 +1772,7 @@ namespace CXX { SemanticGraph::Type& t (e.type ()); - Boolean opt (e.min () == 0); + bool opt (e.min () == 0); if (opt) os << "if (this->" << epresent (e) << " ())"; @@ -1797,7 +1797,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -1840,7 +1840,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (s.max () != 1) @@ -1892,7 +1892,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { os << "case " << etag (e) << ":" @@ -1904,7 +1904,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // In choice there are no inline compositors. @@ -1924,7 +1924,7 @@ namespace CXX } else { - Boolean opt (c.min () == 0); + bool opt (c.min () == 0); if (opt) os << "if (this->" << epresent (c) << " ())"; @@ -1962,7 +1962,7 @@ namespace CXX contains_particle_ >> particle_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.max () != 1) @@ -2047,7 +2047,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -2056,7 +2056,7 @@ namespace CXX if (a.min () != 0) return; - Boolean fl (fixed_length (a)); + bool fl (fixed_length (a)); String const& type (etype (a)); String const& scope (Context::scope (a)); @@ -2208,7 +2208,7 @@ namespace CXX struct Choice: Traversal::Choice, Context { Choice (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_func) : Context (c), in_choice_ (in_choice), @@ -2226,7 +2226,7 @@ namespace CXX contains_clone_ >> particle_clone_; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // When choice is in choice we generate nested class even @@ -2238,11 +2238,11 @@ namespace CXX String const& arm (earm (c)); String const& arm_tag (earm_tag (c)); String const& arm_member (earm_member (c)); - UnsignedLong bad_tag (arm_tag_count (c)); + size_t bad_tag (arm_tag_count (c)); String const& scope (Context::scope (c)); - Boolean fl (fixed_length (c)); + bool fl (fixed_length (c)); // c-tor () // @@ -2435,7 +2435,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_func_; ChoiceParticle particle_free_; @@ -2458,7 +2458,7 @@ namespace CXX struct Sequence: Traversal::Sequence, Context { Sequence (Context& c, - Boolean in_choice, + bool in_choice, Traversal::ContainsParticle& contains_ctor, Traversal::ContainsParticle& contains_dtor, Traversal::ContainsParticle& contains_copy, @@ -2476,7 +2476,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // When sequence is in choice we generate nested class even @@ -2487,7 +2487,7 @@ namespace CXX String const& type (etype (s)); String const& scope (Context::scope (s)); - Boolean fl (fixed_length (s)); + bool fl (fixed_length (s)); // c-tor () // @@ -2632,7 +2632,7 @@ namespace CXX } private: - Boolean in_choice_; + bool in_choice_; Traversal::ContainsParticle& contains_ctor_; Traversal::ContainsParticle& contains_dtor_; Traversal::ContainsParticle& contains_copy_; @@ -2835,7 +2835,7 @@ namespace CXX contains_compositor_ >> sequence_in_sequence_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename_custom (c)); @@ -2846,9 +2846,9 @@ namespace CXX if (!name) return; - Boolean fl (fixed_length (c)); - Boolean poly (polymorphic (c)); - Boolean restriction (restriction_p (c)); + bool fl (fixed_length (c)); + bool poly (polymorphic (c)); + bool restriction (restriction_p (c)); os << "// " << comment (c.name ()) << endl << "//" << endl @@ -3221,7 +3221,7 @@ namespace CXX }; } - Void + void generate_tree_source (Context& ctx) { // Needed for placement new. diff --git a/xsde/cxx/hybrid/tree-source.hxx b/xsde/cxx/hybrid/tree-source.hxx index 0c017aa..199f4e6 100644 --- a/xsde/cxx/hybrid/tree-source.hxx +++ b/xsde/cxx/hybrid/tree-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Hybrid { - Void + void generate_tree_source (Context&); } } diff --git a/xsde/cxx/hybrid/tree-type-map.cxx b/xsde/cxx/hybrid/tree-type-map.cxx index 7825725..3304b7c 100644 --- a/xsde/cxx/hybrid/tree-type-map.cxx +++ b/xsde/cxx/hybrid/tree-type-map.cxx @@ -3,15 +3,16 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include + #include #include #include #include -#include - -#include +using namespace std; namespace CXX { @@ -47,7 +48,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { String const& xn (t.name ()); @@ -55,7 +56,7 @@ namespace CXX if (parser_ != 0) { - if (t.context ().get ("fixed")) + if (t.context ().get ("fixed")) parser_->types_push_back (xn, qn); else parser_->types_push_back (xn, qn + L"*"); @@ -84,7 +85,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { String include; @@ -144,7 +145,7 @@ namespace CXX schema_set_.insert (&root); } - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -158,7 +159,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -170,7 +171,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -183,11 +184,11 @@ namespace CXX } private: - Containers::Set schema_set_; + set schema_set_; }; } - Void + void generate_tree_type_map (options const& ops, XSDFrontend::SemanticGraph::Schema& tu, XSDFrontend::SemanticGraph::Path const& path, diff --git a/xsde/cxx/hybrid/tree-type-map.hxx b/xsde/cxx/hybrid/tree-type-map.hxx index 0f677cd..186b0d4 100644 --- a/xsde/cxx/hybrid/tree-type-map.hxx +++ b/xsde/cxx/hybrid/tree-type-map.hxx @@ -6,21 +6,17 @@ #ifndef CXX_HYBRID_TREE_TYPE_MAP_HXX #define CXX_HYBRID_TREE_TYPE_MAP_HXX -#include - #include +#include #include - #include namespace CXX { namespace Hybrid { - using namespace Cult::Types; - - Void + void generate_tree_type_map (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, diff --git a/xsde/cxx/hybrid/validator.cxx b/xsde/cxx/hybrid/validator.cxx index 2b13097..ef1f010 100644 --- a/xsde/cxx/hybrid/validator.cxx +++ b/xsde/cxx/hybrid/validator.cxx @@ -3,16 +3,16 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include +#include +#include #include #include #include +#include -#include - -using std::wcerr; +using namespace std; namespace CXX { @@ -30,7 +30,7 @@ namespace CXX SemanticGraph::Path const& path, Hybrid::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), @@ -43,8 +43,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 (); @@ -79,10 +79,10 @@ namespace CXX protected: const WarningSet& disabled_warnings_; - Boolean disabled_warnings_all_; - Boolean& valid; - Boolean& subst_group_warning_issued; - Boolean subst_group_warning_issued_; + bool disabled_warnings_all_; + bool& valid; + bool& subst_group_warning_issued; + bool subst_group_warning_issued_; }; // @@ -100,7 +100,7 @@ namespace CXX *this >> schema_names_ >> ns_ >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -144,7 +144,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -153,7 +153,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("H001")) @@ -177,7 +177,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -197,7 +197,7 @@ namespace CXX } private: - Containers::Set types_; + set types_; Sources sources_; @@ -211,12 +211,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 ()); @@ -258,18 +258,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)) @@ -289,12 +289,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)) @@ -333,9 +333,9 @@ namespace CXX } private: - Boolean error_issued_; + bool error_issued_; - Containers::Set types_; + set types_; Sources sources_; @@ -354,19 +354,19 @@ namespace CXX struct GlobalElementCount: Traversal::Element { - GlobalElementCount (UnsignedLong& count) + GlobalElementCount (size_t& count) : count_ (count) { } - virtual Void + virtual void traverse (SemanticGraph::Element&) { count_++; } private: - UnsignedLong& count_; + size_t& count_; }; struct ParserValidation: Traversal::All, @@ -383,7 +383,7 @@ namespace CXX *this >> contains_particle_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1}. @@ -403,7 +403,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!issued_) @@ -421,7 +421,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!issued_) @@ -453,7 +453,7 @@ namespace CXX Traversal::Sequence::traverse (s); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (!issued_ && !restriction_p (c)) @@ -474,20 +474,20 @@ namespace CXX } private: - Boolean issued_; + bool issued_; Traversal::ContainsCompositor contains_compositor_; Traversal::ContainsParticle contains_particle_; }; } - Boolean Validator:: + bool Validator:: validate (options const& ops, SemanticGraph::Schema& root, SemanticGraph::Path const& path, const WarningSet& disabled_warnings) { - Boolean valid (true); + bool valid (true); ValidationContext ctx (root, path, ops, disabled_warnings, valid); // @@ -502,9 +502,9 @@ namespace CXX // // - Boolean par (ops.generate_parser ()); - Boolean ser (ops.generate_serializer ()); - Boolean agg (ops.generate_aggregate ()); + bool par (ops.generate_parser ()); + bool ser (ops.generate_serializer ()); + bool agg (ops.generate_aggregate ()); if (agg && !par && !ser && !ctx.is_disabled ("H002")) { @@ -524,7 +524,7 @@ namespace CXX ops.root_element ().empty () && !ctx.is_disabled ("H003")) { - UnsignedLong count (0); + size_t count (0); { Traversal::Schema schema; diff --git a/xsde/cxx/hybrid/validator.hxx b/xsde/cxx/hybrid/validator.hxx index ba4cc80..360ebc0 100644 --- a/xsde/cxx/hybrid/validator.hxx +++ b/xsde/cxx/hybrid/validator.hxx @@ -6,24 +6,21 @@ #ifndef CXX_HYBRID_VALIDATOR_HXX #define CXX_HYBRID_VALIDATOR_HXX -#include - #include -#include - #include +#include + +#include namespace CXX { namespace Hybrid { - using namespace Cult::Types; - class Validator { public: - Boolean + bool validate (options const& options, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& tu, diff --git a/xsde/cxx/options.cli b/xsde/cxx/options.cli index 45425ea..22c4f27 100644 --- a/xsde/cxx/options.cli +++ b/xsde/cxx/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 ; -include ; include ; // std::size_t -include ; // NarrowString +include ; // NarrowString, NarrowStrings include ; @@ -15,13 +13,13 @@ namespace CXX { class options: ::options = 0 { - Cult::Types::NarrowString --output-dir + NarrowString --output-dir { "", "Write generated files to instead of the current directory." }; - Cult::Types::NarrowString --char-encoding = "utf8" + NarrowString --char-encoding = "utf8" { "", "Specify the application character encoding. Valid values are \cb{utf8} @@ -99,7 +97,7 @@ namespace CXX generated files for other schemas." }; - Cult::Types::NarrowString --extern-xml-schema + NarrowString --extern-xml-schema { "", "Include a header file derived from instead of generating the @@ -111,7 +109,7 @@ namespace CXX // Namespace mapping. // - std::vector --namespace-map + NarrowStrings --namespace-map { "=", "Map XML Schema namespace to C++ namespace . Repeat @@ -124,7 +122,7 @@ namespace CXX the \cb{foo::bar} C++ namespace." }; - std::vector --namespace-regex + NarrowStrings --namespace-regex { "", "Add to the list of regular expressions used to translate XML @@ -181,7 +179,7 @@ namespace CXX // Reserved names. // - std::vector --reserved-name + NarrowStrings --reserved-name { "[=]", "Add name to the list of names that should not be used as @@ -198,7 +196,7 @@ namespace CXX \cb{#include} directives." }; - Cult::Types::NarrowString --include-prefix + NarrowString --include-prefix { "", "Add to generated \cb{#include} directive paths. @@ -213,7 +211,7 @@ namespace CXX \cb{#include \"schemas/base.hxx\"}" }; - std::vector --include-regex + NarrowStrings --include-regex { "", "Add to the list of regular expressions used to transform @@ -242,7 +240,7 @@ namespace CXX regular expressions don't do what you expected them to do." }; - Cult::Types::NarrowString --guard-prefix + NarrowString --guard-prefix { "", "Add to generated header inclusion guards. The prefix is @@ -254,7 +252,7 @@ namespace CXX // File suffixes. // - Cult::Types::NarrowString --hxx-suffix = ".hxx" + NarrowString --hxx-suffix = ".hxx" { "", "Use the provided instead of the default \cb{.hxx} to @@ -263,28 +261,28 @@ namespace CXX included/imported schemas." }; - Cult::Types::NarrowString --ixx-suffix = ".ixx" + NarrowString --ixx-suffix = ".ixx" { "", "Use the provided instead of the default \cb{.ixx} to construct the name of the inline file." }; - Cult::Types::NarrowString --cxx-suffix = ".cxx" + NarrowString --cxx-suffix = ".cxx" { "", "Use the provided instead of the default \cb{.cxx} to construct the name of the source file." }; - Cult::Types::NarrowString --fwd-suffix = "-fwd.hxx" + NarrowString --fwd-suffix = "-fwd.hxx" { "", "Use the provided instead of the default \cb{-fwd.hxx} to construct the name of the forward declaration file." }; - Cult::Types::NarrowString --hxx-regex + NarrowString --hxx-regex { "", "Use the provided expression to construct the name of the header file. @@ -304,7 +302,7 @@ namespace CXX See also the REGEX AND SHELL QUOTING section below." }; - Cult::Types::NarrowString --ixx-regex + NarrowString --ixx-regex { "", "Use the provided expression to construct the name of the inline file. @@ -315,7 +313,7 @@ namespace CXX AND SHELL QUOTING section below." }; - Cult::Types::NarrowString --cxx-regex + NarrowString --cxx-regex { "", "Use the provided expression to construct the name of the source file. @@ -326,7 +324,7 @@ namespace CXX AND SHELL QUOTING section below." }; - Cult::Types::NarrowString --fwd-regex + NarrowString --fwd-regex { "", "Use the provided expression to construct the name of the forward @@ -337,7 +335,7 @@ namespace CXX // Prologues/epilogues. // - std::vector --hxx-prologue + NarrowStrings --hxx-prologue { "", "Insert at the beginning of the header file. @@ -351,7 +349,7 @@ namespace CXX object model files only." }; - std::vector --ixx-prologue + NarrowStrings --ixx-prologue { "", "Insert at the beginning of the inline file. For the C++/Hybrid @@ -359,7 +357,7 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - std::vector --cxx-prologue + NarrowStrings --cxx-prologue { "", "Insert at the beginning of the source file. For the C++/Hybrid @@ -367,13 +365,13 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - std::vector --fwd-prologue + NarrowStrings --fwd-prologue { "", "Insert at the beginning of the forward declaration file." }; - std::vector --prologue + NarrowStrings --prologue { "", "Insert at the beginning of each generated file for which @@ -382,7 +380,7 @@ namespace CXX \cb{--hxx-prologue} option for details." }; - std::vector --hxx-epilogue + NarrowStrings --hxx-epilogue { "", "Insert at the end of the header file. For the C++/Hybrid @@ -390,7 +388,7 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - std::vector --ixx-epilogue + NarrowStrings --ixx-epilogue { "", "Insert at the end of the inline file. For the C++/Hybrid @@ -398,7 +396,7 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - std::vector --cxx-epilogue + NarrowStrings --cxx-epilogue { "", "Insert at the end of the source file. For the C++/Hybrid @@ -406,13 +404,13 @@ namespace CXX key. See the \cb{--hxx-prologue} option for details." }; - std::vector --fwd-epilogue + NarrowStrings --fwd-epilogue { "", "Insert at the end of the forward declaration file." }; - std::vector --epilogue + NarrowStrings --epilogue { "", "Insert at the end of each generated file for which there @@ -421,7 +419,7 @@ namespace CXX \cb{--hxx-prologue} option for details." }; - Cult::Types::NarrowString --hxx-prologue-file + NarrowString --hxx-prologue-file { "", "Insert the content of the at the beginning of the header file. @@ -435,7 +433,7 @@ namespace CXX object model files only." }; - Cult::Types::NarrowString --ixx-prologue-file + NarrowString --ixx-prologue-file { "", "Insert the content of the at the beginning of the inline file. @@ -444,7 +442,7 @@ namespace CXX for details." }; - Cult::Types::NarrowString --cxx-prologue-file + NarrowString --cxx-prologue-file { "", "Insert the content of the at the beginning of the source file. @@ -453,14 +451,14 @@ namespace CXX for details." }; - Cult::Types::NarrowString --fwd-prologue-file + NarrowString --fwd-prologue-file { "", "Insert the content of the at the beginning of the forward declaration file." }; - Cult::Types::NarrowString --prologue-file + NarrowString --prologue-file { "", "Insert the content of the at the beginning of each generated @@ -469,7 +467,7 @@ namespace CXX with a file key. See the \cb{--hxx-prologue-file} option for details." }; - Cult::Types::NarrowString --hxx-epilogue-file + NarrowString --hxx-epilogue-file { "", "Insert the content of the at the end of the header file. @@ -478,7 +476,7 @@ namespace CXX for details." }; - Cult::Types::NarrowString --ixx-epilogue-file + NarrowString --ixx-epilogue-file { "", "Insert the content of the at the end of the inline file. @@ -487,7 +485,7 @@ namespace CXX for details." }; - Cult::Types::NarrowString --cxx-epilogue-file + NarrowString --cxx-epilogue-file { "", "Insert the content of the at the end of the source file. @@ -496,14 +494,14 @@ namespace CXX for details." }; - Cult::Types::NarrowString --fwd-epilogue-file + NarrowString --fwd-epilogue-file { "", "Insert the content of the at the end of the forward declaration file." }; - Cult::Types::NarrowString --epilogue-file + NarrowString --epilogue-file { "", "Insert the content of the at the end of each generated file diff --git a/xsde/cxx/parser/attribute-validation-source.cxx b/xsde/cxx/parser/attribute-validation-source.cxx index c82e8f0..97fc536 100644 --- a/xsde/cxx/parser/attribute-validation-source.cxx +++ b/xsde/cxx/parser/attribute-validation-source.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (a.name ()); @@ -39,7 +39,7 @@ namespace CXX os << "n == " << L << strlit (name) << " && ns.empty ()"; } - virtual Void + virtual void traverse (SemanticGraph::AnyAttribute& a) { String const& ns (a.definition_namespace ().name ()); @@ -93,7 +93,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -173,7 +173,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "if ("; @@ -201,7 +201,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -219,7 +219,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -254,16 +254,16 @@ namespace CXX names_attribute_state_check_ >> attribute_state_check_; } - virtual Void + virtual void traverse (Type& c) { - Boolean has_att (has (c)); - Boolean has_any (has (c)); + bool has_att (has (c)); + bool has_any (has (c)); if (!has_att && !has_any) return; - Boolean has_req_att (false); + bool has_req_att (false); if (has_att) { RequiredAttributeTest test (has_req_att); @@ -444,7 +444,7 @@ namespace CXX }; } - Void + void generate_attribute_validation_source (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/attribute-validation-source.hxx b/xsde/cxx/parser/attribute-validation-source.hxx index fd79ef7..6e6663d 100644 --- a/xsde/cxx/parser/attribute-validation-source.hxx +++ b/xsde/cxx/parser/attribute-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_attribute_validation_source (Context&); } } diff --git a/xsde/cxx/parser/characters-validation-source.cxx b/xsde/cxx/parser/characters-validation-source.cxx index f17b135..b93e280 100644 --- a/xsde/cxx/parser/characters-validation-source.cxx +++ b/xsde/cxx/parser/characters-validation-source.cxx @@ -23,7 +23,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { if (!c.mixed_p ()) @@ -46,7 +46,7 @@ namespace CXX }; } - Void + void generate_characters_validation_source (Context& ctx) { //@@ Most of the time there is no mixed content type so diff --git a/xsde/cxx/parser/characters-validation-source.hxx b/xsde/cxx/parser/characters-validation-source.hxx index b302a16..e1692ec 100644 --- a/xsde/cxx/parser/characters-validation-source.hxx +++ b/xsde/cxx/parser/characters-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_characters_validation_source (Context&); } } diff --git a/xsde/cxx/parser/driver-source.cxx b/xsde/cxx/parser/driver-source.cxx index 2e8db21..f46bbe3 100644 --- a/xsde/cxx/parser/driver-source.cxx +++ b/xsde/cxx/parser/driver-source.cxx @@ -3,16 +3,17 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include +#include + #include #include #include #include -#include -#include - -#include +using namespace std; namespace CXX { @@ -20,11 +21,8 @@ namespace CXX { namespace { - typedef - Cult::Containers::Map - TypeInstanceMap; - - typedef Cult::Containers::Set InstanceSet; + typedef map TypeInstanceMap; + typedef set InstanceSet; // For base types we only want member's types, but not the // base itself. @@ -38,7 +36,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c); @@ -50,7 +48,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { def_.dispatch (l.argumented ().type ()); @@ -145,7 +143,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (map_.find (&t) == map_.end ()) @@ -157,7 +155,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (map_.find (&l) == map_.end ()) @@ -171,7 +169,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (map_.find (&c) == map_.end ()) @@ -193,13 +191,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { fund_type (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { fund_type (t, "any_simple_type"); @@ -207,7 +205,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { fund_type (t, "boolean"); @@ -215,79 +213,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { fund_type (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { fund_type (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { fund_type (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { fund_type (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { fund_type (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { fund_type (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { fund_type (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { fund_type (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { fund_type (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { fund_type (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { fund_type (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { fund_type (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { fund_type (t, "negative_integer"); @@ -295,19 +293,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { fund_type (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { fund_type (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { fund_type (t, "decimal"); @@ -315,49 +313,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { fund_type (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { fund_type (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { fund_type (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { fund_type (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { fund_type (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { fund_type (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { fund_type (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { fund_type (t, "language"); @@ -366,7 +364,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { fund_type (t, "qname"); @@ -375,19 +373,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { fund_type (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { fund_type (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { fund_type (t, "idrefs"); @@ -395,7 +393,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { fund_type (t, "uri"); @@ -403,13 +401,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { fund_type (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { fund_type (t, "hex_binary"); @@ -418,55 +416,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { fund_type (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { fund_type (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { fund_type (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { fund_type (t, "day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { fund_type (t, "month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { fund_type (t, "month_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { fund_type (t, "year"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { fund_type (t, "year_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { fund_type (t, "time"); @@ -474,20 +472,20 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { fund_type (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { fund_type (t, "entities"); } private: - virtual Void + virtual void fund_type (SemanticGraph::Type& t, String const& name) { if (map_.find (&t) == map_.end ()) @@ -505,7 +503,7 @@ namespace CXX String base_name (escape (raw_name + L"_p")); String name (base_name); - for (UnsignedLong i (1); set_.find (name) != set_.end (); ++i) + for (size_t i (1); set_.find (name) != set_.end (); ++i) { std::wostringstream os; os << i; @@ -543,12 +541,12 @@ namespace CXX // struct ParticleArg: Traversal::Element, Context { - ParticleArg (Context& c, TypeInstanceMap& map, Boolean& first) + ParticleArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (map), first_ (first) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!first_) @@ -561,17 +559,17 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct AttributeArg: Traversal::Attribute, Context { - AttributeArg (Context& c, TypeInstanceMap& map, Boolean& first) + AttributeArg (Context& c, TypeInstanceMap& map, bool& first) : Context (c), map_ (map), first_ (first) { } - virtual Void + virtual void traverse (Type& a) { if (!first_) @@ -584,7 +582,7 @@ namespace CXX private: TypeInstanceMap& map_; - Boolean& first_; + bool& first_; }; struct ArgList : Traversal::Complex, @@ -608,7 +606,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -620,7 +618,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (!first_) @@ -644,7 +642,7 @@ namespace CXX Traversal::Names names_; AttributeArg attribute_; - Boolean first_; + bool first_; }; struct ParserConnect: Traversal::List, @@ -674,7 +672,7 @@ namespace CXX belongs_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (type_set_.find (&l) == type_set_.end ()) @@ -687,7 +685,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (type_set_.find (&c) == type_set_.end ()) @@ -716,7 +714,7 @@ namespace CXX } private: - Boolean + bool has_members (SemanticGraph::Complex& c) { using SemanticGraph::Complex; @@ -739,7 +737,7 @@ namespace CXX private: TypeInstanceMap& map_; - Cult::Containers::Set type_set_; + set type_set_; BaseType base_; Traversal::Inherits inherits_; @@ -762,7 +760,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options.root_element_first ()) @@ -784,7 +782,7 @@ namespace CXX }; } - Void + void generate_driver_source (Context& ctx) { // Figure out the root element. Validator should have made sure diff --git a/xsde/cxx/parser/driver-source.hxx b/xsde/cxx/parser/driver-source.hxx index d8b1e28..e19b2da 100644 --- a/xsde/cxx/parser/driver-source.hxx +++ b/xsde/cxx/parser/driver-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_driver_source (Context&); } } diff --git a/xsde/cxx/parser/element-validation-source.cxx b/xsde/cxx/parser/element-validation-source.cxx index e1216f7..a766a59 100644 --- a/xsde/cxx/parser/element-validation-source.cxx +++ b/xsde/cxx/parser/element-validation-source.cxx @@ -3,12 +3,14 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include #include -#include +using namespace std; namespace CXX { @@ -16,7 +18,7 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector Particles; + typedef vector Particles; // Find particle that can be absent. // @@ -27,7 +29,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Choice; @@ -49,12 +51,12 @@ namespace CXX Traversal::Element, Traversal::Any { - IsOptional (Boolean& r) + IsOptional (bool& r) : r_ (r) { } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!r_ && c.min () == 0) @@ -73,7 +75,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!r_ && s.min () == 0) @@ -88,7 +90,7 @@ namespace CXX !r_ && i != s.contains_end (); ++i) { - Boolean r (false); + bool r (false); IsOptional test (r); test.dispatch (i->particle ()); if (!r) @@ -98,14 +100,14 @@ namespace CXX r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (!r_ && e.min () == 0) r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { if (!r_ && a.min () == 0) @@ -113,21 +115,21 @@ namespace CXX } private: - Boolean& r_; + bool& r_; }; private: - Boolean optional_; + bool optional_; IsOptional is_optional_; SemanticGraph::Particle*& result_; }; // // - Void + void sequence_next_call (SemanticGraph::Sequence* s, Context* ctx); - Void + void choice_arm_call (SemanticGraph::Particle* p, SemanticGraph::Choice* c, Context* ctx) @@ -158,7 +160,7 @@ namespace CXX } } - Void + void sequence_next_call (SemanticGraph::Sequence* s, Context* ctx) { using SemanticGraph::Choice; @@ -207,11 +209,11 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& name (e.name ()); - Boolean subst (poly_code && e.global_p ()); + bool subst (poly_code && e.global_p ()); if (subst) os << "("; @@ -247,7 +249,7 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (a.definition_namespace ().name ()); @@ -294,7 +296,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { // This compositor should already have been tested for @@ -302,9 +304,9 @@ namespace CXX // Particles const& p (c.context ().get ("p:prefixes")); - Boolean paren (p.size () != 1); + bool paren (p.size () != 1); - for (Particles::ConstIterator i (p.begin ()), e (p.end ()); + for (Particles::const_iterator i (p.begin ()), e (p.end ()); i != e;) { if (paren) @@ -335,7 +337,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String ns (e.qualified_p () ? e.namespace_ ().name () : String ()); @@ -343,7 +345,7 @@ namespace CXX os << L << strlit (ns) << ", " << L << strlit (e.name ()); } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { String const& ns (*a.namespace_begin ()); @@ -351,7 +353,7 @@ namespace CXX os << L << strlit (ns) << ", " << L << "\"*\""; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { Particles const& p (c.context ().get ("p:prefixes")); @@ -374,7 +376,7 @@ namespace CXX // Generate sub-parser setup code as well as the pre/post calls. // - Void + void pre_post_calls (SemanticGraph::Particle& p) { using SemanticGraph::Element; @@ -383,7 +385,7 @@ namespace CXX if (Element* e = dynamic_cast (&p)) { SemanticGraph::Type& type (e->type ()); - Boolean poly (poly_code && !anonymous (type)); + bool poly (poly_code && !anonymous (type)); String const& name (ename (*e)); String fq_type (fq_name (type)); @@ -522,10 +524,10 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - UnsignedLong state (e.context ().get ("p:state")); + size_t state (e.context ().get ("p:state")); SemanticGraph::Compositor& c ( e.contained_particle ().compositor ()); @@ -549,16 +551,15 @@ namespace CXX // Make the call to _present if we haven't seen any // elements yet. // - UnsignedLong state_count ( - c.context().get ("p:state-count")); + size_t state_count (c.context().get ("p:state-count")); if (state_count > 1) { os << "if ("; - Boolean sub (false); + bool sub (false); - for (UnsignedLong i (0); i < state_count; ++i) + for (size_t i (0); i < state_count; ++i) { if (i == state) continue; @@ -609,14 +610,14 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Particle& p) { using SemanticGraph::Element; - UnsignedLong state (p.context ().get ("p:state")); + size_t state (p.context ().get ("p:state")); - UnsignedLong min (p.min ()), max (p.max ()); + size_t min (p.min ()), max (p.max ()); os << "case " << state << "UL:" << endl << "{"; @@ -695,20 +696,20 @@ namespace CXX << "}"; // case } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a ()); + bool choice (c.is_a ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get ("p:effective-min")); - UnsignedLong n (cc.get ("p:comp-number")); - UnsignedLong state (cc.get ("p:state")); + size_t max (c.max ()); + size_t min (cc.get ("p:effective-min")); + size_t n (cc.get ("p:comp-number")); + size_t state (cc.get ("p:state")); String func (choice ? "choice_" : "sequence_"); @@ -717,7 +718,7 @@ namespace CXX << "unsigned long s = ~0UL;" << endl; - Boolean first (true); + bool first (true); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -730,7 +731,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get ("p:state")); + size_t state (p.context ().get ("p:state")); if (first) first = false; @@ -755,7 +756,7 @@ namespace CXX if (Choice* pc = dynamic_cast (p)) { if (pc->min () != 0 && - pc->context ().get ("p:effective-min") == 0) + pc->context ().get ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -766,8 +767,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get ("p:state")); + size_t state (pc->context ().get ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -784,10 +784,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get ("p:effective-min") == 0) + ps->context ().get ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get ("p:state")); + size_t state (ps->context ().get ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -908,8 +907,8 @@ namespace CXX ParticleInCompositor { ParticleInSequence (Context& c, - UnsignedLong state, - UnsignedLong next_state, + size_t state, + size_t next_state, SemanticGraph::Complex& type) : ParticleInCompositor (c, type), state_ (state), particle_name_ (c) @@ -926,10 +925,10 @@ namespace CXX next_state_ = L"~0"; } - virtual Void + virtual void traverse (SemanticGraph::Particle& p) { - UnsignedLong min (p.min ()), max (p.max ()); + size_t min (p.min ()), max (p.max ()); os << "case " << state_ << "UL:" << endl << "{" @@ -1009,19 +1008,19 @@ namespace CXX << "}"; // case } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a ()); + bool choice (c.is_a ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get ("p:effective-min")); - UnsignedLong n (cc.get ("p:comp-number")); + size_t max (c.max ()); + size_t min (cc.get ("p:effective-min")); + size_t n (cc.get ("p:comp-number")); String func (choice ? "choice_" : "sequence_"); @@ -1030,7 +1029,7 @@ namespace CXX << "unsigned long s = ~0UL;" << endl; - Boolean first (true); + bool first (true); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -1043,7 +1042,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get ("p:state")); + size_t state (p.context ().get ("p:state")); if (first) first = false; @@ -1068,7 +1067,7 @@ namespace CXX if (Choice* pc = dynamic_cast (p)) { if (pc->min () != 0 && - pc->context ().get ("p:effective-min") == 0) + pc->context ().get ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -1079,8 +1078,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get ("p:state")); + size_t state (pc->context ().get ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1097,10 +1095,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get ("p:effective-min") == 0) + ps->context ().get ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get ("p:state")); + size_t state (ps->context ().get ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1253,7 +1250,7 @@ namespace CXX } private: - UnsignedLong state_; + size_t state_; String next_state_; ParticleName particle_name_; @@ -1274,7 +1271,7 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) // Empty compositor. @@ -1322,7 +1319,7 @@ namespace CXX Element& e (dynamic_cast (ci->particle ())); String ns (e.qualified_p () ? e.namespace_ ().name () : String ()); - UnsignedLong state (e.context ().get ("p:state")); + size_t state (e.context ().get ("p:state")); os << "if (count[" << state << "UL] == 0)" << "{" @@ -1348,7 +1345,7 @@ namespace CXX << "}"; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -1358,7 +1355,7 @@ namespace CXX if (!cc.count ("p:comp-number")) // Empty compositor. return; - UnsignedLong n (cc.get ("p:comp-number")); + size_t n (cc.get ("p:comp-number")); os << "void " << ename (type_) << "::" << endl << "choice_" << n << " (unsigned long& state," << endl @@ -1411,7 +1408,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!s.context().count ("p:comp-number")) // Empty compositor. @@ -1419,7 +1416,7 @@ namespace CXX using SemanticGraph::Compositor; - UnsignedLong n (s.context ().get ("p:comp-number")); + size_t n (s.context ().get ("p:comp-number")); os << "void " << ename (type_) << "::" << endl << "sequence_" << n << " (unsigned long& state," << endl @@ -1444,7 +1441,7 @@ namespace CXX os << "switch (state)" << "{"; - UnsignedLong state (0); + size_t state (0); for (Compositor::ContainsIterator ci (s.contains_begin ()), ce (s.contains_end ()); ci != ce;) @@ -1467,7 +1464,7 @@ namespace CXX ci->particle ().is_a () && !ci->particle ().context().count ("p:comp-number")); - UnsignedLong next (ci == ce ? 0 : state + 1); + size_t next (ci == ce ? 0 : state + 1); ParticleInSequence t (*this, state++, next, type_); t.dispatch (p); @@ -1502,7 +1499,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // Clear the counts and push the initial state. @@ -1514,7 +1511,7 @@ namespace CXX traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Compositor&) // Choice and sequence. { os << "v_state_& vs = *static_cast< v_state_* > (" << @@ -1543,7 +1540,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All&) { // The 'all' state machine reaches the final state only @@ -1562,19 +1559,19 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) // Choice and sequence. { using SemanticGraph::Choice; using SemanticGraph::Sequence; using SemanticGraph::Compositor; - Boolean choice (c.is_a ()); + bool choice (c.is_a ()); SemanticGraph::Context& cc (c.context ()); - UnsignedLong max (c.max ()); - UnsignedLong min (cc.get ("p:effective-min")); - UnsignedLong n (cc.get ("p:comp-number")); + size_t max (c.max ()); + size_t min (cc.get ("p:effective-min")); + size_t n (cc.get ("p:comp-number")); String func (choice ? "choice_" : "sequence_"); @@ -1606,7 +1603,7 @@ namespace CXX << "unsigned long s = ~0UL;" << endl; - Boolean first (true); + bool first (true); // Note that we don't need to worry about the compositor // being empty - this case is handled by our caller. @@ -1622,7 +1619,7 @@ namespace CXX if (!p.context ().count ("p:prefix")) break; - UnsignedLong state (p.context ().get ("p:state")); + size_t state (p.context ().get ("p:state")); if (first) first = false; @@ -1647,7 +1644,7 @@ namespace CXX if (Choice* pc = dynamic_cast (p)) { if (pc->min () != 0 && - pc->context ().get ("p:effective-min") == 0) + pc->context ().get ("p:effective-min") == 0) { // This is a required choice with effective-min == 0 (i.e., // it contains optional particle). We need to call the arm @@ -1658,8 +1655,7 @@ namespace CXX if (p) { - UnsignedLong state ( - pc->context ().get ("p:state")); + size_t state (pc->context ().get ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1676,10 +1672,9 @@ namespace CXX // to call the next callback. // if (ps->min () != 0 && ps->max () != 1 && - ps->context ().get ("p:effective-min") == 0) + ps->context ().get ("p:effective-min") == 0) { - UnsignedLong state ( - ps->context ().get ("p:state")); + size_t state (ps->context ().get ("p:state")); os << endl << "if (s > " << state << "UL)" << endl @@ -1845,7 +1840,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All&) { os << "all_0 (vd.state, v_all_count_.top (), " << @@ -1853,7 +1848,7 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Compositor&) // Choice and sequence. { os << "assert (vd.func != 0);" @@ -1881,7 +1876,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Element; @@ -1901,7 +1896,7 @@ namespace CXX (poly_runtime ? "0, " : "") << "true);" << "}"; - if (a.context ().get ("p:effective-min") != 0) + if (a.context ().get ("p:effective-min") != 0) { os << "else" << endl << "this->_schema_error (" << @@ -1919,14 +1914,13 @@ namespace CXX << "v_all_count_.pop ();"; } - virtual Void + virtual void traverse (SemanticGraph::Compositor& c) // Choice and sequence. { using SemanticGraph::Choice; using SemanticGraph::Sequence; - UnsignedLong min ( - c.context ().get ("p:effective-min")); + size_t min (c.context ().get ("p:effective-min")); os << "v_state_& vs = *static_cast< v_state_* > (" << "this->v_state_stack_.top ());" @@ -2019,7 +2013,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { // Nothing to generate if we don't have any elements and wildcards. @@ -2036,7 +2030,7 @@ namespace CXX // Don't use restriction_p here since we don't want special // treatment of anyType. // - Boolean restriction ( + bool restriction ( c.inherits_p () && c.inherits ().is_a ()); @@ -2284,7 +2278,7 @@ namespace CXX }; } - Void + void generate_element_validation_source (Context& ctx) { ctx.os << "#include " << endl diff --git a/xsde/cxx/parser/element-validation-source.hxx b/xsde/cxx/parser/element-validation-source.hxx index 8e40093..23e24f2 100644 --- a/xsde/cxx/parser/element-validation-source.hxx +++ b/xsde/cxx/parser/element-validation-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_element_validation_source (Context&); } } diff --git a/xsde/cxx/parser/elements.cxx b/xsde/cxx/parser/elements.cxx index 2f0c7e3..46518fa 100644 --- a/xsde/cxx/parser/elements.cxx +++ b/xsde/cxx/parser/elements.cxx @@ -171,7 +171,7 @@ namespace CXX return t.context ().get ("p:impl"); } - Boolean Context:: + bool Context:: has_facets (SemanticGraph::Complex& c) { if (restriction_p (c)) @@ -234,20 +234,20 @@ namespace CXX // Includes // - Void TypeForward:: + void TypeForward:: traverse (SemanticGraph::Type& t) { os << "class " << t.context ().get (name_key_) << ";"; } - Void Includes:: + void Includes:: traverse_ (SemanticGraph::Uses& u) { // Support for weak (forward) inclusion used in the file-per-type // compilation model. // SemanticGraph::Schema& s (u.schema ()); - Boolean weak (u.context ().count ("weak")); + bool weak (u.context ().count ("weak")); if (weak && (type_ == header || type_ == impl_header)) { diff --git a/xsde/cxx/parser/elements.hxx b/xsde/cxx/parser/elements.hxx index 179eaec..eaad3f7 100644 --- a/xsde/cxx/parser/elements.hxx +++ b/xsde/cxx/parser/elements.hxx @@ -90,7 +90,7 @@ namespace CXX } public: - Boolean + bool restriction_p (SemanticGraph::Complex& c) const { if (c.inherits_p () && @@ -164,7 +164,7 @@ namespace CXX public: - Boolean + bool has_facets (SemanticGraph::Complex& c); public: @@ -175,13 +175,13 @@ namespace CXX String& list_base; String& parser_map; - Boolean validation; - Boolean exceptions; - Boolean poly_code; - Boolean poly_runtime; - Boolean reset; - Boolean mixin; - Boolean tiein; + bool validation; + bool exceptions; + bool poly_code; + bool poly_runtime; + bool reset; + bool mixin; + bool tiein; Regex const* hxx_expr; Regex const* ixx_expr; @@ -212,13 +212,13 @@ namespace CXX Traversal::Fundamental::Entity { - StringBasedType (Boolean& r) + StringBasedType (bool& r) : r_ (r) { *this >> inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -226,74 +226,74 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI&) { r_ = true; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { r_ = true; } private: - Boolean& r_; + bool& r_; Traversal::Inherits inherits_; }; @@ -301,12 +301,12 @@ namespace CXX // struct RequiredAttributeTest: Traversal::Attribute { - RequiredAttributeTest (Boolean& result) + RequiredAttributeTest (bool& result) : result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (!result_ && !a.optional_p ()) @@ -314,7 +314,7 @@ namespace CXX } private: - Boolean& result_; + bool& result_; }; @@ -323,9 +323,9 @@ namespace CXX struct ParticleParamDecl: Traversal::Element, Context { ParticleParamDecl (Context& c, - Boolean& first, - Boolean name_arg, - Boolean poly) + bool& first, + bool name_arg, + bool poly) : Context (c), first_ (first), name_arg_ (name_arg), @@ -334,12 +334,12 @@ namespace CXX { } - ParticleParamDecl (Context& c, Boolean* result, Boolean poly) + ParticleParamDecl (Context& c, bool* result, bool poly) : Context (c), first_ (name_arg_), poly_ (poly), result_ (result) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_ && anonymous (e.type ())) @@ -368,15 +368,15 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean poly_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool poly_; + bool* result_; }; struct AttributeParamDecl: Traversal::Attribute, Context { - AttributeParamDecl (Context& c, Boolean& first, Boolean name_arg) + AttributeParamDecl (Context& c, bool& first, bool name_arg) : Context (c), first_ (first), name_arg_ (name_arg), @@ -384,12 +384,12 @@ namespace CXX { } - AttributeParamDecl (Context& c, Boolean* result) + AttributeParamDecl (Context& c, bool* result) : Context (c), first_ (name_arg_), result_ (result) { } - virtual Void + virtual void traverse (Type& a) { if (result_ != 0) @@ -412,16 +412,16 @@ namespace CXX } private: - Boolean& first_; - Boolean name_arg_; - Boolean* result_; + bool& first_; + bool name_arg_; + bool* result_; }; struct ParserParamDecl : Traversal::Complex, Traversal::List, Context { - ParserParamDecl (Context& c, Boolean name_arg, Boolean poly) + ParserParamDecl (Context& c, bool name_arg, bool poly) : Context (c), particle_ (c, first_, name_arg, poly), attribute_ (c, first_, name_arg), @@ -440,7 +440,7 @@ namespace CXX names_ >> attribute_; } - ParserParamDecl (Context& c, Boolean* result, Boolean poly) + ParserParamDecl (Context& c, bool* result, bool poly) : Context (c), particle_ (c, result, poly), attribute_ (c, result), @@ -457,7 +457,7 @@ namespace CXX names_ >> attribute_; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -469,7 +469,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -505,20 +505,20 @@ namespace CXX AttributeParamDecl attribute_; Traversal::Names names_; - Boolean first_; - Boolean name_arg_; - Boolean poly_; - Boolean* result_; + bool first_; + bool name_arg_; + bool poly_; + bool* result_; }; struct ParserParamTest { - ParserParamTest (Context& c, Boolean& result, Boolean poly) + ParserParamTest (Context& c, bool& result, bool poly) : impl_ (c, &result, poly) { } - Void + void traverse (SemanticGraph::Complex& c) { impl_.traverse (c); @@ -532,16 +532,16 @@ namespace CXX // struct TypeForward: Traversal::Type, Context { - TypeForward (Context& c, Char const* name_key) + TypeForward (Context& c, char const* name_key) : Context (c), name_key_ (name_key) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t); private: - Char const* name_key_; + char const* name_key_; }; struct Includes : Traversal::Imports, @@ -563,20 +563,20 @@ namespace CXX schema_ >> schema_names_ >> namespace_ >> names_ >> type_forward_; } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { traverse_ (i); } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { traverse_ (i); } private: - Void + void traverse_ (SemanticGraph::Uses&); private: @@ -599,7 +599,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (options_.root_element_first ()) diff --git a/xsde/cxx/parser/generator.cxx b/xsde/cxx/parser/generator.cxx index b226cb9..f78291e 100644 --- a/xsde/cxx/parser/generator.cxx +++ b/xsde/cxx/parser/generator.cxx @@ -9,9 +9,6 @@ #include -#include -#include - #include #include #include @@ -70,7 +67,7 @@ namespace CXX { namespace { - Char const copyright_gpl[] = + char const copyright_gpl[] = "// Copyright (c) 2005-2011 Code Synthesis Tools CC\n" "//\n" "// This program was generated by CodeSynthesis XSD/e, an XML Schema\n" @@ -91,7 +88,7 @@ namespace CXX "//\n" "//\n\n"; - Char const copyright_proprietary[] = + char const copyright_proprietary[] = "// Copyright (c) 2005-2011 Code Synthesis Tools CC\n" "//\n" "// This program was generated by CodeSynthesis XSD/e, an XML Schema to\n" @@ -101,7 +98,7 @@ namespace CXX "// license text for conditions.\n" "//\n\n"; - Char const copyright_impl[] = + char const copyright_impl[] = "// Not copyrighted - public domain.\n" "//\n" "// This sample parser implementation was generated by CodeSynthesis XSD/e,\n" @@ -110,14 +107,14 @@ namespace CXX "//\n\n"; } - Void Parser::Generator:: + void Parser::Generator:: usage () { CXX::Parser::options::print_usage (wcout); CXX::options::print_usage (wcout); } - Void Parser::Generator:: + void Parser::Generator:: process_names (options const& ops, XSDFrontend::SemanticGraph::Schema& schema, XSDFrontend::SemanticGraph::Path const& file) @@ -129,7 +126,7 @@ namespace CXX namespace { template - Void + void open (S& ifs, NarrowString const& path) { try @@ -154,7 +151,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowString const& path, WideInputFileStream& default_is) @@ -174,7 +171,7 @@ namespace CXX } } - Void + void append (WideOutputFileStream& os, NarrowStrings const& primary, NarrowStrings const& def) @@ -190,13 +187,13 @@ namespace CXX } - UnsignedLong Parser::Generator:: + size_t Parser::Generator:: generate (Parser::options const& ops, Schema& schema, Path const& file_path, - Boolean fpt, + bool fpt, TypeMap::Namespaces& type_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList& file_list, AutoUnlinks& unlinks) @@ -207,7 +204,7 @@ namespace CXX try { - Boolean generate_xml_schema (ops.generate_xml_schema ()); + bool generate_xml_schema (ops.generate_xml_schema ()); // We could be compiling several schemas at once in which case // handling of the --generate-xml-schema option gets tricky: we @@ -223,11 +220,11 @@ namespace CXX } } - Boolean impl (!generate_xml_schema && + bool impl (!generate_xml_schema && (ops.generate_noop_impl () || ops.generate_print_impl ())); - Boolean driver (gen_driver && !generate_xml_schema && + bool driver (gen_driver && !generate_xml_schema && ops.generate_test_driver ()); @@ -247,7 +244,7 @@ namespace CXX proc.process (ops, schema, file_path, true); } - Boolean validation (!ops.suppress_validation ()); + bool validation (!ops.suppress_validation ()); // Compute state machine info. // @@ -409,8 +406,8 @@ namespace CXX // Generate code. // - Boolean inline_ (ops.generate_inline () && !generate_xml_schema); - Boolean source (!generate_xml_schema); + bool inline_ (ops.generate_inline () && !generate_xml_schema); + bool source (!generate_xml_schema); NarrowString name (file_path.leaf ()); NarrowString skel_suffix (ops.skel_file_suffix ()); @@ -709,7 +706,7 @@ namespace CXX // Print copyright and license. // - Char const* copyright ( + char const* copyright ( ops.proprietary_license () ? copyright_proprietary : copyright_gpl); hxx << copyright; @@ -752,7 +749,7 @@ namespace CXX // SLOC counter. // size_t sloc_total (0); - Boolean show_sloc (ops.show_sloc ()); + bool show_sloc (ops.show_sloc ()); typedef compiler::ostream_filter diff --git a/xsde/cxx/parser/generator.hxx b/xsde/cxx/parser/generator.hxx index c2a0177..5cfed0a 100644 --- a/xsde/cxx/parser/generator.hxx +++ b/xsde/cxx/parser/generator.hxx @@ -6,34 +6,27 @@ #ifndef CXX_PARSER_GENERATOR_HXX #define CXX_PARSER_GENERATOR_HXX -#include - -#include - #include // Path #include #include - +#include #include - #include namespace CXX { namespace Parser { - using namespace Cult::Types; - class Generator { public: - static Void + static void usage (); // Assign names to global declarations. // - static Void + static void process_names (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&); @@ -42,13 +35,13 @@ namespace CXX // struct Failed {}; - static UnsignedLong + static size_t generate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean file_per_type, + bool file_per_type, TypeMap::Namespaces& type_map, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings, FileList&, AutoUnlinks&); diff --git a/xsde/cxx/parser/impl-header.cxx b/xsde/cxx/parser/impl-header.cxx index e909ce5..2ffb493 100644 --- a/xsde/cxx/parser/impl-header.cxx +++ b/xsde/cxx/parser/impl-header.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -66,7 +66,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -113,7 +113,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -145,7 +145,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& arg (arg_type (e.type ())); @@ -169,7 +169,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& arg (arg_type (a.type ())); @@ -204,12 +204,12 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean he (has (c)); - Boolean ha (has (c)); + bool hb (c.inherits_p ()); + bool he (has (c)); + bool ha (has (c)); String const& name (eimpl (c)); String const& ret (ret_type (c)); @@ -277,7 +277,7 @@ namespace CXX }; } - Void + void generate_impl_header (Context& ctx) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/impl-header.hxx b/xsde/cxx/parser/impl-header.hxx index d72ab80..e534130 100644 --- a/xsde/cxx/parser/impl-header.hxx +++ b/xsde/cxx/parser/impl-header.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_impl_header (Context&); } } diff --git a/xsde/cxx/parser/impl-source.cxx b/xsde/cxx/parser/impl-source.cxx index 5ad9a02..35df1b1 100644 --- a/xsde/cxx/parser/impl-source.cxx +++ b/xsde/cxx/parser/impl-source.cxx @@ -22,7 +22,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (eimpl (e)); @@ -127,7 +127,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (eimpl (l)); @@ -205,7 +205,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (eimpl (u)); @@ -272,7 +272,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Complex; @@ -319,7 +319,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Complex; @@ -376,10 +376,10 @@ namespace CXX names_attribute_callback_ >> attribute_callback_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); + bool hb (c.inherits_p ()); String const& name (eimpl (c)); String const& ret (ret_type (c)); @@ -503,7 +503,7 @@ namespace CXX }; } - Void + void generate_impl_source (Context& ctx) { if (ctx.options.generate_print_impl ()) diff --git a/xsde/cxx/parser/impl-source.hxx b/xsde/cxx/parser/impl-source.hxx index 22587bd..7449e97 100644 --- a/xsde/cxx/parser/impl-source.hxx +++ b/xsde/cxx/parser/impl-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_impl_source (Context&); } } diff --git a/xsde/cxx/parser/name-processor.cxx b/xsde/cxx/parser/name-processor.cxx index 2483889..d0cd8b1 100644 --- a/xsde/cxx/parser/name-processor.cxx +++ b/xsde/cxx/parser/name-processor.cxx @@ -3,16 +3,18 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include +#include +#include + #include #include #include #include -#include - -#include -#include +using namespace std; namespace CXX { @@ -22,7 +24,7 @@ namespace CXX { // // - typedef Cult::Containers::Set NameSet; + typedef set NameSet; class Context: public CXX::Context { @@ -64,7 +66,7 @@ namespace CXX { String name (escape (n + suffix)); - for (UnsignedLong i (1); set.find (name) != set.end (); ++i) + for (size_t i (1); set.find (name) != set.end (); ++i) { std::wostringstream os; os << i; @@ -85,30 +87,30 @@ namespace CXX String const skel_suffix_; String const impl_suffix_; - Cult::Containers::Map global_type_names_; + map 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& global_type_names; + map& global_type_names; - Boolean validation; - Boolean polymorphic; + bool validation; + bool polymorphic; }; // Primary names. // struct PrimaryParticle: Traversal::Element, Context { - PrimaryParticle (Context& c, NameSet& set, Boolean restriction) + PrimaryParticle (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Element; @@ -130,17 +132,17 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct PrimaryAttribute: Traversal::Attribute, Context { - PrimaryAttribute (Context& c, NameSet& set, Boolean restriction) + PrimaryAttribute (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Attribute; @@ -162,7 +164,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; @@ -176,12 +178,12 @@ namespace CXX Traversal::Sequence, Context { - ParticleTag (Context& c, NameSet& set, Boolean restriction) + ParticleTag (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Element; @@ -202,7 +204,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Any; @@ -220,7 +222,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -240,7 +242,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -262,7 +264,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryCompositor: Traversal::All, @@ -270,7 +272,7 @@ namespace CXX Traversal::Sequence, Context { - SecondaryCompositor (Context& c, NameSet& set, Boolean restriction) + SecondaryCompositor (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction), @@ -279,7 +281,7 @@ namespace CXX contain_particle_tag_ >> particle_tag_; } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // For the all compositor, maxOccurs=1 and minOccurs={0,1} @@ -294,7 +296,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -324,7 +326,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { SemanticGraph::Context& sc (s.context ()); @@ -370,7 +372,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; ParticleTag particle_tag_; Traversal::ContainsParticle contain_particle_tag_; @@ -378,15 +380,15 @@ namespace CXX struct SecondaryParticle: Traversal::Element, Context { - SecondaryParticle (Context& c, NameSet& set, Boolean restriction) + SecondaryParticle (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { - Boolean poly ( + bool poly ( polymorphic && !e.type ().context ().count ("anonymous")); SemanticGraph::Context& ec (e.context ()); @@ -418,17 +420,17 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; struct SecondaryAttribute: Traversal::Attribute, Context { - SecondaryAttribute (Context& c, NameSet& set, Boolean restriction) + SecondaryAttribute (Context& c, NameSet& set, bool restriction) : Context (c), set_ (set), restriction_ (restriction) { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { using SemanticGraph::Attribute; @@ -458,7 +460,7 @@ namespace CXX private: NameSet& set_; - Boolean restriction_; + bool restriction_; }; @@ -471,7 +473,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { SemanticGraph::Context& cc (c.context ()); @@ -493,7 +495,7 @@ namespace CXX // inheriting by restriction in which case we need to have // the same names as our base. // - Boolean restriction (false); + bool restriction (false); if (c.inherits_p ()) { @@ -607,7 +609,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { SemanticGraph::Context& c (t.context ()); @@ -679,7 +681,7 @@ namespace CXX String base_name (escape (L"post_" + n)); String post (base_name); - for (UnsignedLong i (1); set.find (post) != set.end (); ++i) + for (size_t i (1); set.find (post) != set.end (); ++i) { std::wostringstream os; os << i; @@ -702,7 +704,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& ns) { SemanticGraph::Context& nsc (ns.context ()); @@ -798,13 +800,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { set_names (t, "any_type"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { set_names (t, "any_simple_type"); @@ -812,7 +814,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { set_names (t, "boolean"); @@ -820,79 +822,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { set_names (t, "byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { set_names (t, "unsigned_byte"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { set_names (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { set_names (t, "unsigned_short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { set_names (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { set_names (t, "unsigned_int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { set_names (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { set_names (t, "unsigned_long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { set_names (t, "integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { set_names (t, "non_positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { set_names (t, "non_negative_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { set_names (t, "positive_integer"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { set_names (t, "negative_integer"); @@ -900,19 +902,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { set_names (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { set_names (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { set_names (t, "decimal"); @@ -920,49 +922,49 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { set_names (t, "string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { set_names (t, "normalized_string"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { set_names (t, "token"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { set_names (t, "nmtoken"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { set_names (t, "nmtokens"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { set_names (t, "name"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { set_names (t, "ncname"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { set_names (t, "language"); @@ -971,7 +973,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { set_names (t, "qname"); @@ -980,19 +982,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { set_names (t, "id"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { set_names (t, "idref"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { set_names (t, "idrefs"); @@ -1000,7 +1002,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { set_names (t, "uri"); @@ -1008,13 +1010,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { set_names (t, "base64_binary"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { set_names (t, "hex_binary"); @@ -1023,56 +1025,56 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { set_names (t, "date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { set_names (t, "date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { set_names (t, "duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { set_names (t, "gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { set_names (t, "gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { set_names (t, "gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { set_names (t, "gyear");; } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { set_names (t, "gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { set_names (t, "time"); @@ -1080,13 +1082,13 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity& t) { set_names (t, "entity"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities& t) { set_names (t, "entities"); @@ -1105,12 +1107,12 @@ namespace CXX return escape (base + impl_suffix); } - Void + void set_names (SemanticGraph::Type& t, String const& name) { SemanticGraph::Context& c (t.context ()); - WideChar const* ns = validation + wchar_t const* ns = validation ? L"::xsde::cxx::parser::validating::" : L"::xsde::cxx::parser::non_validating::"; @@ -1136,7 +1138,7 @@ namespace CXX Traversal::Includes, Traversal::Imports { - virtual Void + virtual void traverse (SemanticGraph::Sources& sr) { SemanticGraph::Schema& s (sr.schema ()); @@ -1148,7 +1150,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1160,7 +1162,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1178,7 +1180,7 @@ namespace CXX // struct Implies: Traversal::Implies { - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { SemanticGraph::Schema& s (i.schema ()); @@ -1191,11 +1193,11 @@ namespace CXX } }; - Void + void process_impl (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { Context ctx (ops, tu, file); @@ -1289,11 +1291,11 @@ namespace CXX } } - Void NameProcessor:: + void NameProcessor:: process (options const& ops, SemanticGraph::Schema& tu, SemanticGraph::Path const& file, - Boolean deep) + bool deep) { process_impl (ops, tu, file, deep); } diff --git a/xsde/cxx/parser/name-processor.hxx b/xsde/cxx/parser/name-processor.hxx index 25aceaa..1a28e47 100644 --- a/xsde/cxx/parser/name-processor.hxx +++ b/xsde/cxx/parser/name-processor.hxx @@ -6,26 +6,23 @@ #ifndef CXX_PARSER_NAME_PROCESSOR_HXX #define CXX_PARSER_NAME_PROCESSOR_HXX -#include - #include +#include #include namespace CXX { namespace Parser { - using namespace Cult::Types; - class NameProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const&, - Boolean deep); + bool deep); }; } } diff --git a/xsde/cxx/parser/options.cli b/xsde/cxx/parser/options.cli index 552b473..9b07011 100644 --- a/xsde/cxx/parser/options.cli +++ b/xsde/cxx/parser/options.cli @@ -3,11 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -include ; -include ; include ; // std::size_t -include ; // NarrowString +include ; // NarrowString, NarrowStrings include ; @@ -17,7 +15,7 @@ namespace CXX { class options: CXX::options { - std::vector --type-map + NarrowStrings --type-map { "", "Read XML Schema to C++ type mapping information from . @@ -116,7 +114,7 @@ namespace CXX implementation." }; - Cult::Types::NarrowString --root-element + NarrowString --root-element { "", "Indicate that is the document root. This information is @@ -125,21 +123,21 @@ namespace CXX // Suffixes. // - Cult::Types::NarrowString --skel-type-suffix = "_pskel" + NarrowString --skel-type-suffix = "_pskel" { "", "Use the provided instead of the default \cb{_pskel} to construct the names of generated parser skeletons." }; - Cult::Types::NarrowString --skel-file-suffix = "-pskel" + NarrowString --skel-file-suffix = "-pskel" { "", "Use the provided instead of the default \cb{-pskel} to construct the names of generated parser skeleton files." }; - Cult::Types::NarrowString --impl-type-suffix = "_pimpl" + NarrowString --impl-type-suffix = "_pimpl" { "", "Use the provided instead of the default \cb{_pimpl} to @@ -147,7 +145,7 @@ namespace CXX XML Schema types and sample parser implementations." }; - Cult::Types::NarrowString --impl-file-suffix = "-pimpl" + NarrowString --impl-file-suffix = "-pimpl" { "", "Use the provided instead of the default \cb{-pimpl} to diff --git a/xsde/cxx/parser/parser-forward.cxx b/xsde/cxx/parser/parser-forward.cxx index f2ee20b..4687fdc 100644 --- a/xsde/cxx/parser/parser-forward.cxx +++ b/xsde/cxx/parser/parser-forward.cxx @@ -21,7 +21,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { os << "class " << ename (e) << ";"; @@ -37,7 +37,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { os << "class " << ename (l) << ";"; @@ -53,7 +53,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { os << "class " << ename (u) << ";"; @@ -69,7 +69,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& c) { os << "class " << ename (c) << ";"; @@ -77,7 +77,7 @@ namespace CXX }; } - Void + void generate_parser_forward (Context& ctx) { ctx.os << "// Forward declarations" << endl diff --git a/xsde/cxx/parser/parser-forward.hxx b/xsde/cxx/parser/parser-forward.hxx index c96f063..b93b638 100644 --- a/xsde/cxx/parser/parser-forward.hxx +++ b/xsde/cxx/parser/parser-forward.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_forward (Context&); } } diff --git a/xsde/cxx/parser/parser-header.cxx b/xsde/cxx/parser/parser-header.cxx index f9abf09..9986e87 100644 --- a/xsde/cxx/parser/parser-header.cxx +++ b/xsde/cxx/parser/parser-header.cxx @@ -3,13 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include +#include -#include +#include #include #include +using namespace std; + namespace CXX { namespace Parser @@ -23,21 +25,21 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); SemanticGraph::Type& base (e.inherits ().base ()); String fq_base (fq_name (base)); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); t.dispatch (e); } - Boolean facets (enum_facets || has_facets (e)); + bool facets (enum_facets || has_facets (e)); os << "class " << name << ": public " << (mixin ? "virtual " : "") << fq_base @@ -54,7 +56,7 @@ namespace CXX String const& ret (ret_type (e)); String const& base_ret (ret_type (base)); - Boolean same (ret == base_ret); + bool same (ret == base_ret); os << "virtual " << ret << endl << post_name (e) << " ()" << @@ -91,7 +93,7 @@ namespace CXX // If our base has pure virtual post, override it here. // - Boolean base_same ( + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); @@ -110,8 +112,7 @@ namespace CXX // Some schemas have duplicate enumerators so we have to create // a set out of them in order get the accurate count. // - typedef Cult::Containers::Set Enums; - Enums enums; + set enums; for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); i != end; ++i) @@ -137,7 +138,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -253,7 +254,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -322,7 +323,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& p) { if (first_) @@ -334,7 +335,7 @@ namespace CXX } private: - Boolean first_; + bool first_; }; struct CompositorCallback: Traversal::All, @@ -347,7 +348,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (correspondent (a) == 0) @@ -365,7 +366,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -392,7 +393,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Root compositor that models inheritance by extension @@ -440,7 +441,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (correspondent (e) == 0) @@ -467,7 +468,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& arg (arg_type (a.type ())); @@ -494,7 +495,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& parser (eparser (e)); @@ -519,7 +520,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "void" << endl @@ -538,7 +539,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String type (fq_name (e.type ())); @@ -560,7 +561,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << fq_name (a.type ()) << "* " << emember (a) << ";"; @@ -581,14 +582,13 @@ namespace CXX } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) return; - UnsignedLong state_count ( - a.context().get ("p:state-count")); + size_t state_count (a.context().get ("p:state-count")); os << "void" << endl << "all_0 (unsigned long&," << endl @@ -606,13 +606,13 @@ namespace CXX << endl; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (!c.context().count ("p:comp-number")) return; - UnsignedLong n (c.context ().get ("p:comp-number")); + size_t n (c.context ().get ("p:comp-number")); os << "void" << endl << "choice_" << n << " (unsigned long&," << endl @@ -629,13 +629,13 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { if (!s.context().count ("p:comp-number")) return; - UnsignedLong n (s.context ().get ("p:comp-number")); + size_t n (s.context ().get ("p:comp-number")); os << "void" << endl << "sequence_" << n << " (unsigned long&," << endl @@ -666,7 +666,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { if (!a.optional_p ()) @@ -733,7 +733,7 @@ namespace CXX names_attribute_validation_state_ >> attribute_validation_state_; } - virtual Void + virtual void traverse (Type& c) { String const& name (ename (c)); @@ -742,17 +742,17 @@ namespace CXX // generate parser callbacks, etc. since they are the same as // in the base. We only need the parsing/validation code. // - Boolean hb (c.inherits_p ()); - Boolean restriction (restriction_p (c)); - Boolean facets (has_facets (c)); + bool hb (c.inherits_p ()); + bool restriction (restriction_p (c)); + bool facets (has_facets (c)); - Boolean he (has (c)); - Boolean ha (has (c)); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); - Boolean haa (has (c)); + bool hae (has_particle (c)); + bool haa (has (c)); - Boolean hra (false); // Has required attribute. + bool hra (false); // Has required attribute. if (ha) { RequiredAttributeTest test (hra); @@ -809,7 +809,7 @@ namespace CXX // post // String const& ret (ret_type (c)); - Boolean same (hb && ret == ret_type (c.inherits ().base ())); + bool same (hb && ret == ret_type (c.inherits ().base ())); os << "virtual " << ret << endl << post_name (c) << " ()" << @@ -840,7 +840,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); ParserParamTest test (*this, r, true); test.traverse (c); @@ -932,7 +932,7 @@ namespace CXX String const& base_ret (ret_type (base)); - Boolean base_same ( + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); @@ -1040,7 +1040,7 @@ namespace CXX if (validation && (he || hae)) { - UnsignedLong depth (c.context ().get ("p:depth")); + size_t depth (c.context ().get ("p:depth")); // Has to be public for some broken compilers (e.g., GH C++). // @@ -1245,13 +1245,13 @@ namespace CXX // anyType & anySimpleType. // - virtual Void + virtual void traverse (SemanticGraph::AnyType& t) { gen_typedef (t, "void"); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_typedef (t, string_type_); @@ -1259,7 +1259,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { gen_typedef (t, "bool"); @@ -1267,79 +1267,79 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { gen_typedef (t, "signed char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { gen_typedef (t, "unsigned char"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { gen_typedef (t, "short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { gen_typedef (t, "unsigned short"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { gen_typedef (t, "int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { gen_typedef (t, "unsigned int"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { gen_typedef (t, long_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { gen_typedef (t, unsigned_long_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { gen_typedef (t, "long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { gen_typedef (t, "unsigned long"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { gen_typedef (t, "unsigned long"); @@ -1347,19 +1347,19 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { gen_typedef (t, "float"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { gen_typedef (t, "double"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { gen_typedef (t, "double"); @@ -1367,31 +1367,31 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { nmtoken_ = gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { // NMTOKENS uses NMTOKEN implementation to parse individual items. @@ -1402,19 +1402,19 @@ namespace CXX gen_typedef (t, string_seq_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_typedef (t, string_type_); @@ -1422,7 +1422,7 @@ namespace CXX // Qualified name. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { gen_typedef (t, qname_type_); @@ -1430,19 +1430,19 @@ namespace CXX // ID/IDREF. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { idref_ = gen_typedef (t, string_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { // IDREFS uses IDREF implementation to parse individual items. @@ -1455,7 +1455,7 @@ namespace CXX // URI. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_typedef (t, string_type_); @@ -1463,13 +1463,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_typedef (t, buffer_type_); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_typedef (t, buffer_type_); @@ -1478,55 +1478,55 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { gen_typedef (t, xs_ns_ + L"::date"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { gen_typedef (t, xs_ns_ + L"::date_time"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { gen_typedef (t, xs_ns_ + L"::duration"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { gen_typedef (t, xs_ns_ + L"::gday"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { gen_typedef (t, xs_ns_ + L"::gmonth"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { gen_typedef (t, xs_ns_ + L"::gmonth_day"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { gen_typedef (t, xs_ns_ + L"::gyear"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { gen_typedef (t, xs_ns_ + L"::gyear_month"); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { gen_typedef (t, xs_ns_ + L"::time"); @@ -1534,18 +1534,18 @@ namespace CXX // Entity. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entity&) { } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Entities&) { } private: - Boolean + bool gen_typedef (SemanticGraph::Type& t, String const& type) { if (ret_type (t) == type) @@ -1584,8 +1584,8 @@ namespace CXX String long_type_; String unsigned_long_type_; - Boolean idref_; - Boolean nmtoken_; + bool idref_; + bool nmtoken_; }; struct FundNamespace : Namespace, Context @@ -1740,8 +1740,8 @@ namespace CXX }; } - Void - generate_parser_header (Context& ctx, Boolean generate_xml_schema) + void + generate_parser_header (Context& ctx, bool generate_xml_schema) { NarrowString extern_xml_schema; @@ -1759,12 +1759,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("p:includes")) { - typedef Cult::Containers::Set Includes; + typedef set Includes; Includes& is ( ctx.schema_root.context ().get ("p:includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; @@ -1844,12 +1844,12 @@ namespace CXX // if (ctx.schema_root.context ().count ("p:includes")) { - typedef Cult::Containers::Set Includes; + typedef set Includes; Includes& is ( ctx.schema_root.context ().get ("p:includes")); - for (Includes::ConstReverseIterator i (is.rbegin ()); + for (Includes::const_reverse_iterator i (is.rbegin ()); i != is.rend (); ++i) { ctx.os << "#include " << *i << endl; diff --git a/xsde/cxx/parser/parser-header.hxx b/xsde/cxx/parser/parser-header.hxx index 2337b64..a58ae76 100644 --- a/xsde/cxx/parser/parser-header.hxx +++ b/xsde/cxx/parser/parser-header.hxx @@ -12,8 +12,8 @@ namespace CXX { namespace Parser { - Void - generate_parser_header (Context&, Boolean generate_xml_schema); + void + generate_parser_header (Context&, bool generate_xml_schema); } } diff --git a/xsde/cxx/parser/parser-inline.cxx b/xsde/cxx/parser/parser-inline.cxx index 557a81e..fd1e6d4 100644 --- a/xsde/cxx/parser/parser-inline.cxx +++ b/xsde/cxx/parser/parser-inline.cxx @@ -14,7 +14,7 @@ namespace CXX { namespace { - Void + void facet_calls (SemanticGraph::Complex& c, Context& ctx) { using SemanticGraph::Restricts; @@ -123,19 +123,19 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); t.dispatch (e); } - UnsignedLong enum_count (0); + size_t enum_count (0); if (enum_facets) { for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ()); @@ -143,7 +143,7 @@ namespace CXX ++enum_count; } - Boolean facets (enum_facets || has_facets (e)); + bool facets (enum_facets || has_facets (e)); if (facets || tiein) os << "// " << name << endl @@ -197,8 +197,8 @@ namespace CXX } private: - Void - facet_calls (Type& e, UnsignedLong enum_count) + void + facet_calls (Type& e, size_t enum_count) { Parser::facet_calls (e, *this); @@ -217,7 +217,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -285,7 +285,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { if (tiein) @@ -328,7 +328,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& scope (ename (e.scope ())); @@ -360,7 +360,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << inl @@ -376,12 +376,12 @@ namespace CXX // struct ParticleMemberSet: Traversal::Element, Context { - ParticleMemberSet (Context& c, Boolean poly) + ParticleMemberSet (Context& c, bool poly) : Context (c), poly_ (poly) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (poly_) @@ -394,7 +394,7 @@ namespace CXX } private: - Boolean poly_; + bool poly_; }; struct AttributeMemberSet: Traversal::Attribute, Context @@ -404,7 +404,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { os << "this->" << emember (a) << " = &" << ename (a) << ";"; @@ -415,13 +415,13 @@ namespace CXX Traversal::List, Context { - BaseMemberSet (Context& c, Boolean poly) + BaseMemberSet (Context& c, bool poly) : Context (c), poly_ (poly) { inherits_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { inherits (c, inherits_); @@ -433,7 +433,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::List& l) { if (poly_) @@ -447,19 +447,19 @@ namespace CXX private: Traversal::Inherits inherits_; - Boolean poly_; + bool poly_; }; // // struct ParticleMemberInit: Traversal::Element, Context { - ParticleMemberInit (Context& c, Boolean comma) + ParticleMemberInit (Context& c, bool comma) : Context (c), first_ (!comma) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (first_) @@ -476,24 +476,24 @@ namespace CXX } } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; struct AttributeMemberInit: Traversal::Attribute, Context { - AttributeMemberInit (Context& c, Boolean comma) + AttributeMemberInit (Context& c, bool comma) : Context (c), first_ (!comma) { } - virtual Void + virtual void traverse (Type& a) { if (first_) @@ -504,14 +504,14 @@ namespace CXX os << emember (a) << " (0)"; } - Boolean + bool comma () const { return !first_; } private: - Boolean first_; + bool first_; }; // @@ -523,14 +523,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (!a.context().count ("p:comp-number")) return; - UnsignedLong state_count ( - a.context().get ("p:state-count")); + size_t state_count (a.context().get ("p:state-count")); os << "," << endl << " v_all_count_ (" << state_count << "UL, v_all_first_)"; @@ -586,17 +585,17 @@ namespace CXX contains_particle_set_poly_ >> particle_set_poly_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean facets (has_facets (c)); - Boolean he (has (c)); - Boolean ha (has (c)); + bool hb (c.inherits_p ()); + bool facets (has_facets (c)); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); + bool hae (has_particle (c)); - Boolean hra (false); // Has required attribute. + bool hra (false); // Has required attribute. if (ha) { RequiredAttributeTest test (hra); @@ -604,7 +603,7 @@ namespace CXX names (c, names_test); } - Boolean restriction (restriction_p (c)); + bool restriction (restriction_p (c)); if (!(tiein || facets || (!restriction && (he || ha)) || @@ -657,7 +656,7 @@ namespace CXX // if (poly_code && he) { - Boolean r (false); + bool r (false); ParserParamTest test (*this, r, true); test.traverse (c); @@ -705,7 +704,7 @@ namespace CXX (validation && (he || hae || hra))) os << ": "; - Boolean comma (false); + bool comma (false); if (hb && tiein) { @@ -798,7 +797,7 @@ namespace CXX os << " " << etiein (c) << " (impl)"; - Boolean comma (true); + bool comma (true); if (!restriction && (he || ha)) { @@ -902,7 +901,7 @@ namespace CXX }; } - Void + void generate_parser_inline (Context& ctx) { // Emit "weak" header includes that are used in the file-per-type diff --git a/xsde/cxx/parser/parser-inline.hxx b/xsde/cxx/parser/parser-inline.hxx index 46b0f39..76c1ef2 100644 --- a/xsde/cxx/parser/parser-inline.hxx +++ b/xsde/cxx/parser/parser-inline.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_inline (Context&); } } diff --git a/xsde/cxx/parser/parser-source.cxx b/xsde/cxx/parser/parser-source.cxx index 868998f..dcb7c26 100644 --- a/xsde/cxx/parser/parser-source.cxx +++ b/xsde/cxx/parser/parser-source.cxx @@ -3,13 +3,15 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include +#include -#include +#include #include #include +using namespace std; + namespace CXX { namespace Parser @@ -23,7 +25,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); @@ -31,12 +33,12 @@ namespace CXX SemanticGraph::Type& base (e.inherits ().base ()); String const& base_ret (ret_type (base)); - Boolean same (ret == base_ret); - Boolean base_same ( + bool same (ret == base_ret); + bool base_same ( base.inherits_p () && base_ret == ret_type (base.inherits ().base ())); - Boolean enum_facets (false); // Whether we need to set enum facets. + bool enum_facets (false); // Whether we need to set enum facets. if (validation) { StringBasedType t (enum_facets); @@ -106,7 +108,7 @@ namespace CXX if (validation) { - Boolean gen (!anonymous (e)); + bool gen (!anonymous (e)); // We normally don't need to enter anonymous types into // the inheritance map. The only exception is when an @@ -162,7 +164,7 @@ namespace CXX if (enum_facets) { - typedef Cult::Containers::Set Enums; + typedef set Enums; Enums enums; for (Type::NamesIterator i (e.names_begin ()), @@ -173,7 +175,7 @@ namespace CXX "_enums_[" << enums.size () << "UL] = " << "{"; - for (Enums::Iterator b (enums.begin ()), i (b), end (enums.end ()); + for (Enums::iterator b (enums.begin ()), i (b), end (enums.end ()); i != end; ++i) os << (i != b ? ",\n" : "") << strlit (*i); @@ -191,7 +193,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& l) { String const& name (ename (l)); @@ -375,7 +377,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& u) { String const& name (ename (u)); @@ -441,7 +443,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { String const& m (emember (e)); @@ -468,7 +470,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& m (emember (a)); @@ -488,11 +490,11 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { - Boolean poly (poly_code && !anonymous (e.type ())); - Boolean subst (poly && e.global_p ()); + bool poly (poly_code && !anonymous (e.type ())); + bool subst (poly && e.global_p ()); if (e.qualified_p () && e.namespace_ ().name ()) { @@ -592,12 +594,12 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { String const& name (ename (e)); - Boolean poly (poly_code && !anonymous (e.type ())); - Boolean subst (poly && e.global_p ()); + bool poly (poly_code && !anonymous (e.type ())); + bool subst (poly && e.global_p ()); if (e.qualified_p () && e.namespace_ ().name ()) { @@ -706,7 +708,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& a) { String const& name (ename (a)); @@ -802,7 +804,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { if (correspondent (a) == 0) @@ -834,7 +836,7 @@ namespace CXX Traversal::All::traverse (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { if (c.contains_begin () == c.contains_end ()) @@ -865,7 +867,7 @@ namespace CXX Traversal::Choice::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Root compositor that models inheritance by extension @@ -969,7 +971,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (correspondent (e) == 0) @@ -1009,7 +1011,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { String const& name (ename (a)); @@ -1101,17 +1103,17 @@ namespace CXX names_attribute_ >> attribute_; } - virtual Void + virtual void traverse (Type& c) { - Boolean hb (c.inherits_p ()); - Boolean restriction (restriction_p (c)); - Boolean he (has (c)); - Boolean ha (has (c)); + bool hb (c.inherits_p ()); + bool restriction (restriction_p (c)); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); + bool hae (has_particle (c)); - Boolean hra (false); // Has required attribute. + bool hra (false); // Has required attribute. if (ha) { RequiredAttributeTest test (hra); @@ -1121,10 +1123,10 @@ namespace CXX String const& name (ename (c)); String const& ret (ret_type (c)); - Boolean same (hb && ret == ret_type (c.inherits ().base ())); + bool same (hb && ret == ret_type (c.inherits ().base ())); String base_ret; - Boolean base_same (true); + bool base_same (true); if (tiein && hb) { @@ -1294,7 +1296,7 @@ namespace CXX if (hb && validation) { - Boolean gen (!anonymous (c)); + bool gen (!anonymous (c)); // We normally don't need to enter anonymous types into // the inheritance map. The only exception is when an @@ -1555,7 +1557,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (e.substitutes_p ()) @@ -1595,7 +1597,7 @@ namespace CXX }; } - Void + void generate_parser_source (Context& ctx) { if (ctx.tiein) diff --git a/xsde/cxx/parser/parser-source.hxx b/xsde/cxx/parser/parser-source.hxx index d2f7157..5d3bd4c 100644 --- a/xsde/cxx/parser/parser-source.hxx +++ b/xsde/cxx/parser/parser-source.hxx @@ -12,7 +12,7 @@ namespace CXX { namespace Parser { - Void + void generate_parser_source (Context&); } } diff --git a/xsde/cxx/parser/print-impl-common.hxx b/xsde/cxx/parser/print-impl-common.hxx index df379fa..c9fca22 100644 --- a/xsde/cxx/parser/print-impl-common.hxx +++ b/xsde/cxx/parser/print-impl-common.hxx @@ -76,13 +76,13 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Type&) { gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_string (t); @@ -90,7 +90,7 @@ namespace CXX // Boolean. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Boolean& t) { if (default_type (t, "bool")) @@ -108,7 +108,7 @@ namespace CXX // Integral types. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Byte& t) { if (default_type (t, "signed char")) @@ -124,7 +124,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedByte& t) { if (default_type (t, "unsigned char")) @@ -140,7 +140,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Short& t) { if (default_type (t, "short")) @@ -156,7 +156,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedShort& t) { if (default_type (t, "unsigned short")) @@ -172,7 +172,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Int& t) { if (default_type (t, "int")) @@ -188,7 +188,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedInt& t) { if (default_type (t, "unsigned int")) @@ -204,7 +204,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Long& t) { if (options.no_long_long ()) @@ -237,7 +237,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::UnsignedLong& t) { if (options.no_long_long ()) @@ -270,7 +270,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Integer& t) { if (default_type (t, "long")) @@ -286,7 +286,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NegativeInteger& t) { if (default_type (t, "long")) @@ -302,7 +302,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonPositiveInteger& t) { if (default_type (t, "long")) @@ -318,7 +318,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::PositiveInteger& t) { if (default_type (t, "unsigned long")) @@ -334,7 +334,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NonNegativeInteger& t) { if (default_type (t, "unsigned long")) @@ -352,7 +352,7 @@ namespace CXX // Floats. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Float& t) { if (default_type (t, "float")) @@ -368,7 +368,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Double& t) { if (default_type (t, "double")) @@ -384,7 +384,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Decimal& t) { if (default_type (t, "double")) @@ -402,61 +402,61 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_string (t); @@ -465,13 +465,13 @@ namespace CXX // String sequences. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { gen_sequence (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { gen_sequence (t); @@ -480,7 +480,7 @@ namespace CXX // QName // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { if (options.no_stl ()) @@ -535,13 +535,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_buffer (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_buffer (t); @@ -549,7 +549,7 @@ namespace CXX // Date/time. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Date& t) { if (default_type (t, xs_ns_name () + L"::date")) @@ -571,7 +571,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::DateTime& t) { if (default_type (t, xs_ns_name () + L"::date_time")) @@ -600,7 +600,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Duration& t) { if (default_type (t, xs_ns_name () + L"::duration")) @@ -637,7 +637,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Day& t) { if (default_type (t, xs_ns_name () + L"::gday")) @@ -655,7 +655,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Month& t) { if (default_type (t, xs_ns_name () + L"::gmonth")) @@ -673,7 +673,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::MonthDay& t) { if (default_type (t, xs_ns_name () + L"::gmonth_day")) @@ -693,7 +693,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Year& t) { if (default_type (t, xs_ns_name () + L"::gyear")) @@ -711,7 +711,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::YearMonth& t) { if (default_type (t, xs_ns_name () + L"::gyear_month")) @@ -731,7 +731,7 @@ namespace CXX gen_user_type (); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Time& t) { if (default_type (t, xs_ns_name () + L"::time")) @@ -922,7 +922,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::AnySimpleType& t) { gen_string (t); @@ -930,61 +930,61 @@ namespace CXX // Strings. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::String& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NormalizedString& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Token& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameToken& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Name& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NCName& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Language& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Id& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRef& t) { gen_string (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::AnyURI& t) { gen_string (t); @@ -993,13 +993,13 @@ namespace CXX // String sequences. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::NameTokens& t) { gen_sequence (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::IdRefs& t) { gen_sequence (t); @@ -1008,7 +1008,7 @@ namespace CXX // QName // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::QName& t) { if (options.no_stl () && @@ -1026,13 +1026,13 @@ namespace CXX // Binary. // - virtual Void + virtual void traverse (SemanticGraph::Fundamental::Base64Binary& t) { gen_buffer (t); } - virtual Void + virtual void traverse (SemanticGraph::Fundamental::HexBinary& t) { gen_buffer (t); diff --git a/xsde/cxx/parser/state-processor.cxx b/xsde/cxx/parser/state-processor.cxx index 3caeb00..6e079d7 100644 --- a/xsde/cxx/parser/state-processor.cxx +++ b/xsde/cxx/parser/state-processor.cxx @@ -3,6 +3,9 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include + #include #include @@ -10,9 +13,7 @@ #include #include -#include - -#include +using namespace std; namespace CXX { @@ -20,17 +21,14 @@ namespace CXX { namespace { - typedef Cult::Containers::Vector Particles; + typedef vector Particles; void print (Particles const& p) { - using std::wcerr; - using std::endl; - wcerr << "prefixes: " << endl; - for (Particles::ConstIterator i (p.begin ()); i != p.end (); ++i) + for (Particles::const_iterator i (p.begin ()); i != p.end (); ++i) { if (SemanticGraph::Element* e = dynamic_cast (*i)) @@ -52,10 +50,10 @@ namespace CXX Traversal::Choice, Traversal::Sequence { - Particle (UnsignedLong& all, - UnsignedLong& choice, - UnsignedLong& sequence, - UnsignedLong& depth) + Particle (size_t& all, + size_t& choice, + size_t& sequence, + size_t& depth) : all_ (all), choice_ (choice), sequence_ (sequence), @@ -63,7 +61,7 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { using SemanticGraph::Compositor; @@ -78,8 +76,8 @@ namespace CXX // compositor cannot contain any nested compositors. // - UnsignedLong state (0); - UnsignedLong min (0); + size_t state (0); + size_t min (0); for (Compositor::ContainsIterator ci (a.contains_begin ()); ci != a.contains_end (); ++ci) @@ -101,8 +99,7 @@ namespace CXX { a.context ().set ("p:comp-number", choice_++); a.context ().set ("p:prefixes", prefixes_); - a.context ().set ("p:state-count", - UnsignedLong (prefixes_.size ())); + a.context ().set ("p:state-count", size_t (prefixes_.size ())); // effective-min = min * actual-min // @@ -115,7 +112,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { using SemanticGraph::Compositor; @@ -127,8 +124,8 @@ namespace CXX // the actual value specified in the schema. // - UnsignedLong state (0); - UnsignedLong min (1); + size_t state (0); + size_t min (1); for (Compositor::ContainsIterator ci (c.contains_begin ()); ci != c.contains_end (); ++ci) @@ -145,7 +142,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -160,7 +157,7 @@ namespace CXX t.prefixes_.end ().base ()); if (min == 1 && - p.context ().get ("p:effective-min") == 0) + p.context ().get ("p:effective-min") == 0) min = 0; } @@ -184,7 +181,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { using SemanticGraph::Compositor; @@ -196,9 +193,9 @@ namespace CXX // of the actual value specified in the schema. // - Boolean prefix (true); - UnsignedLong state (0); - UnsignedLong min (0); + bool prefix (true); + size_t state (0); + size_t min (0); for (Compositor::ContainsIterator ci (s.contains_begin ()); ci != s.contains_end (); ++ci) @@ -218,7 +215,7 @@ namespace CXX } else { - UnsignedLong depth (0); + size_t depth (0); Particle t (all_, choice_, sequence_, depth); t.dispatch (p); @@ -234,7 +231,7 @@ namespace CXX t.prefixes_.begin ().base (), t.prefixes_.end ().base ()); - if (p.context ().get ("p:effective-min") != 0) + if (p.context ().get ("p:effective-min") != 0) min = 1; } } @@ -267,11 +264,11 @@ namespace CXX private: Particles prefixes_; - UnsignedLong& all_; - UnsignedLong& choice_; - UnsignedLong& sequence_; + size_t& all_; + size_t& choice_; + size_t& sequence_; - UnsignedLong& depth_; + size_t& depth_; }; @@ -279,12 +276,12 @@ namespace CXX // struct Complex: Traversal::Complex { - virtual Void + virtual void traverse (Type& c) { if (c.contains_compositor_p ()) { - UnsignedLong all (0), choice (0), sequence (0), depth (0); + size_t all (0), choice (0), sequence (0), depth (0); Particle t (all, choice, sequence, depth); t.dispatch (c.contains_compositor ().compositor ()); @@ -297,7 +294,7 @@ namespace CXX }; } - Void StateProcessor:: + void StateProcessor:: process (SemanticGraph::Schema& tu, SemanticGraph::Path const&) { Traversal::Schema schema; diff --git a/xsde/cxx/parser/state-processor.hxx b/xsde/cxx/parser/state-processor.hxx index 9a1bca6..58ca460 100644 --- a/xsde/cxx/parser/state-processor.hxx +++ b/xsde/cxx/parser/state-processor.hxx @@ -6,19 +6,18 @@ #ifndef CXX_PARSER_STATE_PROCESSOR_HXX #define CXX_PARSER_STATE_PROCESSOR_HXX -#include #include +#include + namespace CXX { namespace Parser { - using namespace Cult::Types; - class StateProcessor { public: - Void + void process (XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& file); }; diff --git a/xsde/cxx/parser/type-processor.cxx b/xsde/cxx/parser/type-processor.cxx index eacede8..3513aed 100644 --- a/xsde/cxx/parser/type-processor.cxx +++ b/xsde/cxx/parser/type-processor.cxx @@ -3,7 +3,7 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include +#include #include #include @@ -11,6 +11,8 @@ #include #include +using namespace std; + namespace CXX { namespace Parser @@ -23,14 +25,14 @@ namespace CXX { Type (SemanticGraph::Schema& schema, TypeMap::Namespaces& type_map, - Boolean add_includes) + bool add_includes) : schema_ (schema), type_map_ (type_map), add_includes_ (add_includes) { } - virtual Void + virtual void traverse (SemanticGraph::Type& type) { using TypeMap::Namespace; @@ -48,7 +50,7 @@ namespace CXX // match the type in order to add include directives to the // new root schema. // - Boolean set (true); + bool set (true); if (tc.count ("p:ret-type")) { @@ -69,12 +71,12 @@ namespace CXX // std::wcerr << "traversing: " << ns_name << "#" << t_name << endl; - for (Namespaces::ConstIterator n (type_map_.begin ()); + for (Namespaces::const_iterator n (type_map_.begin ()); n != type_map_.end (); ++n) { // Check if the namespace matches. // - Boolean ns_match; + bool ns_match; if (!n->xsd_name ().empty ()) { @@ -135,7 +137,7 @@ namespace CXX arg_type = ret_type; else { - WideChar last (ret_type[ret_type.size () - 1]); + wchar_t last (ret_type[ret_type.size () - 1]); // If it is already a pointer or reference then use // it as is. @@ -162,7 +164,7 @@ namespace CXX { if (n->includes_begin () != n->includes_end ()) { - typedef Cult::Containers::Set Includes; + typedef std::set Includes; SemanticGraph::Context& sc (schema_.context ()); @@ -189,14 +191,14 @@ namespace CXX private: SemanticGraph::Schema& schema_; TypeMap::Namespaces& type_map_; - Boolean add_includes_; + bool add_includes_; }; // // struct BaseType: Traversal::Complex { - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { Complex::inherits (c); @@ -214,8 +216,8 @@ namespace CXX { GlobalType (SemanticGraph::Schema& schema, TypeMap::Namespaces& type_map, - Boolean add_includes, - Boolean tiein) + bool add_includes, + bool tiein) : type_ (schema, type_map, add_includes) { inherits_ >> type_; @@ -231,20 +233,20 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { type_.traverse (t); } - virtual Void + virtual void traverse (SemanticGraph::List& l) { type_.traverse (l); Traversal::List::argumented (l, argumented_); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { type_.traverse (c); @@ -253,7 +255,7 @@ namespace CXX Complex::names (c, names_); } - virtual Void + virtual void traverse (SemanticGraph::Enumeration& e) { type_.traverse (e); @@ -272,12 +274,12 @@ namespace CXX Traversal::Argumented argumented_; }; - Void + void process_impl (options const& ops, XSDFrontend::SemanticGraph::Schema& tu, TypeMap::Namespaces& type_map) { - Boolean tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()); + bool tiein (!ops.reuse_style_mixin () && !ops.reuse_style_none ()); if (tu.names_begin ()->named ().name () == L"http://www.w3.org/2001/XMLSchema") @@ -300,7 +302,7 @@ namespace CXX // If --extern-xml-schema is specified, then we don't want // includes from the XML Schema type map. // - Boolean extern_xml_schema (ops.extern_xml_schema ()); + bool extern_xml_schema (ops.extern_xml_schema ()); // Besides types defined in this schema, also process those // referenced by global elements in case we are generating @@ -341,7 +343,7 @@ namespace CXX } } - Void TypeProcessor:: + void TypeProcessor:: process (options const& ops, XSDFrontend::SemanticGraph::Schema& s, TypeMap::Namespaces& tm) diff --git a/xsde/cxx/parser/type-processor.hxx b/xsde/cxx/parser/type-processor.hxx index de16a82..a3ccbf9 100644 --- a/xsde/cxx/parser/type-processor.hxx +++ b/xsde/cxx/parser/type-processor.hxx @@ -6,24 +6,20 @@ #ifndef CXX_PARSER_TYPE_PROCESSOR_HXX #define CXX_PARSER_TYPE_PROCESSOR_HXX -#include - #include +#include #include - #include namespace CXX { namespace Parser { - using namespace Cult::Types; - class TypeProcessor { public: - Void + void process (options const&, XSDFrontend::SemanticGraph::Schema&, TypeMap::Namespaces&); diff --git a/xsde/cxx/parser/validator.cxx b/xsde/cxx/parser/validator.cxx index bf5dffb..636dba4 100644 --- a/xsde/cxx/parser/validator.cxx +++ b/xsde/cxx/parser/validator.cxx @@ -3,6 +3,9 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include +#include + #include #include @@ -10,9 +13,7 @@ #include -#include - -using std::wcerr; +using namespace std; namespace CXX { @@ -27,7 +28,7 @@ namespace CXX SemanticGraph::Path const& path, Parser::options const& options, const WarningSet& disabled_warnings, - Boolean& valid_) + bool& valid_) : Context (std::wcerr, root, path, options, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), @@ -40,8 +41,8 @@ namespace CXX } public: - Boolean - is_disabled (Char const* w) + bool + is_disabled (char const* w) { return disabled_warnings_all_ || disabled_warnings_.find (w) != disabled_warnings_.end (); @@ -76,10 +77,10 @@ namespace CXX protected: const WarningSet& disabled_warnings_; - Boolean disabled_warnings_all_; - Boolean& valid; - Boolean& subst_group_warning_issued; - Boolean subst_group_warning_issued_; + bool disabled_warnings_all_; + bool& valid; + bool& subst_group_warning_issued; + bool subst_group_warning_issued_; }; // @@ -100,18 +101,18 @@ namespace CXX { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { using SemanticGraph::Any; - Boolean q (e.qualified_p ()); + bool q (e.qualified_p ()); String ns (q ? e.namespace_ ().name () : ""); for (Any::NamespaceIterator i (any_.namespace_begin ()); i != any_.namespace_end (); ++i) { - Boolean failed (false); + bool failed (false); if (*i == L"##any") { @@ -184,14 +185,14 @@ namespace CXX { } - virtual Void + virtual void post (Type& c) { // Go down the inheritance hierarchy. // if (down_) { - Boolean up = up_; + bool up = up_; up_ = false; if (c.inherits_p ()) @@ -204,7 +205,7 @@ namespace CXX // if (up_) { - Boolean down = down_; + bool down = down_; down_ = false; for (Type::BegetsIterator i (c.begets_begin ()); @@ -218,10 +219,10 @@ namespace CXX } private: - Boolean up_, down_; + bool up_, down_; }; - virtual Void + virtual void traverse (SemanticGraph::Any& a) { using SemanticGraph::Compositor; @@ -279,7 +280,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { using SemanticGraph::Schema; @@ -325,7 +326,7 @@ namespace CXX Complex::traverse (c); } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (t.named_p ()) @@ -334,7 +335,7 @@ namespace CXX } } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (is_disabled ("P002")) @@ -358,7 +359,7 @@ namespace CXX // Return true if root sources s. // - Boolean + bool sources_p (SemanticGraph::Schema& root, SemanticGraph::Schema& s) { using SemanticGraph::Schema; @@ -378,7 +379,7 @@ namespace CXX } private: - Containers::Set types_; + set types_; Sources sources_; @@ -399,12 +400,12 @@ namespace CXX // struct AnonymousMember: protected ValidationContext { - AnonymousMember (ValidationContext& c, Boolean& error_issued) + AnonymousMember (ValidationContext& c, bool& error_issued) : ValidationContext (c), error_issued_ (error_issued) { } - Boolean + bool traverse_common (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); @@ -446,18 +447,18 @@ namespace CXX } private: - Boolean& error_issued_; + bool& error_issued_; }; struct AnonymousElement: Traversal::Element, AnonymousMember { - AnonymousElement (ValidationContext& c, Boolean& error_issued) + AnonymousElement (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { if (traverse_common (e)) @@ -477,12 +478,12 @@ namespace CXX struct AnonymousAttribute: Traversal::Attribute, AnonymousMember { - AnonymousAttribute (ValidationContext& c, Boolean& error_issued) + AnonymousAttribute (ValidationContext& c, bool& error_issued) : AnonymousMember (c, error_issued) { } - virtual Void + virtual void traverse (Type& a) { if (traverse_common (a)) @@ -521,9 +522,9 @@ namespace CXX } private: - Boolean error_issued_; + bool error_issued_; - Containers::Set types_; + set types_; Sources sources_; @@ -547,7 +548,7 @@ namespace CXX { } - virtual Void + virtual void traverse (Type& e) { if (!valid) @@ -590,14 +591,14 @@ namespace CXX }; } - Boolean Validator:: + bool Validator:: validate (options const& ops, SemanticGraph::Schema& root, SemanticGraph::Path const& path, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings) { - Boolean valid (true); + bool valid (true); ValidationContext ctx (root, path, ops, disabled_warnings, valid); // @@ -624,9 +625,9 @@ namespace CXX // // { - Boolean ref (ops.root_element_first ()); - Boolean rel (ops.root_element_last ()); - Boolean re (ops.root_element ()); + bool ref (ops.root_element_first ()); + bool rel (ops.root_element_last ()); + bool re (ops.root_element ()); if ((ref && rel) || (ref && re) || (rel && re)) { diff --git a/xsde/cxx/parser/validator.hxx b/xsde/cxx/parser/validator.hxx index 2cd7931..c17c048 100644 --- a/xsde/cxx/parser/validator.hxx +++ b/xsde/cxx/parser/validator.hxx @@ -6,28 +6,25 @@ #ifndef CXX_PARSER_VALIDATOR_HXX #define CXX_PARSER_VALIDATOR_HXX -#include - #include #include #include +#include namespace CXX { namespace Parser { - using namespace Cult::Types; - class Validator { public: - Boolean + bool validate (options const&, XSDFrontend::SemanticGraph::Schema&, XSDFrontend::SemanticGraph::Path const& tu, - Boolean gen_driver, + bool gen_driver, const WarningSet& disabled_warnings); }; } 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 (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 ()); @@ -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 +#include +#include + #include #include #include -#include -#include - -#include +using namespace std; namespace CXX { @@ -19,11 +20,8 @@ namespace CXX { namespace { - typedef - Cult::Containers::Map - TypeInstanceMap; - - typedef Cult::Containers::Set InstanceSet; + typedef map TypeInstanceMap; + typedef set InstanceSet; // For base types we only want member's types, but not the // base itself. @@ -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 type_set_; + set 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 (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 ()); @@ -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 ("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 (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 -#include -#include - #include #include #include @@ -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 - 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 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 - -#include #include // Path #include #include +#include #include @@ -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 (c)); - Boolean ha (has (c)); + bool hb (c.inherits_p ()); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); - Boolean haa (has (c)); + bool hae (has_particle (c)); + bool haa (has (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 (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 (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 +#include +#include +#include + #include #include #include #include -#include - -#include -#include +using namespace std; namespace CXX { @@ -22,7 +24,7 @@ namespace CXX { // // - typedef Cult::Containers::Set NameSet; + typedef set 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 global_type_names_; + map 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& global_type_names; + map& 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 ("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 ("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 ("s:name")); if (min == 0 && max == 1) @@ -537,7 +539,7 @@ namespace CXX *ac.get ("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 - #include +#include #include 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 ; -include ; include ; // std::size_t -include ; // NarrowString +include ; // NarrowString, NarrowStrings include ; @@ -17,7 +15,7 @@ namespace CXX { class options: CXX::options { - std::vector --type-map + NarrowStrings --type-map { "", "Read XML Schema to C++ type mapping information from . @@ -105,7 +103,7 @@ namespace CXX implementation." }; - Cult::Types::NarrowString --root-element + NarrowString --root-element { "", "Indicate that 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" { "", "Use the provided 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" { "", "Use the provided 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" { "", "Use the provided 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" { "", "Use the provided 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 +#include -#include +#include #include #include +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 Enums; - Enums enums; + set 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 (c)); - Boolean ha (has (c)); + bool hb (c.inherits_p ()); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); - Boolean haa (has (c)); + bool hae (has_particle (c)); + bool haa (has (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 Includes; + typedef set Includes; Includes& is ( ctx.schema_root.context ().get ("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 Includes; + typedef set Includes; Includes& is ( ctx.schema_root.context ().get ("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 (c)); - Boolean ha (has (c)); - Boolean restriction (restriction_p (c)); - Boolean facets (has_facets (c)); + bool hb (c.inherits_p ()); + bool he (has (c)); + bool ha (has (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 +#include -#include +#include #include #include +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 (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 Enums; + typedef set 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 (c)); - Boolean ha (has (c)); + bool hb (c.inherits_p ()); + bool he (has (c)); + bool ha (has (c)); - Boolean hae (has_particle (c)); - Boolean haa (has (c)); + bool hae (has_particle (c)); + bool haa (has (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 ()); // _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 +#include #include #include @@ -11,6 +11,8 @@ #include #include +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 Includes; - + typedef std::set 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 - #include +#include #include - #include 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 +#include + #include #include @@ -10,9 +13,7 @@ #include -#include - -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 types_; + set 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 types_; + set 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 - #include -#include - #include +#include + +#include 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); }; } -- cgit v1.1