本文整理汇总了C++中Match::match方法的典型用法代码示例。如果您正苦于以下问题:C++ Match::match方法的具体用法?C++ Match::match怎么用?C++ Match::match使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::match方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
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;
}
示例2: match
bool Project::match(const Match &p)
{
Path paths[] = { p.pattern(), p.pattern() };
paths[1].resolve();
const int count = paths[1].compare(paths[0]) ? 2 : 1;
Scope<const FilesMap&> files = lockFilesForRead();
for (int i=0; i<count; ++i) {
const Path &path = paths[i];
if (files.data().contains(path) || p.match(mPath))
return true;
const uint32_t id = Location::fileId(path);
if (isIndexed(id))
return true;
}
return false;
}
示例3: reindex
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();
}
示例4: remove
int Project::remove(const Match &match)
{
int count = 0;
{
MutexLocker lock(&mMutex);
SourceInformationMap::iterator it = mSources.begin();
while (it != mSources.end()) {
if (match.match(it->second.sourceFile)) {
const uint32_t fileId = Location::insertFile(it->second.sourceFile);
mSources.erase(it++);
shared_ptr<IndexerJob> job = mJobs.value(fileId);
if (job)
job->abort();
mPendingData.remove(fileId);
mPendingJobs.remove(fileId);
++count;
} else {
++it;
}
}
}
return count;
}
示例5: match
bool Project::match(const Match &p, bool *indexed) const
{
Path paths[] = { p.pattern(), p.pattern() };
paths[1].resolve();
const int count = paths[1].compare(paths[0]) ? 2 : 1;
bool ret = false;
for (int i=0; i<count; ++i) {
const Path &path = paths[i];
const uint32_t id = Location::fileId(path);
if (isIndexed(id)) {
if (indexed)
*indexed = true;
return true;
} else if (mFiles.contains(path) || p.match(mPath)) {
if (!indexed)
return true;
ret = true;
}
}
if (indexed)
*indexed = false;
return ret;
}