示例#1
0
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());
}
示例#2
0
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());
    }
}