| 224 | } |
| 225 | |
| 226 | void Definitions::removeDefinition(const DeclarationId& id, const IndexedDeclaration& definition) |
| 227 | { |
| 228 | DefinitionsItem item; |
| 229 | item.declaration = id; |
| 230 | DefinitionsRequestItem request(item); |
| 231 | |
| 232 | LockedItemRepository::write<Definitions>([&](DefinitionsRepo& repo) { |
| 233 | uint index = repo.findIndex(item); |
| 234 | |
| 235 | if (index) { |
| 236 | // Check whether the item is already in the mapped list, else copy the list into the new created item |
| 237 | const DefinitionsItem* oldItem = repo.itemFromIndex(index); |
| 238 | for (unsigned int a = 0; a < oldItem->definitionsSize(); ++a) |
| 239 | if (!(oldItem->definitions()[a] == definition)) |
| 240 | item.definitionsList().append(oldItem->definitions()[a]); |
| 241 | |
| 242 | repo.deleteItem(index); |
| 243 | Q_ASSERT(repo.findIndex(item) == 0); |
| 244 | |
| 245 | // This inserts the changed item |
| 246 | if (item.definitionsSize() != 0) |
| 247 | repo.index(request); |
| 248 | } |
| 249 | }); |
| 250 | } |
| 251 | |
| 252 | KDevVarLengthArray<IndexedDeclaration> Definitions::definitions(const DeclarationId& id) const |
| 253 | { |