MCPcopy Create free account
hub / github.com/avast/retdec / presentCompiler

Method presentCompiler

src/fileinfo/file_presentation/json_presentation.cpp:205–250  ·  view source on GitHub ↗

* Present information about detected compilers and packers */

Source from the content-addressed store, hash-verified

203 * Present information about detected compilers and packers
204 */
205void JsonPresentation::presentCompiler(Writer& writer) const
206{
207 if (fileinfo.toolInfo.detectedTools.empty())
208 {
209 return;
210 }
211
212 writer.String("tools");
213 writer.StartArray();
214
215 for(const auto &tool : fileinfo.toolInfo.detectedTools)
216 {
217 writer.StartObject();
218
219 serializeString(writer, "type", toolTypeToString(tool.type));
220 serializeString(writer, "name", tool.name);
221 serializeString(writer, "version", tool.versionInfo);
222 serializeString(writer, "additional", tool.additionalInfo);
223 serializeString(
224 writer,
225 "method",
226 detectionMetodToString(tool.source));
227 serdes::serializeBool(
228 writer,
229 "heuristics",
230 tool.source != DetectionMethod::SIGNATURE);
231 serdes::serializeUint64(
232 writer,
233 "identicalSignificantNibbles",
234 tool.agreeCount);
235 serdes::serializeUint64(
236 writer,
237 "totalSignificantNibbles",
238 tool.impCount);
239 serdes::serializeDouble(
240 writer,
241 "percentage",
242 tool.impCount
243 ? static_cast<double>(tool.agreeCount) / tool.impCount * 100
244 : 0.0);
245
246 writer.EndObject();
247 }
248
249 writer.EndArray();
250}
251
252/**
253 * Present information about detected languages

Callers

nothing calls this directly

Calls 12

toolTypeToStringFunction · 0.85
detectionMetodToStringFunction · 0.85
serializeBoolFunction · 0.85
serializeUint64Function · 0.85
serializeDoubleFunction · 0.85
serializeStringFunction · 0.70
emptyMethod · 0.45
StringMethod · 0.45
StartArrayMethod · 0.45
StartObjectMethod · 0.45
EndObjectMethod · 0.45
EndArrayMethod · 0.45

Tested by

no test coverage detected