本文整理汇总了C++中document::Ptr::language方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::language方法的具体用法?C++ Ptr::language怎么用?C++ Ptr::language使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类document::Ptr
的用法示例。
在下文中一共展示了Ptr::language方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: link
QList<QmlJSEditor::FindReferences::Usage> FindImplementation::run(const QString &fileName,
const QString &typeName,
const QString &itemName)
{
QList<QmlJSEditor::FindReferences::Usage> usages;
QmlJS::ModelManagerInterface *modelManager = ModelManagerInterface::instance();
//Parse always the latest version of document
QmlJS::Dialect dialect = QmlJS::ModelManagerInterface::guessLanguageOfFile(fileName);
QmlJS::Document::MutablePtr documentUpdate = QmlJS::Document::create(fileName, dialect);
documentUpdate->setSource(modelManager->workingCopy().source(fileName));
if (documentUpdate->parseQml())
modelManager->updateDocument(documentUpdate);
Document::Ptr document = modelManager->snapshot().document(fileName);
if (!document)
return usages;
QmlJS::Link link(modelManager->snapshot(),
modelManager->defaultVContext(document->language(), document),
modelManager->builtins(document));
ContextPtr context = link();
ScopeChain scopeChain(document, context);
const ObjectValue *targetValue = scopeChain.context()->lookupType(document.data(), QStringList(typeName));
FindImplementationVisitor visitor(document, context);
FindImplementationVisitor::Results results = visitor(typeName, itemName, targetValue);
foreach (const AST::SourceLocation &location, results) {
usages.append(QmlJSEditor::FindReferences::Usage(fileName,
matchingLine(location.offset, document->source()),
location.startLine, location.startColumn - 1, location.length));
}
示例2: updateCodeWarnings
void QmlJSEditorWidget::updateCodeWarnings(Document::Ptr doc)
{
if (doc->ast()) {
setExtraSelections(CodeWarningsSelection, QList<QTextEdit::ExtraSelection>());
} else if (doc->language().isFullySupportedLanguage()) {
// show parsing errors
QList<QTextEdit::ExtraSelection> selections;
appendExtraSelectionsForMessages(&selections, doc->diagnosticMessages(), document());
setExtraSelections(CodeWarningsSelection, selections);
} else {
setExtraSelections(CodeWarningsSelection, QList<QTextEdit::ExtraSelection>());
}
}
示例3: collectMessages
void QmlTaskManager::collectMessages(
QFutureInterface<FileErrorMessages> &future,
Snapshot snapshot, QList<ModelManagerInterface::ProjectInfo> projectInfos,
ViewerContext vContext, bool updateSemantic)
{
foreach (const ModelManagerInterface::ProjectInfo &info, projectInfos) {
QHash<QString, QList<DiagnosticMessage> > linkMessages;
ContextPtr context;
if (updateSemantic) {
Link link(snapshot, vContext, snapshot.libraryInfo(info.qtImportsPath));
context = link(&linkMessages);
}
foreach (const QString &fileName, info.sourceFiles) {
Document::Ptr document = snapshot.document(fileName);
if (!document)
continue;
FileErrorMessages result;
result.fileName = fileName;
if (Document::isFullySupportedLanguage(document->language())) {
result.tasks = convertToTasks(document->diagnosticMessages(),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML));
if (updateSemantic) {
result.tasks += convertToTasks(linkMessages.value(fileName),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML_ANALYSIS));
Check checker(document, context);
result.tasks += convertToTasks(checker(),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML_ANALYSIS));
}
}
if (!result.tasks.isEmpty())
future.reportResult(result);
if (future.isCanceled())
break;
}
}