void TranslationUnits::removeTranslationUnits(const QVector<FileContainer> &fileContainers) { QVector<FileContainer> processedFileContainers = fileContainers; auto removeBeginIterator = std::remove_if(translationUnits_.begin(), translationUnits_.end(), [&processedFileContainers] (const TranslationUnit &translationUnit) { return removeFromFileContainer(processedFileContainers, translationUnit); }); translationUnits_.erase(removeBeginIterator, translationUnits_.end()); if (!processedFileContainers.isEmpty()) throw TranslationUnitDoesNotExistException(processedFileContainers.first()); }
void Documents::removeDocuments(const QVector<FileContainer> &fileContainers) { QVector<FileContainer> processedFileContainers = fileContainers; auto removeBeginIterator = std::remove_if(documents_.begin(), documents_.end(), [&processedFileContainers] (const Document &document) { return removeFromFileContainer(processedFileContainers, document); }); documents_.erase(removeBeginIterator, documents_.end()); if (!processedFileContainers.isEmpty()) { const FileContainer fileContainer = processedFileContainers.first(); throw DocumentDoesNotExistException(fileContainer.filePath(), fileContainer.projectPartId()); } }