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

Method dotGraphInternal

kdevplatform/language/duchain/dumpdotgraph.cpp:102–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102QString DumpDotGraphPrivate::dotGraphInternal(KDevelop::DUContext* context, bool isMaster, bool shortened)
103{
104 if (m_hadObjects.contains(context))
105 return QString();
106
107 m_hadObjects[context] = true;
108
109 QTextStream stream;
110 QString ret;
111 stream.setString(&ret, QIODevice::WriteOnly);
112
113 if (isMaster)
114 stream << "Digraph chain {\n";
115
116 QString shape = QStringLiteral("parallelogram");
117 //QString shape = "box";
118 QString label = QStringLiteral("unknown");
119
120 if (dynamic_cast<TopDUContext*>(context)) {
121 auto* topCtx = static_cast<TopDUContext*>(context);
122 if (topCtx->parsingEnvironmentFile()) {
123 QUrl url = topCtx->parsingEnvironmentFile()->url().toUrl();
124 const QString fileName = url.fileName();
125 QString file = url.toDisplayString(QUrl::PreferLocalFile);
126 if (topCtx->parsingEnvironmentFile() && topCtx->parsingEnvironmentFile()->isProxyContext())
127 url.setPath(url.path() + QLatin1String("/_[proxy]_"));
128
129 //Find the context this one is derived from. If there is one, connect it with a line, and shorten the url.
130 if (m_hadVersions.contains(url)) {
131 stream << shortLabel(context) << " -> " << m_hadVersions[url] << "[color=blue,label=\"version\"];\n";
132 file = fileName;
133 } else {
134 m_hadVersions[url] = shortLabel(context);
135 }
136
137 label = file;
138
139 if (topCtx->importers().count() != 0)
140 label += QStringLiteral(" imported by %1").arg(topCtx->importers().count());
141 } else {
142 label = QStringLiteral("unknown file");
143 }
144 if (topCtx->parsingEnvironmentFile() && topCtx->parsingEnvironmentFile()->isProxyContext())
145 label = QLatin1String("Proxy-context ") + label;
146 } else {
147 label = /*"context " + */ context->localScopeIdentifier().toString();
148 label += QLatin1Char(' ') + rangeToString(context->range().castToSimpleRange());
149 }
150
151 //label = QStringLiteral("%1 ").arg((size_t)context) + label;
152
153 if (isMaster && !dynamic_cast<TopDUContext*>(context)) {
154 //Also draw contexts that import this one
155 const auto importers = context->importers();
156 for (DUContext* ctx : importers) {
157 stream << dotGraphInternal(ctx, false, true);
158 }
159 }

Callers 1

dotGraphMethod · 0.80

Calls 15

shortLabelFunction · 0.85
rangeToStringFunction · 0.85
isProxyContextMethod · 0.80
localScopeIdentifierMethod · 0.80
childContextsMethod · 0.80
localDeclarationsMethod · 0.80
QStringClass · 0.70
containsMethod · 0.45
toUrlMethod · 0.45
urlMethod · 0.45
fileNameMethod · 0.45

Tested by

no test coverage detected