Differential D14479 Diff 39638 kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp
Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp
Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Line(s) | 321 | if (!Qt::mightBeRichText(comment)) { | |||
---|---|---|---|---|---|
325 | comment = comment.toHtmlEscaped(); | 325 | comment = comment.toHtmlEscaped(); | ||
326 | comment.replace(QLatin1Char('\n'), QLatin1String("<br />")); //Replicate newlines in html | 326 | comment.replace(QLatin1Char('\n'), QLatin1String("<br />")); //Replicate newlines in html | ||
327 | } | 327 | } | ||
328 | modifyHtml() += commentHighlight(comment); | 328 | modifyHtml() += commentHighlight(comment); | ||
329 | modifyHtml() += QStringLiteral("</p>"); | 329 | modifyHtml() += QStringLiteral("</p>"); | ||
330 | } | 330 | } | ||
331 | } | 331 | } | ||
332 | 332 | | |||
333 | if(!shorten) { | ||||
334 | modifyHtml() += declarationSizeInformation(d->m_declaration); | ||||
335 | } | ||||
336 | | ||||
333 | if(!shorten && doc) { | 337 | if(!shorten && doc) { | ||
334 | modifyHtml() += QLatin1String("<p>") + i18n("Show documentation for "); | 338 | modifyHtml() += QLatin1String("<p>") + i18n("Show documentation for "); | ||
335 | makeLink(prettyQualifiedName(d->m_declaration), | 339 | makeLink(prettyQualifiedName(d->m_declaration), | ||
336 | d->m_declaration, NavigationAction::ShowDocumentation); | 340 | d->m_declaration, NavigationAction::ShowDocumentation); | ||
337 | modifyHtml() += QStringLiteral("</p>"); | 341 | modifyHtml() += QStringLiteral("</p>"); | ||
338 | } | 342 | } | ||
339 | 343 | | |||
340 | 344 | | |||
▲ Show 20 Lines • Show All 438 Lines • ▼ Show 20 Line(s) | 770 | if( classFunDecl ) { | |||
779 | if( classFunDecl->isAbstract() ) | 783 | if( classFunDecl->isAbstract() ) | ||
780 | details << QStringLiteral("abstract"); | 784 | details << QStringLiteral("abstract"); | ||
781 | } | 785 | } | ||
782 | } | 786 | } | ||
783 | 787 | | |||
784 | return details; | 788 | return details; | ||
785 | } | 789 | } | ||
786 | 790 | | |||
791 | QString AbstractDeclarationNavigationContext::declarationSizeInformation(const DeclarationPointer& decl) | ||||
792 | { | ||||
793 | // Note that ClassMemberDeclaration also includes ClassDeclaration, which uses the sizeOf and alignOf fields, | ||||
794 | // but normally leaves the bitOffsetOf unset (-1). | ||||
795 | const ClassMemberDeclaration* memberDecl = dynamic_cast<const ClassMemberDeclaration*>(decl.data()); | ||||
796 | if (memberDecl && (memberDecl->bitOffsetOf() > 0 || memberDecl->sizeOf() > 0 || memberDecl->alignOf() > 0)) { | ||||
797 | QString sizeInfo = "<p>"; | ||||
798 | | ||||
799 | if (memberDecl->bitOffsetOf() >= 0) { | ||||
800 | const auto byteOffset = memberDecl->bitOffsetOf() / 8; | ||||
801 | const auto bitOffset = memberDecl->bitOffsetOf() % 8; | ||||
802 | const QString byteOffsetStr = i18np("1 Byte", "%1 Bytes", byteOffset); | ||||
803 | const QString bitOffsetStr = bitOffset ? i18np("1 Bit", "%1 Bits", bitOffset) : QString(); | ||||
804 | sizeInfo += i18n("offset in parent: %1", bitOffset ? i18nc("%1: bytes, %2: bits", "%1, %2", byteOffsetStr, bitOffsetStr) : byteOffsetStr); | ||||
805 | sizeInfo += "; "; | ||||
806 | } | ||||
807 | | ||||
808 | if (memberDecl->sizeOf() >= 0) { | ||||
809 | sizeInfo += i18n("size: %1 Bytes", memberDecl->sizeOf()); | ||||
810 | sizeInfo += "; "; | ||||
811 | } | ||||
812 | | ||||
813 | if (memberDecl->alignOf() >= 0) { | ||||
814 | sizeInfo += i18n("aligned to: %1 Bytes", memberDecl->alignOf()); | ||||
815 | } | ||||
816 | | ||||
817 | sizeInfo += "</p>"; | ||||
818 | | ||||
819 | return sizeInfo; | ||||
820 | } | ||||
821 | return QString(); | ||||
822 | } | ||||
823 | | ||||
787 | } | 824 | } |