本文整理汇总了C++中Symbol::asScopedSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbol::asScopedSymbol方法的具体用法?C++ Symbol::asScopedSymbol怎么用?C++ Symbol::asScopedSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol::asScopedSymbol方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rowCount
int OverviewModel::rowCount(const QModelIndex &parent) const
{
if (hasDocument()) {
if (!parent.isValid()) {
return globalSymbolCount()+1; // account for no symbol item
} else {
if (!parent.parent().isValid() && parent.row() == 0) // account for no symbol item
return 0;
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
Q_ASSERT(parentSymbol);
if (ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol()) {
if (!scopedSymbol->isFunction()) {
Scope *parentScope = scopedSymbol->members();
Q_ASSERT(parentScope);
return parentScope->symbolCount();
}
}
return 0;
}
}
if (!parent.isValid())
return 1; // account for no symbol item
return 0;
}
示例2: index
QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent) const
{
if (!parent.isValid()) {
if (row == 0) // account for no symbol item
return createIndex(row, column);
Symbol *symbol = globalSymbolAt(row-1); // account for no symbol item
return createIndex(row, column, symbol);
} else {
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
Q_ASSERT(parentSymbol);
ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol();
Q_ASSERT(scopedSymbol);
Scope *scope = scopedSymbol->members();
Q_ASSERT(scope);
return createIndex(row, 0, scope->symbolAt(row));
}
}
示例3:
Symbol *Document::findSymbolAt(unsigned line, unsigned column, Scope *scope) const
{
Symbol *previousSymbol = 0;
for (unsigned i = 0; i < scope->symbolCount(); ++i) {
Symbol *symbol = scope->symbolAt(i);
if (symbol->line() > line)
break;
previousSymbol = symbol;
}
if (previousSymbol) {
if (ScopedSymbol *scoped = previousSymbol->asScopedSymbol()) {
if (Symbol *member = findSymbolAt(line, column, scoped->members()))
return member;
}
}
return previousSymbol;
}