本文整理汇总了C++中SymbolMap::lower_bound方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolMap::lower_bound方法的具体用法?C++ SymbolMap::lower_bound怎么用?C++ SymbolMap::lower_bound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolMap
的用法示例。
在下文中一共展示了SymbolMap::lower_bound方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findCursorInfo
static inline SymbolMap::const_iterator findCursorInfo(const SymbolMap &map, const Location &location, const String &context, bool scan)
{
if (context.isEmpty() || !scan) {
SymbolMap::const_iterator it = map.lower_bound(location);
if (it != map.end() && it->first == location) {
return it;
} else if (it != map.begin()) {
--it;
if (it->first.fileId() == location.fileId()) {
const int off = location.offset() - it->first.offset();
if (it->second.symbolLength > off && (context.isEmpty() || it->second.symbolName.contains(context))) {
return it;
}
}
}
return map.end();
}
SymbolMap::const_iterator f = map.lower_bound(location);
if (f != map.begin() && (f == map.end() || f->first != location))
--f;
SymbolMap::const_iterator b = f;
enum { Search = 32 };
for (int j=0; j<Search; ++j) {
if (f != map.end()) {
if (location.fileId() != f->first.fileId()) {
if (b == map.begin())
break;
f = map.end();
} else if (f->second.symbolName.contains(context)) {
// error() << "found it forward" << j;
return f;
} else {
++f;
}
}
if (b != map.begin()) {
--b;
if (location.fileId() != b->first.fileId()) {
if (f == map.end())
break;
b = map.begin();
} else if (b->second.symbolName.contains(context)) {
// error() << "found it backward" << j;
return b;
}
}
}
return map.end();
}
示例2: loc
static inline void writeErrorSymbols(const SymbolMap &symbols, ErrorSymbolMap &errorSymbols, const Map<uint32_t, int> &errors)
{
for (Map<uint32_t, int>::const_iterator it = errors.begin(); it != errors.end(); ++it) {
if (it->second) {
SymbolMap &symbolsForFile = errorSymbols[it->first];
if (symbolsForFile.isEmpty()) {
const Location loc(it->first, 0);
SymbolMap::const_iterator sit = symbols.lower_bound(loc);
while (sit != symbols.end() && sit->first.fileId() == it->first) {
symbolsForFile[sit->first] = sit->second;
++sit;
}
}
} else {
errorSymbols.remove(it->first);
}
}
}
示例3: FindSymbols
static void FindSymbols(butil::IOBuf* out, std::vector<uintptr_t>& addr_list) {
char buf[32];
for (size_t i = 0; i < addr_list.size(); ++i) {
int len = snprintf(buf, sizeof(buf), "0x%08lx\t", addr_list[i]);
out->append(buf, len);
SymbolMap::const_iterator it = symbol_map.lower_bound(addr_list[i]);
if (it == symbol_map.end() || it->first != addr_list[i]) {
if (it != symbol_map.begin()) {
--it;
} else {
len = snprintf(buf, sizeof(buf), "0x%08lx\n", addr_list[i]);
out->append(buf, len);
continue;
}
}
if (it->second.empty()) {
len = snprintf(buf, sizeof(buf), "0x%08lx\n", addr_list[i]);
out->append(buf, len);
} else {
out->append(it->second);
out->push_back('\n');
}
}
}
示例4: findCursorInfo
SymbolMap::const_iterator findCursorInfo(const SymbolMap &map, const Location &location)
{
if (map.isEmpty())
return map.end();
SymbolMap::const_iterator it = map.find(location);
if (it != map.end())
return it;
it = map.lower_bound(location);
if (it == map.end()) {
--it;
} else {
const int cmp = it->first.compare(location);
if (!cmp)
return it;
--it;
}
if (location.fileId() != it->first.fileId())
return map.end();
const int off = location.offset() - it->first.offset();
if (it->second.symbolLength > off)
return it;
return map.end();
}