本文整理汇总了C++中document::Ptr::resolvedIncludes方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::resolvedIncludes方法的具体用法?C++ Ptr::resolvedIncludes怎么用?C++ Ptr::resolvedIncludes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类document::Ptr
的用法示例。
在下文中一共展示了Ptr::resolvedIncludes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildHierarchyIncludes_helper
void CppIncludeHierarchyModel::buildHierarchyIncludes_helper(const QString &filePath,
CppIncludeHierarchyItem *parent,
QSet<QString> *cyclic, bool recursive)
{
if (!m_editor)
return;
CppModelManagerInterface *cppMM = CppModelManagerInterface::instance();
const Snapshot &snapshot = cppMM->cppEditorSupport(m_editor)->snapshotUpdater()->snapshot();
Document::Ptr doc = snapshot.document(filePath);
if (!doc)
return;
parent->setHasChildren(doc->resolvedIncludes().size() > 0);
if (!recursive)
return;
cyclic->insert(filePath);
foreach (const Document::Include &includeFile, doc->resolvedIncludes()) {
const QString includedFilePath = includeFile.resolvedFileName();
CppIncludeHierarchyItem *item = 0;
if (cyclic->contains(includedFilePath)) {
item = new CppIncludeHierarchyItem(includedFilePath, parent, true);
parent->appendChild(item);
continue;
}
item = new CppIncludeHierarchyItem(includedFilePath, parent);
parent->appendChild(item);
buildHierarchyIncludes_helper(includedFilePath, item, cyclic, false);
}
cyclic->remove(filePath);
}
示例2: matchIncludeFile
bool CppElementEvaluator::matchIncludeFile(const Document::Ptr &document, unsigned line)
{
foreach (const Document::Include &includeFile, document->resolvedIncludes()) {
if (includeFile.line() == line) {
m_element = QSharedPointer<CppElement>(new CppInclude(includeFile));
return true;
}
}
return false;
}
示例3: processEnvironment
void TypeOfExpression::processEnvironment(Document::Ptr doc, Environment *env,
QSet<QString> *processed) const
{
if (doc && ! processed->contains(doc->fileName())) {
processed->insert(doc->fileName());
foreach (const Document::Include &incl, doc->resolvedIncludes())
processEnvironment(m_snapshot.document(incl.resolvedFileName()), env, processed);
foreach (const Macro ¯o, doc->definedMacros())
env->bind(macro);
}
示例4: foreach
QList<Snapshot::IncludeLocation> Snapshot::includeLocationsOfDocument(const QString &fileName) const
{
QList<IncludeLocation> result;
for (const_iterator cit = begin(), citEnd = end(); cit != citEnd; ++cit) {
const Document::Ptr doc = cit.value();
foreach (const Document::Include &includeFile, doc->resolvedIncludes()) {
if (includeFile.resolvedFileName() == fileName)
result.append(qMakePair(doc, includeFile.line()));
}
}
return result;
}
示例5: process
void process(Document::Ptr doc, QSet<Namespace *> *processed)
{
if (!doc)
return;
if (!processed->contains(doc->globalNamespace())) {
processed->insert(doc->globalNamespace());
foreach (const Document::Include &i, doc->resolvedIncludes())
process(_snapshot.document(i.resolvedFileName()), processed);
_mainDocument = (doc == _doc); // ### improve
accept(doc->globalNamespace());
}
示例6: accept
void SnapshotSymbolVisitor::accept(Document::Ptr doc, QSet<QString> *processed)
{
if (doc && doc->globalNamespace() && ! processed->contains(doc->fileName())) {
processed->insert(doc->fileName());
foreach (const Document::Include &i, doc->resolvedIncludes()) {
if (Document::Ptr incl = _snapshot.document(i.resolvedFileName()))
accept(incl, processed);
}
std::swap(_document, doc);
accept(_document->globalNamespace());
std::swap(_document, doc);
}
示例7: foreach
LineForNewIncludeDirective::LineForNewIncludeDirective(const QTextDocument *textDocument,
const Document::Ptr cppDocument,
MocIncludeMode mocIncludeMode,
IncludeStyle includeStyle)
: m_textDocument(textDocument)
, m_cppDocument(cppDocument)
, m_includeStyle(includeStyle)
{
QList<Document::Include> includes
= cppDocument->resolvedIncludes() + cppDocument->unresolvedIncludes();
Utils::sort(includes, &Include::line);
// Ignore *.moc includes if requested
if (mocIncludeMode == IgnoreMocIncludes) {
foreach (const Document::Include &include, includes) {
if (!include.unresolvedFileName().endsWith(QLatin1String(".moc")))
m_includes << include;
}
} else {
示例8: mergeEnvironment
void CppPreprocessor::mergeEnvironment(Document::Ptr doc)
{
if (!doc)
return;
const QString fn = doc->fileName();
if (m_processed.contains(fn))
return;
m_processed.insert(fn);
foreach (const Document::Include &incl, doc->resolvedIncludes()) {
const QString includedFile = incl.resolvedFileName();
if (Document::Ptr includedDoc = m_snapshot.document(includedFile))
mergeEnvironment(includedDoc);
else if (!m_included.contains(includedFile))
run(includedFile);
}
m_env.addMacros(doc->definedMacros());
}
示例9: buildHierarchyIncludedBy_helper
void CppIncludeHierarchyModel::buildHierarchyIncludedBy_helper(const QString &filePath,
CppIncludeHierarchyItem *parent,
QSet<QString> *cyclic,
bool recursive)
{
cyclic->insert(filePath);
const Snapshot &snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
Snapshot::const_iterator citEnd = snapshot.end();
for (Snapshot::const_iterator cit = snapshot.begin(); cit != citEnd; ++cit) {
const QString filePathFromSnapshot = cit.key();
Document::Ptr doc = cit.value();
foreach (const Document::Include &includeFile, doc->resolvedIncludes()) {
const QString includedFilePath = includeFile.resolvedFileName();
if (includedFilePath == filePath) {
parent->setHasChildren(true);
if (!recursive) {
cyclic->remove(filePath);
return;
}
const bool isCyclic = cyclic->contains(filePathFromSnapshot);
CppIncludeHierarchyItem *item = new CppIncludeHierarchyItem(filePathFromSnapshot,
parent,
isCyclic);
item->setLine(includeFile.line());
parent->appendChild(item);
if (isCyclic)
continue;
else
buildHierarchyIncludedBy_helper(filePathFromSnapshot, item, cyclic, false);
}
}
}
cyclic->remove(filePath);
}