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

Method open

gui/cppchecklibrarydata.cpp:460–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460QString CppcheckLibraryData::open(QIODevice &file)
461{
462 clear();
463 QString comments;
464 QXmlStreamReader xmlReader(&file);
465 while (!xmlReader.atEnd()) {
466 const QXmlStreamReader::TokenType t = xmlReader.readNext();
467 switch (t) {
468 case QXmlStreamReader::Comment:
469 if (!comments.isEmpty())
470 comments += "\n";
471 comments += xmlReader.text().toString();
472 break;
473 case QXmlStreamReader::StartElement:
474 try {
475 const QString elementName(xmlReader.name().toString());
476 if (elementName == "def")
477 ;
478 else if (elementName == "container")
479 containers.append(loadContainer(xmlReader));
480 else if (elementName == "define")
481 defines.append(loadDefine(xmlReader));
482 else if (elementName == "undefine")
483 undefines.append(loadUndefine(xmlReader));
484 else if (elementName == "function")
485 functions.append(loadFunction(xmlReader, comments));
486 else if (elementName == "memory" || elementName == "resource")
487 memoryresource.append(loadMemoryResource(xmlReader));
488 else if (elementName == "podtype")
489 podtypes.append(loadPodType(xmlReader));
490 else if (elementName == "smart-pointer")
491 smartPointers.append(loadSmartPointer(xmlReader));
492 else if (elementName == "type-checks")
493 typeChecks.append(loadTypeChecks(xmlReader));
494 else if (elementName == "platformtype")
495 platformTypes.append(loadPlatformType(xmlReader));
496 else if (elementName == "reflection")
497 reflections.append(loadReflection(xmlReader));
498 else if (elementName == "markup")
499 markups.append(loadMarkup(xmlReader));
500 else if (elementName == "entrypoint")
501 entrypoints.append(loadEntrypoint(xmlReader));
502 else
503 unhandledElement(xmlReader);
504 } catch (std::runtime_error &e) {
505 return e.what();
506 }
507 comments.clear();
508 break;
509 default:
510 break;
511 }
512 }
513 if (xmlReader.hasError())
514 return xmlReader.errorString();
515 return QString();
516}
517

Callers

nothing calls this directly

Calls 15

loadContainerFunction · 0.85
loadDefineFunction · 0.85
loadUndefineFunction · 0.85
loadFunctionFunction · 0.85
loadMemoryResourceFunction · 0.85
loadPodTypeFunction · 0.85
loadSmartPointerFunction · 0.85
loadTypeChecksFunction · 0.85
loadPlatformTypeFunction · 0.85
loadReflectionFunction · 0.85
loadMarkupFunction · 0.85
loadEntrypointFunction · 0.85

Tested by

no test coverage detected