diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-10-23 07:35:46 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-10-23 07:35:46 +0200 |
commit | 72d4cfb0a3806ada247b9dd583d06e1ebe04d046 (patch) | |
tree | 203a40ebe7a59b57f375f5c7db39ebab9a7be265 /xsde/cxx/hybrid/parser-aggregate-header.cxx | |
parent | 4c7a3941af23fd27a97d1b06aa450bfa04bc46aa (diff) |
Generate the static polymorphic() function in aggregates
Diffstat (limited to 'xsde/cxx/hybrid/parser-aggregate-header.cxx')
-rw-r--r-- | xsde/cxx/hybrid/parser-aggregate-header.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/xsde/cxx/hybrid/parser-aggregate-header.cxx b/xsde/cxx/hybrid/parser-aggregate-header.cxx index ce9a786..370cf07 100644 --- a/xsde/cxx/hybrid/parser-aggregate-header.cxx +++ b/xsde/cxx/hybrid/parser-aggregate-header.cxx @@ -580,6 +580,7 @@ namespace CXX String root_parser (unclash (name, "root_parser")); String root_map; String error, reset; + String poly_name; String parser_map, parser_map_entries; InstanceSet set; @@ -606,6 +607,12 @@ namespace CXX set.insert (reset); } + if (poly_runtime) + { + poly_name = unclash (name, "polymorphic"); + set.insert (poly_name); + } + if (poly_code) { parser_map = unclash (name, "parser_map_"); @@ -712,6 +719,17 @@ namespace CXX os << "}"; } + // polymorphic () + // + if (poly_runtime) + { + os << "static bool" << endl + << poly_name << " ()" + << "{" + << "return " << (tid_map.size () > 0 ? "true" : "false") << ";" + << "}"; + } + os << "public:" << endl; for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); @@ -755,6 +773,7 @@ namespace CXX String root_name (unclash (name, "root_name")); String root_namespace (unclash (name, "root_namespace")); String error, reset; + String poly_name; String parser_map, parser_map_entries; InstanceSet set; @@ -784,6 +803,12 @@ namespace CXX set.insert (reset); } + if (poly_runtime) + { + poly_name = unclash (name, "polymorphic"); + set.insert (poly_name); + } + if (poly_code) { parser_map = unclash (name, "parser_map_"); @@ -902,6 +927,17 @@ namespace CXX os << "}"; } + // polymorphic () + // + if (poly_runtime) + { + os << "static bool" << endl + << poly_name << " ()" + << "{" + << "return " << (tid_map.size () > 0 ? "true" : "false") << ";" + << "}"; + } + os << "public:" << endl; for (TypeInstanceMap::Iterator i (map.begin ()), end (map.end ()); |