本文整理汇总了C++中SymbolMap::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolMap::contains方法的具体用法?C++ SymbolMap::contains怎么用?C++ SymbolMap::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolMap
的用法示例。
在下文中一共展示了SymbolMap::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SymbolMap
static inline void allImpl(const SymbolMap &map, const Location &loc, const CursorInfo &info, SymbolMap &out, Mode mode, CXCursorKind kind)
{
if (out.contains(loc))
return;
out[loc] = info;
typedef SymbolMap (CursorInfo::*Function)(const SymbolMap &map) const;
const SymbolMap targets = info.targetInfos(map);
for (SymbolMap::const_iterator t = targets.begin(); t != targets.end(); ++t) {
bool ok = false;
switch (mode) {
case VirtualRefs:
case NormalRefs:
ok = (t->second.kind == kind);
break;
case ClassRefs:
ok = (t->second.isClass()
|| t->second.kind == CXCursor_Destructor
|| t->second.kind == CXCursor_Constructor);
break;
}
if (ok)
allImpl(map, t->first, t->second, out, mode, kind);
}
const SymbolMap refs = info.referenceInfos(map);
for (SymbolMap::const_iterator r = refs.begin(); r != refs.end(); ++r) {
switch (mode) {
case NormalRefs:
out[r->first] = r->second;
break;
case VirtualRefs:
if (r->second.kind == kind) {
allImpl(map, r->first, r->second, out, mode, kind);
} else {
out[r->first] = r->second;
}
break;
case ClassRefs:
if (info.isClass()) // for class/struct we want the references inserted directly regardless and also recursed
out[r->first] = r->second;
if (r->second.isClass()
|| r->second.kind == CXCursor_Destructor
|| r->second.kind == CXCursor_Constructor) { // if is a constructor/destructor/class reference we want to recurse it
allImpl(map, r->first, r->second, out, mode, kind);
}
}
}
}
示例2: allImpl
static inline void allImpl(const SymbolMap &map, const Location &loc, const std::shared_ptr<CursorInfo> &info, SymbolMap &out, Mode mode, unsigned kind)
{
if (out.contains(loc))
return;
out[loc] = info;
const SymbolMap targets = info->targetInfos(map);
for (auto t = targets.begin(); t != targets.end(); ++t) {
bool ok = false;
switch (mode) {
case VirtualRefs:
case NormalRefs:
ok = (t->second->kind == kind);
break;
case ClassRefs:
ok = (t->second->isClass() || t->second->kind == CXCursor_Destructor || t->second->kind == CXCursor_Constructor);
break;
}
if (ok)
allImpl(map, t->first, t->second, out, mode, kind);
}
const SymbolMap refs = info->referenceInfos(map);
for (auto r = refs.begin(); r != refs.end(); ++r) {
switch (mode) {
case NormalRefs:
out[r->first] = r->second;
break;
case VirtualRefs:
if (r->second->kind == kind) {
allImpl(map, r->first, r->second, out, mode, kind);
} else {
out[r->first] = r->second;
}
break;
case ClassRefs:
if (info->isClass()) // for class/struct we want the references inserted directly regardless and also recursed
out[r->first] = r->second;
if (r->second->isClass()
|| r->second->kind == CXCursor_Destructor
|| r->second->kind == CXCursor_Constructor) { // if is a constructor/destructor/class reference we want to recurse it
allImpl(map, r->first, r->second, out, mode, kind);
}
}
}
}