typedef_ch.cpp
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 577 行 · 第 1/2 页
CPP
577 行
}
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Typedef the object.
*os << "typedef " << bt->nested_type_name (scope) << " "
<< tdef->nested_type_name (scope) << ";" << be_nl;
// Typedef the _ptr.
*os << "typedef " << bt->nested_type_name (scope, "_ptr")
<< " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl;
// Typedef the _var.
*os << "typedef " << bt->nested_type_name (scope, "_var")
<< " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
// typedef the _out
*os << "typedef " << bt->nested_type_name (scope, "_out")
<< " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl;
return 0;
}
int
be_visitor_typedef_ch::visit_interface_fwd (be_interface_fwd *)
{
// be_interface *fd =
// be_interface::narrow_from_decl (node->full_definition ());
// return this->visit_interface (fd);
return 0;
}
int
be_visitor_typedef_ch::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
be_typedef *tdef = this->ctx_->tdef ();
be_decl *scope = this->ctx_->scope ();
be_type *bt;
// Typedef of a typedef?
if (this->ctx_->alias ())
{
bt = this->ctx_->alias ();
}
else
{
bt = node;
}
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Typedef the type.
*os << "typedef " << bt->nested_type_name (scope)
<< " " << tdef->nested_type_name (scope) << ";" << be_nl;
AST_PredefinedType::PredefinedType pt = node->pt ();
if (pt == AST_PredefinedType::PT_pseudo
|| pt == AST_PredefinedType::PT_any
|| pt == AST_PredefinedType::PT_object)
{
// Typedef the _ptr and _var.
*os << "typedef " << bt->nested_type_name (scope, "_ptr")
<< " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl;
*os << "typedef " << bt->nested_type_name (scope, "_var")
<< " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
}
// Typedef the _out.
*os << "typedef " << bt->nested_type_name (scope, "_out")
<< " " << tdef->nested_type_name (scope, "_out") << ";";
return 0;
}
int
be_visitor_typedef_ch::visit_string (be_string *node)
{
TAO_OutStream *os = this->ctx_->stream ();
be_typedef *tdef = this->ctx_->tdef ();
be_decl *scope = this->ctx_->scope ();
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
if (node->width () == (long) sizeof (char))
{
*os << "typedef char *"
<< " " << tdef->nested_type_name (scope) << ";" << be_nl;
// Typedef the _var and _out types.
*os << "typedef CORBA::String_var"
<< " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
*os << "typedef CORBA::String_out"
<< " " << tdef->nested_type_name (scope, "_out") << ";";
}
else
{
*os << "typedef CORBA::WChar *"
<< " " << tdef->nested_type_name (scope) << ";" << be_nl;
// Typedef the _var and _out types.
*os << "typedef CORBA::WString_var"
<< " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
*os << "typedef CORBA::WString_out"
<< " " << tdef->nested_type_name (scope, "_out") << ";";
}
return 0;
}
int
be_visitor_typedef_ch::visit_sequence (be_sequence *node)
{
TAO_OutStream *os = this->ctx_->stream ();
be_typedef *tdef = this->ctx_->tdef ();
be_decl *scope = this->ctx_->scope ();
be_type *bt;
// Typedef of a typedef?
if (this->ctx_->alias ())
{
bt = this->ctx_->alias ();
}
else
{
bt = node;
}
if (bt->node_type () == AST_Decl::NT_sequence)
{
// Let the base class visitor handle this case.
if (this->be_visitor_typedef::visit_sequence (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_sequence - "
"base class visitor failed \n"),
-1);
}
}
else
{
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Typedef the type.
*os << "typedef " << bt->nested_type_name (scope)
<< " " << tdef->nested_type_name (scope) << ";" << be_nl;
// Typedef the _var and _out types.
*os << "typedef " << bt->nested_type_name (scope, "_var")
<< " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
*os << "typedef " << bt->nested_type_name (scope, "_out")
<< " " << tdef->nested_type_name (scope, "_out") << ";";
}
return 0;
}
int
be_visitor_typedef_ch::visit_structure (be_structure *node)
{
TAO_OutStream *os = this->ctx_->stream ();
be_typedef *tdef = this->ctx_->tdef ();
be_decl *scope = this->ctx_->scope ();
be_type *bt;
// Typedef of a typedef?
if (this->ctx_->alias ())
{
bt = this->ctx_->alias ();
}
else
{
bt = node;
}
if (bt->node_type () == AST_Decl::NT_struct)
{
// Let the base class visitor handle this case
if (this->be_visitor_typedef::visit_structure (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_structure - "
"base class visitor failed \n"),
-1);
}
}
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Typedef the type.
*os << "typedef " << bt->nested_type_name (scope)
<< " " << tdef->nested_type_name (scope) << ";" << be_nl;
// typedef the _var and _out types.
*os << "typedef " << bt->nested_type_name (scope, "_var")
<< " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
*os << "typedef " << bt->nested_type_name (scope, "_out")
<< " " << tdef->nested_type_name (scope, "_out") << ";";
return 0;
}
int
be_visitor_typedef_ch::visit_union (be_union *node)
{
TAO_OutStream *os = this->ctx_->stream ();
be_typedef *tdef = this->ctx_->tdef ();
be_decl *scope = this->ctx_->scope ();
be_type *bt;
// Typedef of a typedef?
if (this->ctx_->alias ())
{
bt = this->ctx_->alias ();
}
else
{
bt = node;
}
if (bt->node_type () == AST_Decl::NT_union)
{
// Let the base class visitor handle this case.
if (this->be_visitor_typedef::visit_union (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_union - "
"base class visitor failed \n"),
-1);
}
}
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Typedef the type.
*os << "typedef " << bt->nested_type_name (scope)
<< " " << tdef->nested_type_name (scope) << ";" << be_nl;
// Typedef the _var and _out types.
*os << "typedef " << bt->nested_type_name (scope, "_var")
<< " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
*os << "typedef " << bt->nested_type_name (scope, "_out")
<< " " << tdef->nested_type_name (scope, "_out") << ";";
return 0;
}
int
be_visitor_typedef_ch::visit_valuetype (be_valuetype *node)
{
TAO_OutStream *os = this->ctx_->stream ();
be_typedef *tdef = this->ctx_->tdef ();
be_decl *scope = this->ctx_->scope ();
be_type *bt;
// Typedef of a typedef?
if (this->ctx_->alias ())
{
bt = this->ctx_->alias ();
}
else
{
bt = node;
}
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Typedef the object.
*os << "typedef " << bt->nested_type_name (scope) << " "
<< tdef->nested_type_name (scope) << ";" << be_nl;
// Typedef the _var.
*os << "typedef " << bt->nested_type_name (scope, "_var")
<< " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
// typedef the _out
*os << "typedef " << bt->nested_type_name (scope, "_out")
<< " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?