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

Method storeData

kdevplatform/language/duchain/topducontextdynamicdata.cpp:272–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270
271template <class Item>
272void TopDUContextDynamicData::DUChainItemStorage<Item>::storeData(uint& currentDataOffset,
273 const QVector<ArrayWithPosition>& oldData)
274{
275 auto const oldOffsets = offsets;
276 offsets.clear();
277 offsets.reserve(items.size());
278 for (int a = 0; a < items.size(); ++a) {
279 auto item = items[a];
280 if (!item) {
281 if (oldOffsets.size() > a && oldOffsets[a].dataOffset) {
282 //Directly copy the old data range into the new data
283 const DUChainBaseData* itemData = nullptr;
284 if (data->m_mappedData) {
285 itemData = reinterpret_cast<const DUChainBaseData*>(data->m_mappedData + oldOffsets[a].dataOffset);
286 } else {
287 itemData =
288 reinterpret_cast<const DUChainBaseData*>(::pointerInData(oldData, oldOffsets[a].dataOffset));
289 }
290 offsets << data->writeDataInfo(oldOffsets[a], itemData, currentDataOffset);
291 } else {
292 offsets << ItemDataInfo();
293 }
294 } else {
295 offsets << ItemDataInfo{currentDataOffset, indexForParentContext(item)};
296 saveDUChainItem(data->m_data, *item, currentDataOffset, isSharedDataItem<Item>());
297 }
298 }
299
300#ifndef QT_NO_DEBUG
301 if (!isSharedDataItem<Item>()) {
302 for (auto item : items) {
303 if (item) {
304 validateItem(item->d_func(), data->m_mappedData, data->m_mappedDataSize);
305 }
306 }
307 }
308#endif
309}
310
311template <typename Item>
312bool TopDUContextDynamicData::DUChainItemStorage<Item>::itemsHaveChanged() const

Callers 1

storeMethod · 0.80

Calls 10

pointerInDataFunction · 0.85
ItemDataInfoClass · 0.85
indexForParentContextFunction · 0.85
saveDUChainItemFunction · 0.85
validateItemFunction · 0.85
writeDataInfoMethod · 0.80
d_funcMethod · 0.80
clearMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected