MCPcopy Create free account
hub / github.com/KDE/kdevelop / html

Method html

plugins/clang/duchain/macronavigationcontext.cpp:51–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51QString MacroNavigationContext::html(bool shorten)
52{
53 Q_UNUSED(shorten);
54 clear();
55
56 modifyHtml() += QStringLiteral("<html><body><p>");
57
58 const QUrl url = m_macro->url().toUrl();
59 const QString path = url.toLocalFile();
60 KTextEditor::Cursor cursor(m_macro->rangeInCurrentRevision().start());
61 NavigationAction action(url, cursor);
62 modifyHtml() += i18nc("%1: macro type, i.e.: 'Function macro' or just 'Macro'"
63 "%2: the macro name and arguments",
64 "%1: %2",
65 (m_macro->isFunctionLike() ? i18n("Function macro") : i18n("Macro")),
66 importantHighlight(name()) + parameterListString(*m_macro));
67 modifyHtml() += QStringLiteral("<br/>");
68 modifyHtml() += i18nc("%1: the link to the definition", "Defined in: %1",
69 createLink(QStringLiteral("%1 :%2").arg(url.fileName()).arg(cursor.line()+1), path, action));
70
71 modifyHtml() += QStringLiteral(" "); //The action name _must_ stay "show_uses", since that is also used from outside
72 makeLink(i18n("Show uses"), QStringLiteral("show_uses"), NavigationAction(m_macro.dynamicCast<Declaration>(), NavigationAction::NavigateUses));
73
74 auto code = m_macro->definition().str();
75 modifyHtml() += QLatin1String("<p>") + i18n("Body: ");
76 modifyHtml() += QLatin1String("<tt>") + code.toHtmlEscaped().replace(QLatin1Char('\n'), QStringLiteral("<br/>")) + QLatin1String("</tt>");
77 modifyHtml() += QStringLiteral("</p>");
78
79 modifyHtml() += QStringLiteral("</p></body></html>");
80 return currentHtml();
81}
82
83QString MacroNavigationContext::retrievePreprocessedBody(const DocumentCursor& /*expansionLocation*/) const
84{

Callers 1

shortDescriptionMethod · 0.45

Calls 15

modifyHtmlFunction · 0.85
nameFunction · 0.85
parameterListStringFunction · 0.85
NavigationActionClass · 0.85
toLocalFileMethod · 0.80
isFunctionLikeMethod · 0.80
strMethod · 0.80
toHtmlEscapedMethod · 0.80
clearFunction · 0.50
toUrlMethod · 0.45
urlMethod · 0.45

Tested by

no test coverage detected