本文整理汇总了C++中parsertreeitem::Ptr::childCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::childCount方法的具体用法?C++ Ptr::childCount怎么用?C++ Ptr::childCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parsertreeitem::Ptr
的用法示例。
在下文中一共展示了Ptr::childCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addSymbol
void Parser::addSymbol(const ParserTreeItem::Ptr &item, const CPlusPlus::Symbol *symbol)
{
if (item.isNull() || !symbol)
return;
// easy solution - lets add any scoped symbol and
// any symbol which does not contain :: in the name
// if (symbol->isDeclaration())
// return;
//! \todo collect statistics and reorder to optimize
if (symbol->isForwardClassDeclaration()
|| symbol->isExtern()
|| symbol->isFriend()
|| symbol->isGenerated()
|| symbol->isUsingNamespaceDirective()
|| symbol->isUsingDeclaration()
)
return;
// skip static local functions
// if ((!symbol->scope() || symbol->scope()->isClass())
// && symbol->isStatic() && symbol->isFunction())
// return;
const CPlusPlus::Name *symbolName = symbol->name();
if (symbolName && symbolName->isQualifiedNameId())
return;
QString name = d->overview.prettyName(symbol->name()).trimmed();
QString type = d->overview.prettyType(symbol->type()).trimmed();
int iconType = CPlusPlus::Icons::iconTypeForSymbol(symbol);
SymbolInformation information(name, type, iconType);
ParserTreeItem::Ptr itemAdd;
// If next line will be removed, 5% speed up for the initial parsing.
// But there might be a problem for some files ???
// Better to improve qHash timing
itemAdd = item->child(information);
if (itemAdd.isNull())
itemAdd = ParserTreeItem::Ptr(new ParserTreeItem());
// locations are 1-based in Symbol, start with 0 for the editor
SymbolLocation location(QString::fromUtf8(symbol->fileName() , symbol->fileNameLength()),
symbol->line(), symbol->column() - 1);
itemAdd->addSymbolLocation(location);
// prevent showing a content of the functions
if (!symbol->isFunction()) {
const CPlusPlus::Scope *scope = symbol->asScope();
if (scope) {
CPlusPlus::Scope::iterator cur = scope->firstMember();
while (cur != scope->lastMember()) {
const CPlusPlus::Symbol *curSymbol = *cur;
++cur;
if (!curSymbol)
continue;
// if (!symbol->isClass() && curSymbol->isStatic() && curSymbol->isFunction())
// return;
addSymbol(itemAdd, curSymbol);
}
}
}
bool appendChild = true;
// if item is empty and has not to be added
if (symbol->isNamespace() && itemAdd->childCount() == 0)
appendChild = false;
if (appendChild)
item->appendChild(itemAdd, information);
}