本文整理汇总了C++中Symbol::column方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbol::column方法的具体用法?C++ Symbol::column怎么用?C++ Symbol::column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol::column方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findLinkHelper
static QSharedPointer<FunctionDeclDefLink> findLinkHelper(QSharedPointer<FunctionDeclDefLink> link, CppTools::CppRefactoringChanges changes)
{
QSharedPointer<FunctionDeclDefLink> noResult;
const Snapshot &snapshot = changes.snapshot();
// find the matching decl/def symbol
Symbol *target = 0;
CppTools::SymbolFinder finder;
if (FunctionDefinitionAST *funcDef = link->sourceDeclaration->asFunctionDefinition()) {
QList<Declaration *> nameMatch, argumentCountMatch, typeMatch;
finder.findMatchingDeclaration(LookupContext(link->sourceDocument, snapshot),
funcDef->symbol,
&typeMatch, &argumentCountMatch, &nameMatch);
if (!typeMatch.isEmpty())
target = typeMatch.first();
} else if (link->sourceDeclaration->asSimpleDeclaration()) {
target = finder.findMatchingDefinition(link->sourceFunctionDeclarator->symbol, snapshot, true);
}
if (!target) {
return noResult;
}
// parse the target file to get the linked decl/def
const QString targetFileName = QString::fromUtf8(
target->fileName(), target->fileNameLength());
CppTools::CppRefactoringFileConstPtr targetFile = changes.fileNoEditor(targetFileName);
if (!targetFile->isValid())
return noResult;
DeclarationAST *targetParent = 0;
FunctionDeclaratorAST *targetFuncDecl = 0;
DeclaratorAST *targetDeclarator = 0;
if (!findDeclOrDef(targetFile->cppDocument(), target->line(), target->column(),
&targetParent, &targetDeclarator, &targetFuncDecl))
return noResult;
// the parens are necessary for finding good places for changes
if (!targetFuncDecl->lparen_token || !targetFuncDecl->rparen_token)
return noResult;
QTC_ASSERT(targetFuncDecl->symbol, return noResult);
// if the source and target argument counts differ, something is wrong
QTC_ASSERT(targetFuncDecl->symbol->argumentCount() == link->sourceFunction->argumentCount(), return noResult);
int targetStart, targetEnd;
declDefLinkStartEnd(targetFile, targetParent, targetFuncDecl, &targetStart, &targetEnd);
QString targetInitial = targetFile->textOf(
targetFile->startOf(targetParent),
targetEnd);
targetFile->lineAndColumn(targetStart, &link->targetLine, &link->targetColumn);
link->targetInitial = targetInitial;
link->targetFile = targetFile;
link->targetFunction = targetFuncDecl->symbol;
link->targetFunctionDeclarator = targetFuncDecl;
link->targetDeclaration = targetParent;
return link;
}