本文整理汇总了C++中AST_Type::narrow方法的典型用法代码示例。如果您正苦于以下问题:C++ AST_Type::narrow方法的具体用法?C++ AST_Type::narrow怎么用?C++ AST_Type::narrow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AST_Type
的用法示例。
在下文中一共展示了AST_Type::narrow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
be_typedef::be_typedef (AST_Type *bt, UTL_ScopedName *n, const UTL_Pragmas &p)
:
AST_Decl (AST_Decl::NT_typedef, n, p),
AST_Typedef (bt, n, p),
m_generateBase (FALSE),
m_generated (FALSE),
m_baseBeType (0)
{
AST_Type* astType = base_type();
be_array* ba;
be_sequence* bs;
localName = local_name()->get_string();
enclosingScope = be_Type::EnclosingScopeString(this);
m_baseBeType = get_base_be_type();
//
// make sure the base type has a name (if anonymous)
//
bs = (be_sequence*)astType->narrow((long) & be_sequence::type_id);
if (bs)
{
m_generateBase = bs->SetName(enclosingScope, localName);
}
else if ((ba = (be_array*)astType->narrow((long) & be_array::type_id)))
{
m_generateBase = ba->SetName(enclosingScope, localName);
}
//
// now initialize the base's type and typemap
//
m_baseBeType->Initialize();
m_baseBeType->HasTypeDef (pbtrue);
InitializeTypeMap (this);
m_typecode = m_baseBeType->m_typecode;
m_typecode->id = get_decl_pragmas().get_repositoryID()->get_string();
m_typecode->name_of_type = localName;
DDS_StdString scopedname = NoColons(enclosingScope + "_" + localName);
TypeCodeTypeName(BE_Globals::TCPrefix + localName);
MetaTypeTypeName(BE_Globals::MTPrefix + scopedname);
TypeCodeRepName(BE_Globals::TCRepPrefix + scopedname);
TypeCodeBaseName(BE_Globals::TCBasePrefix + scopedname);
}
示例2:
be_argument::be_argument
(
AST_Argument::Direction d,
AST_Type *ft,
UTL_ScopedName *n,
const UTL_Pragmas &p
)
:
AST_Decl (AST_Decl::NT_argument, n, p),
AST_Field (AST_Decl::NT_argument, ft, n, p),
AST_Argument (d, ft, n, p),
m_beType (0),
m_direction (d)
{
AST_Type * at = field_type();
be_Type * bt;
if (at && (bt = (be_Type*)at->narrow((long) & be_Type::type_id)))
{
const char * typeName = bt->TypeName ();
if (typeName && strcmp (typeName, "DDS::Any") == 0)
{
BE_Globals::inc_any = pbtrue;
}
}
}
示例3: Initialize
void be_argument::Initialize ()
{
AST_Type * at = field_type();
be_Type * bt;
if (at && (bt = (be_Type*)at->narrow((long) & be_Type::type_id)))
{
bt->Initialize ();
}
}
示例4: assert
be_Type*
be_argument::BeType() const
{
be_Type * ret = 0;
AST_Type* atype = ((be_argument*)this)->field_type();
if (atype)
{
ret = (be_Type*)atype->narrow((long) & be_Type::type_id);
assert(ret);
}
return ret;
}
示例5: while
AST_Type *
be_typedef::_astBase(AST_Type * ttype)
{
AST_Type * ret = ttype;
if (ret)
{
AST_Typedef * atd;
while ((atd = (AST_Typedef*)ret->narrow((long) & AST_Typedef::type_id)))
{
ret = atd->base_type();
}
}
return ret;
}
示例6: InitializeTypeMap
void be_string::InitializeTypeMap (be_Type* t)
{
idlType = t;
AST_Expression* maxsize = 0;
be_string* t_string = 0;
be_typedef* t_typedef = 0;
DDS_StdString corbaString;
DDS_StdString stringInOut;
DDS_StdString stringOut;
DDS_StdString structStringVar;
if (m_typecode->kind == DDS::tk_string)
{
corbaString = BE_Globals::CorbaScope("String");
stringInOut = BE_Globals::CorbaScope("String&");
stringOut = BE_Globals::CorbaScope("String_out");
structStringVar = BE_Globals::CorbaScope ("String_mgr");
}
else
{
corbaString = BE_Globals::CorbaScope ("WString");
stringInOut = BE_Globals::CorbaScope ("WString&");
stringOut = BE_Globals::CorbaScope ("WString_out");
structStringVar = BE_Globals::CorbaScope ("WString_var");
}
char size[10];
os_sprintf (size, "%d", (int) ExprToULong(maxsize));
t_typedef = (be_typedef*)t->narrow((long) & be_typedef::type_id);
if (t_typedef)
{
AST_Type * t_ast = (AST_Type*)t->narrow((long) & AST_Type::type_id);
AST_Type * basetype;
AST_String * realbasetype;
(void) t_ast;
assert (t_ast);
basetype = be_typedef::_astBase(((AST_Typedef*)t->narrow((long) & AST_Typedef::type_id))->base_type());
assert(basetype);
realbasetype = (AST_String*)basetype->narrow((long) & AST_String::type_id);
assert(realbasetype);
maxsize = realbasetype->max_size();
corbaString = t->Scope(t->LocalName());
stringInOut = corbaString + "&";
stringOut = corbaString + DDSOutExtension;
t->TypeCodeTypeName(BE_Globals::TCPrefix + t->LocalName());
// t->MetaTypeTypeName(BE_Globals::MTPrefix + NameToString(t_ast->name(),"_"));
t->MetaTypeTypeName("xps_mt_DDS::String");
}
else
{
t_string = (be_string*)t->narrow((long) & be_string::type_id);
assert(t_string);
maxsize = t_string->max_size();
// YO JFG 2/14/99 modified this
// t->TypeCodeTypeName((DDS_StdString)"DDSTypeCodeFactory::createTypeCode(DDS::tk_string," + size + ")");
if (m_typecode->kind == DDS::tk_string)
{
t->TypeCodeTypeName ("DDS::_tc_string");
}
else
{
t->TypeCodeTypeName ("DDS::_tc_wstring");
}
}
t->TypeName(corbaString);
if (m_typecode->kind == DDS::tk_string)
{
t->InTypeName ((DDS_StdString)"const char *"); // NOTE: != const corbaString;
}
else
{
t->InTypeName ((DDS_StdString)"const WChar *"); // NOTE: != const corbaString;
}
t->InOutTypeName (stringInOut);
t->OutTypeName (stringOut);
t->ReturnTypeName (stringOut);
t->DMFAdtMemberTypeName (corbaString);
t->StructMemberTypeName (structStringVar);
t->UnionMemberTypeName (corbaString);
t->SequenceMemberTypeName (corbaString);
if (m_typecode->kind == DDS::tk_string)
{
t->VarSignature(VT_InParam, "DDS::Char", VT_Const, VT_Pointer, VT_NonReference);
}
else
{
t->VarSignature(VT_InParam, "DDS::WChar", VT_Const, VT_Pointer, VT_NonReference);
}
//.........这里部分代码省略.........