Beispiel #1
0
bool IndexParseData::write(const std::function<bool(const String &)> &write, const Match &match) const
{
    auto process = [&write, &match](const String &str, const Sources &sss) {
        if (!sss.isEmpty()) {
            if (!write(str + ":"))
                return false;

            for (const auto &ss : sss) {
                const Path file = Location::path(ss.first);
                if (match.isEmpty() || match.match(file)) {
                    write("  " + file + ":");
                    for (const auto &s : ss.second) {
                        if (!write("    " + s.toString()))
                            return false;
                    }
                }
            }
        }
        return true;
    };
    if (!process("Sources", sources))
        return false;

    for (const auto &commands : compileCommands) {
        if (!process(Location::path(commands.first), commands.second.sources))
            return false;
    }
    return true;
}
Beispiel #2
0
int Project::reindex(const Match &match)
{
    Set<uint32_t> dirty;
    {
        MutexLocker lock(&mMutex);

        const DependencyMap::const_iterator end = mDependencies.end();
        for (DependencyMap::const_iterator it = mDependencies.begin(); it != end; ++it) {
            if (match.isEmpty() || match.match(Location::path(it->first))) {
                dirty.insert(it->first);
            }
        }
        if (dirty.isEmpty())
            return 0;
        mModifiedFiles += dirty;
    }
    startDirtyJobs();
    return dirty.size();
}