本文整理汇总了C++中SymbolMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolMap::end方法的具体用法?C++ SymbolMap::end怎么用?C++ SymbolMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolMap
的用法示例。
在下文中一共展示了SymbolMap::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findCursorInfo
SymbolMap::const_iterator findCursorInfo(const SymbolMap &map, const Location &location, const String &context,
const SymbolMap *errors, bool *foundInErrors)
{
if (foundInErrors)
*foundInErrors = false;
if (map.isEmpty() && !errors)
return map.end();
if (errors) {
SymbolMap::const_iterator ret = findCursorInfo(map, location, context, false);
if (ret != map.end()) {
return ret;
}
ret = findCursorInfo(*errors, location, context, false);
if (ret != errors->end()) {
if (foundInErrors)
*foundInErrors = true;
return ret;
}
// ret = findCursorInfo(*errors, location, context, true);
// if (ret != errors->end()) {
// if (foundInErrors)
// *foundInErrors = true;
// return ret;
// }
// ret = findCursorInfo(map, location, context, true);
// if (ret != map.end()) {
// return ret;
// }
return map.end();
} else {
const SymbolMap::const_iterator ret = findCursorInfo(map, location, context, true);
return ret;
}
}
示例2: 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);
}
}
}
}
示例3: getSymbol
std::string getSymbol( const std::string &varName ) {
SymbolMap::iterator sbmItr = _symbolMap.find( varName );
if ( sbmItr == _symbolMap.end() ) {
SpecialSymbolMap::iterator ssmItr = _specialSymbolMap.find( varName );
return ssmItr == _specialSymbolMap.end() ? varName : ssmItr->second;
}
return sbmItr->second.back();
}
示例4: callers
SymbolMap CursorInfo::callers(const Location &loc, const SymbolMap &map, const SymbolMap *errors) const
{
SymbolMap ret;
const SymbolMap cursors = virtuals(loc, map, errors);
for (SymbolMap::const_iterator c = cursors.begin(); c != cursors.end(); ++c) {
for (Set<Location>::const_iterator it = c->second.references.begin(); it != c->second.references.end(); ++it) {
const SymbolMap::const_iterator found = RTags::findCursorInfo(map, *it, String(), errors);
if (found == map.end())
continue;
if (RTags::isReference(found->second.kind)) { // is this always right?
ret[*it] = found->second;
} else if (kind == CXCursor_Constructor && (found->second.kind == CXCursor_VarDecl || found->second.kind == CXCursor_FieldDecl)) {
ret[*it] = found->second;
}
}
}
return ret;
}
示例5: 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);
}
}
}
}
示例6: referenceInfos
SymbolMap CursorInfo::referenceInfos(const SymbolMap &map) const
{
SymbolMap ret;
for (auto it = references.begin(); it != references.end(); ++it) {
auto found = RTags::findCursorInfo(map, *it, String());
if (found != map.end()) {
ret[*it] = found->second;
}
}
return ret;
}
示例7: virtuals
SymbolMap CursorInfo::virtuals(const Location &loc, const SymbolMap &map) const
{
SymbolMap ret;
ret[loc] = copy();
const SymbolMap s = (kind == CXCursor_CXXMethod ? allReferences(loc, map) : targetInfos(map));
for (auto it = s.begin(); it != s.end(); ++it) {
if (it->second->kind == kind)
ret[it->first] = it->second;
}
return ret;
}
示例8: writeCursors
static inline void writeCursors(SymbolMap &symbols, SymbolMap ¤t)
{
if (!symbols.isEmpty()) {
if (current.isEmpty()) {
current = symbols;
} else {
SymbolMap::iterator it = symbols.begin();
const SymbolMap::iterator end = symbols.end();
while (it != end) {
SymbolMap::iterator cur = current.find(it->first);
if (cur == current.end()) {
current[it->first] = it->second;
} else {
cur->second.unite(it->second);
}
++it;
}
}
}
}
示例9: referenceInfos
SymbolMap CursorInfo::referenceInfos(const SymbolMap &map, const SymbolMap *errors) const
{
SymbolMap ret;
for (Set<Location>::const_iterator it = references.begin(); it != references.end(); ++it) {
SymbolMap::const_iterator found = RTags::findCursorInfo(map, *it, String(), errors);
if (found != map.end()) {
ret[*it] = found->second;
}
}
return ret;
}
示例10: virtuals
SymbolMap CursorInfo::virtuals(const Location &loc, const SymbolMap &map, const SymbolMap *errors) const
{
SymbolMap ret;
ret[loc] = *this;
const SymbolMap s = (kind == CXCursor_CXXMethod ? allReferences(loc, map, errors) : targetInfos(map, errors));
for (SymbolMap::const_iterator it = s.begin(); it != s.end(); ++it) {
if (it->second.kind == kind)
ret[it->first] = it->second;
}
return ret;
}
示例11: dirtySymbols
void dirtySymbols(SymbolMap &map, const Set<uint32_t> &dirty)
{
SymbolMap::iterator it = map.begin();
while (it != map.end()) {
if (dirty.contains(it->first.fileId())) {
map.erase(it++);
} else {
it->second->dirty(dirty);
++it;
}
}
}
示例12: bestTarget
CursorInfo CursorInfo::bestTarget(const SymbolMap &map, const SymbolMap *errors, Location *loc) const
{
const SymbolMap targets = targetInfos(map, errors);
SymbolMap::const_iterator best = targets.end();
int bestRank = -1;
for (SymbolMap::const_iterator it = targets.begin(); it != targets.end(); ++it) {
const CursorInfo &ci = it->second;
const int r = targetRank(ci);
if (r > bestRank || (r == bestRank && ci.isDefinition())) {
bestRank = r;
best = it;
}
}
if (best != targets.end()) {
if (loc)
*loc = best->first;
return best->second;
}
return CursorInfo();
}
示例13: targetInfos
std::shared_ptr<CursorInfo> CursorInfo::bestTarget(const SymbolMap &map, Location *loc) const
{
const SymbolMap targets = targetInfos(map);
auto best = targets.end();
int bestRank = -1;
for (auto it = targets.begin(); it != targets.end(); ++it) {
const std::shared_ptr<CursorInfo> &ci = it->second;
const int r = targetRank(ci);
if (r > bestRank || (r == bestRank && ci->isDefinition())) {
bestRank = r;
best = it;
}
}
if (best != targets.end()) {
if (loc)
*loc = best->first;
return best->second;
}
return std::shared_ptr<CursorInfo>();
}
示例14: joinCursors
static inline void joinCursors(SymbolMap &symbols, const Set<Location> &locations)
{
for (Set<Location>::const_iterator it = locations.begin(); it != locations.end(); ++it) {
SymbolMap::iterator c = symbols.find(*it);
if (c != symbols.end()) {
CursorInfo &cursorInfo = c->second;
for (Set<Location>::const_iterator innerIt = locations.begin(); innerIt != locations.end(); ++innerIt) {
if (innerIt != it)
cursorInfo.targets.insert(*innerIt);
}
// ### this is filthy, we could likely think of something better
}
}
}
示例15: targetInfos
SymbolMap CursorInfo::targetInfos(const SymbolMap &map) const
{
SymbolMap ret;
for (Set<Location>::const_iterator it = targets.begin(); it != targets.end(); ++it) {
SymbolMap::const_iterator found = RTags::findCursorInfo(map, *it);
if (found != map.end()) {
ret[*it] = found->second;
} else {
ret[*it] = CursorInfo();
// we need this one for inclusion directives which target a
// non-existing CursorInfo
}
}
return ret;
}