void PrintTo(const TranslationUnit &translationUnit, ::std::ostream *os) { *os << "TranslationUnit(" << translationUnit.filePath().constData() << ", " << translationUnit.projectPartId().constData() << ", " << translationUnit.documentRevision() << ")"; }
bool JobQueue::isJobRequestOutDated(const JobRequest &jobRequest) const { const JobRequest::Requirements requirements = jobRequest.requirements; const UnsavedFiles unsavedFiles = m_translationUnits.unsavedFiles(); if (requirements.testFlag(JobRequest::CurrentUnsavedFiles)) { if (jobRequest.unsavedFilesChangeTimePoint != unsavedFiles.lastChangeTimePoint()) { qCDebug(jobsLog) << "Removing due to outdated unsaved files:" << jobRequest; return true; } } bool projectCheckedAndItExists = false; if (requirements.testFlag(JobRequest::DocumentValid)) { if (!m_translationUnits.hasTranslationUnit(jobRequest.filePath, jobRequest.projectPartId)) { qCDebug(jobsLog) << "Removing due to already closed document:" << jobRequest; return true; } if (!m_projectParts.hasProjectPart(jobRequest.projectPartId)) { qCDebug(jobsLog) << "Removing due to already closed project:" << jobRequest; return true; } projectCheckedAndItExists = true; const TranslationUnit translationUnit = m_translationUnits.translationUnit(jobRequest.filePath, jobRequest.projectPartId); if (!translationUnit.isIntact()) { qCDebug(jobsLog) << "Removing due to not intact translation unit:" << jobRequest; return true; } if (requirements.testFlag(JobRequest::CurrentDocumentRevision)) { if (translationUnit.documentRevision() != jobRequest.documentRevision) { qCDebug(jobsLog) << "Removing due to changed document revision:" << jobRequest; return true; } } } if (requirements.testFlag(JobRequest::CurrentProject)) { if (!projectCheckedAndItExists && !m_projectParts.hasProjectPart(jobRequest.projectPartId)) { qCDebug(jobsLog) << "Removing due to already closed project:" << jobRequest; return true; } const ProjectPart &project = m_projectParts.project(jobRequest.projectPartId); if (project.lastChangeTimePoint() != jobRequest.projectChangeTimePoint) { qCDebug(jobsLog) << "Removing due to outdated project:" << jobRequest; return true; } } return false; }