| 340 | } |
| 341 | |
| 342 | IndexedTypeIdentifier shortenedTypeIdentifier(const AbstractType::Ptr& type_, DUContext* ctx, int desiredLength, |
| 343 | const QualifiedIdentifier& stripPrefix) |
| 344 | { |
| 345 | bool isReference = false; |
| 346 | bool isRValue = false; |
| 347 | |
| 348 | auto type = type_; |
| 349 | if (auto refType = type.dynamicCast<ReferenceType>()) { |
| 350 | isReference = true; |
| 351 | type = refType->baseType(); |
| 352 | isRValue = refType->isRValue(); |
| 353 | } |
| 354 | |
| 355 | type = shortenTypeForViewing(type); |
| 356 | |
| 357 | if (ctx) { |
| 358 | type = stripType(type, ctx); |
| 359 | } |
| 360 | if (!type) { |
| 361 | return IndexedTypeIdentifier(); |
| 362 | } |
| 363 | |
| 364 | IndexedTypeIdentifier identifier = identifierForType(type, ctx ? ctx->topContext() : nullptr); |
| 365 | |
| 366 | identifier = stripPrefixIdentifiers(identifier, stripPrefix); |
| 367 | |
| 368 | if (isReference) { |
| 369 | identifier.setIsReference(true); |
| 370 | } |
| 371 | if (isRValue) { |
| 372 | identifier.setIsRValue(true); |
| 373 | } |
| 374 | |
| 375 | int removeTemplateParametersFrom = 10; |
| 376 | |
| 377 | while (identifier.toString().length() > desiredLength * 3 && removeTemplateParametersFrom >= 0) { |
| 378 | --removeTemplateParametersFrom; |
| 379 | identifier = removeTemplateParameters(identifier, removeTemplateParametersFrom); |
| 380 | } |
| 381 | return identifier; |
| 382 | } |
| 383 | |
| 384 | QString makeSignatureString(const KDevelop::Declaration* functionDecl, const Signature& signature, const bool editingDefinition) |
| 385 | { |
no test coverage detected