FIXME: this API is unsafe, we should return a KDevVarLengthArray of values instead
| 350 | |
| 351 | // FIXME: this API is unsafe, we should return a KDevVarLengthArray of values instead |
| 352 | void CodeModel::items(const IndexedString& file, uint& count, const CodeModelItem*& items) const |
| 353 | { |
| 354 | ifDebug(qCDebug(LANGUAGE) << "items" << file.str(); ) |
| 355 | |
| 356 | CodeModelRepositoryItem item; |
| 357 | item.file = file; |
| 358 | CodeModelRequestItem request(item); |
| 359 | |
| 360 | LockedItemRepository::read<CodeModel>([&](const CodeModelRepo& repo) { |
| 361 | uint index = repo.findIndex(item); |
| 362 | |
| 363 | if (index) { |
| 364 | const CodeModelRepositoryItem* repositoryItem = repo.itemFromIndex(index); |
| 365 | ifDebug(qCDebug(LANGUAGE) << "found index" << index << repositoryItem->itemsSize();) |
| 366 | count = repositoryItem->itemsSize(); |
| 367 | items = repositoryItem->items(); |
| 368 | } else { |
| 369 | ifDebug(qCDebug(LANGUAGE) << "found no index";) |
| 370 | count = 0; |
| 371 | items = nullptr; |
| 372 | } |
| 373 | }); |
| 374 | } |
| 375 | |
| 376 | CodeModel& CodeModel::self() |
| 377 | { |
no test coverage detected