コード例 #1
0
void TranslationUnits::createOrUpdateTranslationUnit(const FileContainer &fileContainer)
{
    TranslationUnit::FileExistsCheck checkIfFileExists = fileContainer.hasUnsavedFileContent() ? TranslationUnit::DoNotCheckIfFileExists : TranslationUnit::CheckIfFileExists;
    auto findIterator = findTranslationUnit(fileContainer);
    if (findIterator == translationUnits_.end())
        translationUnits_.push_back(TranslationUnit(fileContainer.filePath(),
                                                    unsavedFiles,
                                                    projects.project(fileContainer.projectPartId()),
                                                    checkIfFileExists));
}
コード例 #2
0
Document Documents::createDocument(const FileContainer &fileContainer)
{
    Document::FileExistsCheck checkIfFileExists = fileContainer.hasUnsavedFileContent() ? Document::DoNotCheckIfFileExists : Document::CheckIfFileExists;

    documents_.emplace_back(fileContainer.filePath(),
                                   projectParts.project(fileContainer.projectPartId()),
                                   fileContainer.fileArguments(),
                                   *this,
                                   checkIfFileExists);

    documents_.back().setDocumentRevision(fileContainer.documentRevision());

    return documents_.back();
}
コード例 #3
0
ファイル: filecontainer.cpp プロジェクト: C-sjia/qt-creator
void PrintTo(const FileContainer &container, ::std::ostream* os)
{
    *os << "FileContainer("
        << container.filePath().constData() << ", "
        << container.projectPartId().constData() << ", "
        << container.fileArguments().constData() << ", "
        << container.documentRevision();

    if (container.hasUnsavedFileContent())
        *os << ", "
            << container.unsavedFileContent().constData();

    *os << ")";
}
コード例 #4
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());
    }
}
コード例 #5
0
ファイル: filecontainer.cpp プロジェクト: C-sjia/qt-creator
QDebug operator<<(QDebug debug, const FileContainer &container)
{
    debug.nospace() << "FileContainer("
                    << container.filePath() << ", "
                    << container.projectPartId() << ", "
                    << container.fileArguments() << ", "
                    << container.documentRevision();

    if (container.hasUnsavedFileContent()) {
        const Utf8String fileWithContent = debugWriteFileForInspection(
                    container.unsavedFileContent(),
                    debugId(container));
        debug.nospace() << ", "
                        << "<" << fileWithContent << ">";
    }

    debug.nospace() << ")";

    return debug;
}
コード例 #6
0
bool operator==(const FileContainer &fileContainer, const Document &document)
{
    return fileContainer.filePath() == document.filePath() && fileContainer.projectPartId() == document.projectPartId();
}
コード例 #7
0
bool operator==(const FileContainer &fileContainer, const TranslationUnit &translationUnit)
{
    return fileContainer.filePath() == translationUnit.filePath() && fileContainer.projectPartId() == translationUnit.projectPartId();
}