| 270 | |
| 271 | template <class Item> |
| 272 | void 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 | |
| 311 | template <typename Item> |
| 312 | bool TopDUContextDynamicData::DUChainItemStorage<Item>::itemsHaveChanged() const |
no test coverage detected