forked from qt-creator/qt-creator
Utils: Move set algorithms to Utils
So it can be used in other plugins which does not depend on clang. Change-Id: I80b9f44609921951444e13c5fd35476c047ad579 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -156,7 +156,6 @@ HEADERS += \
|
|||||||
$$PWD/refactoringserverinterface.h \
|
$$PWD/refactoringserverinterface.h \
|
||||||
$$PWD/refactoringserverproxy.h \
|
$$PWD/refactoringserverproxy.h \
|
||||||
$$PWD/referencesmessage.h \
|
$$PWD/referencesmessage.h \
|
||||||
$$PWD/set_algorithm.h \
|
|
||||||
$$PWD/stringcacheentry.h \
|
$$PWD/stringcacheentry.h \
|
||||||
$$PWD/unsavedfilesupdatedmessage.h \
|
$$PWD/unsavedfilesupdatedmessage.h \
|
||||||
$$PWD/removeprojectpartsmessage.h \
|
$$PWD/removeprojectpartsmessage.h \
|
||||||
|
@@ -26,9 +26,8 @@
|
|||||||
#include "filestatuscache.h"
|
#include "filestatuscache.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
|
||||||
#include <set_algorithm.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/set_algorithm.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -59,7 +58,7 @@ void FileStatusCache::update(FilePathIds filePathIds)
|
|||||||
m_cacheEntries.end(),
|
m_cacheEntries.end(),
|
||||||
filePathIds.begin(),
|
filePathIds.begin(),
|
||||||
filePathIds.end(),
|
filePathIds.end(),
|
||||||
make_iterator([&](auto &entry) {
|
Utils::make_iterator([&](auto &entry) {
|
||||||
entry.lastModified = m_fileSystem.lastModified(entry.filePathId);
|
entry.lastModified = m_fileSystem.lastModified(entry.filePathId);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -73,7 +72,7 @@ FilePathIds FileStatusCache::modified(FilePathIds filePathIds) const
|
|||||||
m_cacheEntries.end(),
|
m_cacheEntries.end(),
|
||||||
filePathIds.begin(),
|
filePathIds.begin(),
|
||||||
filePathIds.end(),
|
filePathIds.end(),
|
||||||
make_iterator([&](auto &entry) {
|
Utils::make_iterator([&](auto &entry) {
|
||||||
auto newLastModified = m_fileSystem.lastModified(entry.filePathId);
|
auto newLastModified = m_fileSystem.lastModified(entry.filePathId);
|
||||||
if (newLastModified > entry.lastModified) {
|
if (newLastModified > entry.lastModified) {
|
||||||
modifiedFilePathIds.push_back(entry.filePathId);
|
modifiedFilePathIds.push_back(entry.filePathId);
|
||||||
@@ -88,7 +87,7 @@ FilePathIds FileStatusCache::modified(FilePathIds filePathIds) const
|
|||||||
filePathIds.end(),
|
filePathIds.end(),
|
||||||
m_cacheEntries.begin(),
|
m_cacheEntries.begin(),
|
||||||
m_cacheEntries.end(),
|
m_cacheEntries.end(),
|
||||||
make_iterator([&](FilePathId newFilePathId) {
|
Utils::make_iterator([&](FilePathId newFilePathId) {
|
||||||
newEntries.emplace_back(newFilePathId,
|
newEntries.emplace_back(newFilePathId,
|
||||||
m_fileSystem.lastModified(newFilePathId));
|
m_fileSystem.lastModified(newFilePathId));
|
||||||
modifiedFilePathIds.push_back(newFilePathId);
|
modifiedFilePathIds.push_back(newFilePathId);
|
||||||
|
@@ -27,7 +27,8 @@
|
|||||||
|
|
||||||
#include "filesysteminterface.h"
|
#include "filesysteminterface.h"
|
||||||
#include "modifiedtimecheckerinterface.h"
|
#include "modifiedtimecheckerinterface.h"
|
||||||
#include "set_algorithm.h"
|
|
||||||
|
#include <utils/set_algorithm.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@@ -60,7 +61,7 @@ public:
|
|||||||
m_currentSourceTimeStamps.end(),
|
m_currentSourceTimeStamps.end(),
|
||||||
filePathIds.begin(),
|
filePathIds.begin(),
|
||||||
filePathIds.end(),
|
filePathIds.end(),
|
||||||
make_iterator([&](SourceTimeStamp &sourceTimeStamp) {
|
Utils::make_iterator([&](SourceTimeStamp &sourceTimeStamp) {
|
||||||
sourceTimeStamp.timeStamp = m_fileSystem.lastModified(
|
sourceTimeStamp.timeStamp = m_fileSystem.lastModified(
|
||||||
sourceTimeStamp.sourceId);
|
sourceTimeStamp.sourceId);
|
||||||
}));
|
}));
|
||||||
@@ -69,7 +70,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool compareEntries(const SourceEntries &sourceEntries) const
|
bool compareEntries(const SourceEntries &sourceEntries) const
|
||||||
{
|
{
|
||||||
return !set_intersection_compare(
|
return !Utils::set_intersection_compare(
|
||||||
m_currentSourceTimeStamps.begin(),
|
m_currentSourceTimeStamps.begin(),
|
||||||
m_currentSourceTimeStamps.end(),
|
m_currentSourceTimeStamps.end(),
|
||||||
sourceEntries.begin(),
|
sourceEntries.begin(),
|
||||||
@@ -99,12 +100,14 @@ private:
|
|||||||
sourceEntries.end(),
|
sourceEntries.end(),
|
||||||
m_currentSourceTimeStamps.begin(),
|
m_currentSourceTimeStamps.begin(),
|
||||||
m_currentSourceTimeStamps.end(),
|
m_currentSourceTimeStamps.end(),
|
||||||
make_iterator([&](const SourceEntry &sourceEntry) {
|
Utils::make_iterator([&](const SourceEntry &sourceEntry) {
|
||||||
newTimeStamps.emplace_back(sourceEntry.sourceId,
|
newTimeStamps.emplace_back(sourceEntry.sourceId,
|
||||||
m_fileSystem.lastModified(
|
m_fileSystem.lastModified(
|
||||||
sourceEntry.sourceId));
|
sourceEntry.sourceId));
|
||||||
}),
|
}),
|
||||||
[](auto first, auto second) { return first.sourceId < second.sourceId; });
|
[](auto first, auto second) {
|
||||||
|
return first.sourceId < second.sourceId;
|
||||||
|
});
|
||||||
|
|
||||||
return newTimeStamps;
|
return newTimeStamps;
|
||||||
}
|
}
|
||||||
|
@@ -25,13 +25,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "set_algorithm.h"
|
|
||||||
#include "stringcachealgorithms.h"
|
#include "stringcachealgorithms.h"
|
||||||
#include "stringcacheentry.h"
|
#include "stringcacheentry.h"
|
||||||
#include "stringcachefwd.h"
|
#include "stringcachefwd.h"
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/optional.h>
|
#include <utils/optional.h>
|
||||||
|
#include <utils/set_algorithm.h>
|
||||||
#include <utils/smallstringfwd.h>
|
#include <utils/smallstringfwd.h>
|
||||||
|
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
@@ -197,7 +197,7 @@ public:
|
|||||||
strings.end(),
|
strings.end(),
|
||||||
m_strings.begin(),
|
m_strings.begin(),
|
||||||
m_strings.end(),
|
m_strings.end(),
|
||||||
make_iterator([&](StringViewType newString) {
|
Utils::make_iterator([&](StringViewType newString) {
|
||||||
IndexType index = storageFunction(newString);
|
IndexType index = storageFunction(newString);
|
||||||
newCacheEntries.emplace_back(newString, index);
|
newCacheEntries.emplace_back(newString, index);
|
||||||
}),
|
}),
|
||||||
|
@@ -130,6 +130,7 @@ add_qtc_library(Utils
|
|||||||
savedaction.cpp savedaction.h
|
savedaction.cpp savedaction.h
|
||||||
savefile.cpp savefile.h
|
savefile.cpp savefile.h
|
||||||
scopedswap.h
|
scopedswap.h
|
||||||
|
set_algorithm.h
|
||||||
settingsaccessor.cpp settingsaccessor.h
|
settingsaccessor.cpp settingsaccessor.h
|
||||||
settingsselector.cpp settingsselector.h
|
settingsselector.cpp settingsselector.h
|
||||||
settingsutils.h
|
settingsutils.h
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace Utils {
|
||||||
|
|
||||||
template<class Callable>
|
template<class Callable>
|
||||||
class function_output_iterator
|
class function_output_iterator
|
||||||
@@ -116,4 +116,5 @@ Value mismatch_collect(InputIt1 first1,
|
|||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
} // namespace Utils
|
@@ -298,7 +298,8 @@ HEADERS += \
|
|||||||
$$PWD/porting.h \
|
$$PWD/porting.h \
|
||||||
$$PWD/aspects.h \
|
$$PWD/aspects.h \
|
||||||
$$PWD/layoutbuilder.h \
|
$$PWD/layoutbuilder.h \
|
||||||
$$PWD/variablechooser.h
|
$$PWD/variablechooser.h \
|
||||||
|
$$PWD/set_algorithm.h
|
||||||
|
|
||||||
FORMS += $$PWD/filewizardpage.ui \
|
FORMS += $$PWD/filewizardpage.ui \
|
||||||
$$PWD/projectintropage.ui \
|
$$PWD/projectintropage.ui \
|
||||||
|
@@ -236,7 +236,8 @@ Project {
|
|||||||
"savedaction.h",
|
"savedaction.h",
|
||||||
"savefile.cpp",
|
"savefile.cpp",
|
||||||
"savefile.h",
|
"savefile.h",
|
||||||
"scopedswap.h",
|
"scopedswap.h"
|
||||||
|
"set_algorithm.h",
|
||||||
"settingsaccessor.cpp",
|
"settingsaccessor.cpp",
|
||||||
"settingsaccessor.h",
|
"settingsaccessor.h",
|
||||||
"settingsselector.cpp",
|
"settingsselector.cpp",
|
||||||
|
@@ -31,9 +31,10 @@
|
|||||||
#include <filepathcachinginterface.h>
|
#include <filepathcachinginterface.h>
|
||||||
#include <generatedfilesinterface.h>
|
#include <generatedfilesinterface.h>
|
||||||
#include <projectpartcontainer.h>
|
#include <projectpartcontainer.h>
|
||||||
#include <set_algorithm.h>
|
|
||||||
#include <usedmacrofilter.h>
|
#include <usedmacrofilter.h>
|
||||||
|
|
||||||
|
#include <utils/set_algorithm.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
@@ -163,7 +164,7 @@ ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDep
|
|||||||
newSources.end(),
|
newSources.end(),
|
||||||
oldSources.begin(),
|
oldSources.begin(),
|
||||||
oldSources.end(),
|
oldSources.end(),
|
||||||
make_iterator([&](SourceEntry entry) {
|
Utils::make_iterator([&](SourceEntry entry) {
|
||||||
change = changedSourceType(entry, change);
|
change = changedSourceType(entry, change);
|
||||||
}),
|
}),
|
||||||
[](SourceEntry first, SourceEntry second) {
|
[](SourceEntry first, SourceEntry second) {
|
||||||
@@ -185,7 +186,7 @@ ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDep
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (change == Change::No) {
|
if (change == Change::No) {
|
||||||
Change change = mismatch_collect(
|
Change change = Utils::mismatch_collect(
|
||||||
newSources.begin(),
|
newSources.begin(),
|
||||||
newSources.end(),
|
newSources.end(),
|
||||||
oldSources.begin(),
|
oldSources.begin(),
|
||||||
|
Reference in New Issue
Block a user