diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp index 6b659bb6d10..1de1131be30 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp @@ -43,6 +43,55 @@ be_visitor_union_any_op_ch::visit_union (be_union *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; + be_module *module = 0; + + AST_Decl *decl = node; + if (decl->is_nested ()) + { + if (node->defined_in ()->scope_node_type () == AST_Decl::NT_interface) + { + be_interface *intf = 0; + intf = be_interface::narrow_from_scope (node->defined_in ()); + decl = intf; + } + + if (decl->defined_in ()->scope_node_type () == AST_Decl::NT_module) + { + module = be_module::narrow_from_scope (decl->defined_in ()); + + if (!module) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_union_any_op_ch::" + "visit_union - " + "Error parsing nested name\n"), + -1); + } + + // Some compilers handle "any" operators in a namespace + // corresponding to their module, others do not. + *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n"; + + be_util::gen_nested_namespace_begin (os, module); + + + *os << macro << " void operator<<= (::CORBA::Any &, const ::" << node->name () + << " &); // copying version" << be_nl; + *os << macro << " void operator<<= (::CORBA::Any &, ::" << node->name () + << "*); // noncopying version" << be_nl; + *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, ::" + << node->name () << " *&); // deprecated\n"; + *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, const ::" + << node->name () << " *&);"; + + be_util::gen_nested_namespace_end (os, module); + + // Emit #else. + *os << be_nl << be_nl + << "#else\n\n"; + } + } + *os << be_global->core_versioning_begin () << be_nl; *os << macro << " void operator<<= (::CORBA::Any &, const " << node->name () @@ -56,6 +105,11 @@ be_visitor_union_any_op_ch::visit_union (be_union *node) *os << be_global->core_versioning_end () << be_nl; + if (module != 0) + { + *os << "\n\n#endif"; + } + if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, |