MCPcopy Create free account
hub / github.com/KDE/kdevelop / saveCheckSetSelections

Method saveCheckSetSelections

plugins/clazy/checksetselectionmanager.cpp:175–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void CheckSetSelectionManager::saveCheckSetSelections(QVector<CheckSetSelection>& checkSetSelections)
176{
177 // TODO: do not save if locked by someone else -> needs passing of our lock? or just registering our own and check?
178 // create and set unique id
179 std::for_each(checkSetSelections.begin(), checkSetSelections.end(), [this](CheckSetSelection& checkSetSelection) {
180 const QString checkSetSelectionId = checkSetSelection.id();
181
182 bool needsId = true;
183 if (!checkSetSelectionId.isEmpty()) {
184 // already existing?
185 auto hasCheckSetSelectionId = [&checkSetSelectionId] (const CheckSetSelection& existingProfile) {
186 return (checkSetSelectionId == existingProfile.id());
187 };
188 if (std::any_of(m_checkSetSelections.constBegin(), m_checkSetSelections.constEnd(), hasCheckSetSelectionId)) {
189 needsId = false;
190 }
191 }
192
193 // set new uuid for non-existing
194 if (needsId) {
195 checkSetSelection.setId(QUuid::createUuid().toString());
196 }
197
198 saveCheckSetSelection(checkSetSelection);
199 });
200}
201
202void CheckSetSelectionManager::removeCheckSetSelections(const QVector<QString>& checkSetSelectionIds)
203{

Callers 1

storeMethod · 0.45

Calls 8

constBeginMethod · 0.80
constEndMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
idMethod · 0.45
isEmptyMethod · 0.45
setIdMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected