MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / serialize

Method serialize

lib/errorlogger.cpp:280–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280std::string ErrorMessage::serialize() const
281{
282 // Serialize this message into a simple string
283 std::string oss;
284 serializeString(oss, id);
285 serializeString(oss, severityToString(severity));
286 serializeString(oss, std::to_string(cwe.id));
287 serializeString(oss, std::to_string(hash));
288 serializeString(oss, fixInvalidChars(remark));
289 serializeString(oss, file0);
290 serializeString(oss, (certainty == Certainty::inconclusive) ? "1" : "0");
291
292 const std::string saneShortMessage = fixInvalidChars(mShortMessage);
293 const std::string saneVerboseMessage = fixInvalidChars(mVerboseMessage);
294
295 serializeString(oss, saneShortMessage);
296 serializeString(oss, saneVerboseMessage);
297 serializeString(oss, mSymbolNames);
298 oss += std::to_string(callStack.size());
299 oss += " ";
300
301 for (auto loc = callStack.cbegin(); loc != callStack.cend(); ++loc) {
302 std::string frame;
303 frame += std::to_string(loc->line);
304 frame += '\t';
305 frame += std::to_string(loc->column);
306 frame += '\t';
307 frame += loc->getfile(false);
308 frame += '\t';
309 frame += loc->getOrigFile(false);
310 frame += '\t';
311 frame += loc->getinfo();
312 serializeString(oss, frame);
313 }
314
315 return oss;
316}
317
318void ErrorMessage::deserialize(const std::string &data)
319{

Callers 15

executeAddonsMethod · 0.45
~StdLoggerMethod · 0.45
reportErrMethod · 0.45
emptyReportMethod · 0.45
singleErrorMethod · 0.45
multipleErrorsMethod · 0.45
errorWithoutLocationMethod · 0.45
securityRelatedErrorsMethod · 0.45
cweTagsPresentMethod · 0.45
noCweNoSecurityMethod · 0.45

Calls 5

serializeStringFunction · 0.85
severityToStringFunction · 0.85
getfileMethod · 0.80
sizeMethod · 0.45
getOrigFileMethod · 0.45

Tested by 15

emptyReportMethod · 0.36
singleErrorMethod · 0.36
multipleErrorsMethod · 0.36
errorWithoutLocationMethod · 0.36
securityRelatedErrorsMethod · 0.36
cweTagsPresentMethod · 0.36
noCweNoSecurityMethod · 0.36
inconclusiveCertaintyMethod · 0.36
criticalErrorIdMethod · 0.36
emptyDescriptionsMethod · 0.36