本文整理汇总了C++中TypeList::front方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeList::front方法的具体用法?C++ TypeList::front怎么用?C++ TypeList::front使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeList
的用法示例。
在下文中一共展示了TypeList::front方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: typeChange
void
FreezeScript::AnalyzeInitVisitor::visitEnum(const EnumPtr& v)
{
if(v->isLocal())
{
return;
}
string scoped = v->scoped();
TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false);
if(!l.empty())
{
EnumPtr e = EnumPtr::dynamicCast(l.front());
if(!e)
{
typeChange(l.front(), scoped, "enum");
}
else
{
return;
}
}
_out.newline();
_out.newline();
_out << "<!-- enum " << scoped << " -->";
_out << se("init") << attr("type", scoped);
_out << ee;
}
示例2: typeChange
bool
FreezeScript::AnalyzeTransformVisitor::visitClassDefStart(const ClassDefPtr& v)
{
if(v->isInterface() || v->isLocal())
{
return false;
}
string scoped = v->scoped();
if(ignoreType(scoped))
{
return false;
}
TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false);
if(l.empty())
{
_missingTypes.push_back(scoped);
return false;
}
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front());
if(!decl || decl->isInterface())
{
if(!_ignoreTypeChanges)
{
typeChange(scoped, v->declaration(), l.front());
}
return false;
}
ClassDefPtr newClass = decl->definition();
if(!newClass)
{
_missingTypes.push_back(scoped);
return false;
}
_out.newline();
_out.newline();
_out << "<!-- class " << scoped << " -->";
_out << se("transform") << attr("type", scoped);
DataMemberList oldMembers = v->dataMembers();
DataMemberList newMembers = newClass->dataMembers();
compareMembers(oldMembers, newMembers);
_out << ee;
return false;
}
示例3:
bool
FreezeScript::AnalyzeTransformVisitor::checkClasses(const ClassDeclPtr& from, const ClassDeclPtr& to)
{
string fromScoped = from->scoped();
string toScoped = to->scoped();
if(fromScoped == toScoped)
{
return true;
}
//
// The types don't match, so check them for compatibility. Specifically,
// look up the old type id in the new Slice and see if it has the target
// type as a base class.
//
TypeList l = to->unit()->lookupTypeNoBuiltin(from->scoped(), false);
if(!l.empty())
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front());
if(decl)
{
ClassDefPtr def = decl->definition();
if(def)
{
ClassList bases = def->allBases();
for(ClassList::iterator p = bases.begin(); p != bases.end(); ++p)
{
if((*p)->scoped() == toScoped)
{
return true;
}
}
}
}
}
return false;
}
示例4: if
void
FreezeScript::AnalyzeTransformVisitor::visitEnum(const EnumPtr& v)
{
if(v->isLocal())
{
return;
}
string scoped = v->scoped();
if(ignoreType(scoped))
{
return;
}
TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false);
if(l.empty())
{
_missingTypes.push_back(scoped);
return;
}
EnumPtr newEnum = EnumPtr::dynamicCast(l.front());
if(!newEnum)
{
if(!_ignoreTypeChanges)
{
typeChange(scoped, v, l.front());
}
return;
}
map<string, int> m;
{
Slice::EnumeratorList enumerators = newEnum->getEnumerators();
int i = 0;
for(Slice::EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p, ++i)
{
m.insert(map<string, int>::value_type((*p)->name(), i));
}
}
_out.newline();
_out.newline();
_out << "<!-- enum " << scoped << " -->";
_out << se("transform") << attr("type", scoped);
Slice::EnumeratorList enumerators = v->getEnumerators();
int i = 0;
for(Slice::EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p, ++i)
{
map<string, int>::const_iterator q = m.find((*p)->name());
if(q == m.end())
{
_out.newline();
_out << "<!-- NOTICE: enumerator `" << (*p)->name() << "' has been removed -->";
}
else if(q->second != i)
{
_out.newline();
_out << "<!-- NOTICE: enumerator `" << (*p)->name() << "' has changed position -->";
}
}
_out << ee;
}