diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
commit | 8286ac511144e4f17d34eac9affb97e50646344a (patch) | |
tree | f1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /xsd/xsd/cxx/parser/elements.cxx | |
parent | a15cf65c44d5c224169c32ef5495b68c758134b7 (diff) |
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'xsd/xsd/cxx/parser/elements.cxx')
-rw-r--r-- | xsd/xsd/cxx/parser/elements.cxx | 113 |
1 files changed, 43 insertions, 70 deletions
diff --git a/xsd/xsd/cxx/parser/elements.cxx b/xsd/xsd/cxx/parser/elements.cxx index b3458c7..889eea4 100644 --- a/xsd/xsd/cxx/parser/elements.cxx +++ b/xsd/xsd/cxx/parser/elements.cxx @@ -1,6 +1,5 @@ // file : xsd/cxx/parser/elements.cxx -// author : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include <cxx/parser/elements.hxx> @@ -9,60 +8,16 @@ namespace CXX { namespace Parser { - // Keep this symbol first to help HP-UX linker (long symbols?). - // - Content::Value Context:: - content (SemanticGraph::Complex& c) - { - using namespace SemanticGraph; - - if (c.mixed_p ()) - return Content::mixed; - - if (c.inherits_p ()) - { - Type& base (c.inherits ().base ()); - - if (Complex* cb = dynamic_cast<Complex*> (&base)) - return content (*cb); - - if (base.is_a<AnyType> ()) - return Content::complex; - - // Everyhting else (built-in type and AnySimpleType) is simple - // content. - // - return Content::simple; - } - else - return Content::complex; - } - Context:: Context (std::wostream& o, SemanticGraph::Schema& root, SemanticGraph::Path const& path, - CLI::Options const& ops, + options_type const& ops, StringLiteralMap const* map, Regex const* he, Regex const* ie, Regex const* hie) - : CXX::Context (o, - root, - path, - map, - ops.value<CLI::char_type> (), - ops.value<CLI::char_encoding> (), - ops.value<CLI::include_with_brackets> (), - ops.value<CLI::include_prefix> (), - ops.value<CLI::export_symbol> (), - ops.value<CLI::namespace_map> (), - ops.value<CLI::namespace_regex> (), - ops.value<CLI::namespace_regex_trace> (), - ops.value<CLI::include_regex> (), - ops.value<CLI::include_regex_trace> (), - ops.value<CLI::generate_inline> (), - ops.value<CLI::reserved_name> ()), + : CXX::Context (o, root, path, ops, map), options (ops), xml_parser (xml_parser_), simple_base (simple_base_), @@ -77,11 +32,11 @@ namespace CXX hxx_expr (he), ixx_expr (ie), hxx_impl_expr (hie), - xml_parser_ (ops.value<CLI::xml_parser> ()), - validation_ ((ops.value<CLI::xml_parser> () == "expat" || - ops.value<CLI::generate_validation> ()) && - !ops.value<CLI::suppress_validation> ()), - polymorphic_ (ops.value<CLI::generate_polymorphic> ()) + xml_parser_ (ops.xml_parser ()), + validation_ ((ops.xml_parser () == "expat" || + ops.generate_validation ()) && + !ops.suppress_validation ()), + polymorphic_ (ops.generate_polymorphic ()) { if (char_type == L"char") std_string_type = L"::std::string"; @@ -144,7 +99,34 @@ namespace CXX { } - Boolean Context:: + Content::Value Context:: + content (SemanticGraph::Complex& c) + { + using namespace SemanticGraph; + + if (c.mixed_p ()) + return Content::mixed; + + if (c.inherits_p ()) + { + Type& base (c.inherits ().base ()); + + if (Complex* cb = dynamic_cast<Complex*> (&base)) + return content (*cb); + + if (base.is_a<AnyType> ()) + return Content::complex; + + // Everyhting else (built-in type and AnySimpleType) is simple + // content. + // + return Content::simple; + } + else + return Content::complex; + } + + bool Context:: anonymous (SemanticGraph::Type& t) { return t.context ().count ("anonymous"); @@ -181,12 +163,6 @@ namespace CXX } String const& Context:: - emember_cache (SemanticGraph::Member& m) - { - return m.context ().get<String> ("member-cache"); - } - - String const& Context:: emember_map (SemanticGraph::Member& m) { return m.context ().get<String> ("member-map"); @@ -200,20 +176,20 @@ namespace CXX // Includes // - Void TypeForward:: + void TypeForward:: traverse (SemanticGraph::Type& t) { os << "class " << t.context ().get<String> (name_key_) << ";"; } - Void Includes:: + void Includes:: traverse_ (SemanticGraph::Uses& u) { // Support for weak (forward) inclusion used in the file-per-type // compilation model. // SemanticGraph::Schema& s (u.schema ()); - Boolean weak (u.context ().count ("weak")); + bool weak (u.context ().count ("weak")); if (weak && (type_ == header || type_ == impl_header)) { @@ -233,6 +209,7 @@ namespace CXX s.context ().count ("renamed") ? s.context ().get<SemanticGraph::Path> ("renamed") : u.path ()); + path.normalize (); // Try to use the portable representation of the path. If that // fails, fall back to the native representation. @@ -240,15 +217,11 @@ namespace CXX NarrowString path_str; try { - path_str = path.string (); + path_str = path.posix_string (); } catch (SemanticGraph::InvalidPath const&) { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - path_str = path.native_file_string (); -#else path_str = path.string (); -#endif } String inc_path; @@ -258,12 +231,12 @@ namespace CXX case header: case source: { - inc_path = ctx_.hxx_expr->merge (path_str); + inc_path = ctx_.hxx_expr->replace (path_str); break; } case impl_header: { - inc_path = ctx_.hxx_impl_expr->merge (path_str); + inc_path = ctx_.hxx_impl_expr->replace (path_str); break; } } |