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

Method read

gui/projectfile.cpp:93–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93bool ProjectFile::read(const QString &filename)
94{
95 if (!filename.isEmpty())
96 mFilename = filename;
97
98 QFile file(mFilename);
99 if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
100 return false;
101
102 clear();
103
104 QXmlStreamReader xmlReader(&file);
105 bool insideProject = false;
106 bool projectTagFound = false;
107 while (!xmlReader.atEnd()) {
108 switch (xmlReader.readNext()) {
109 case QXmlStreamReader::StartElement:
110 if (xmlReader.name() == QString(CppcheckXml::ProjectElementName)) {
111 insideProject = true;
112 projectTagFound = true;
113 break;
114 }
115 if (!insideProject)
116 break;
117
118 // Read root path from inside project element
119 if (xmlReader.name() == QString(CppcheckXml::RootPathName))
120 readRootPath(xmlReader);
121
122 // Read root path from inside project element
123 if (xmlReader.name() == QString(CppcheckXml::BuildDirElementName))
124 readBuildDir(xmlReader);
125
126 // Find paths to check from inside project element
127 if (xmlReader.name() == QString(CppcheckXml::PathsElementName))
128 readCheckPaths(xmlReader);
129
130 if (xmlReader.name() == QString(CppcheckXml::ImportProjectElementName))
131 readImportProject(xmlReader);
132
133 if (xmlReader.name() == QString(CppcheckXml::AnalyzeAllVsConfigsElementName))
134 mAnalyzeAllVsConfigs = readBool(xmlReader);
135
136 if (xmlReader.name() == QString(CppcheckXml::Parser))
137 clangParser = true;
138
139 if (xmlReader.name() == QString(CppcheckXml::CheckHeadersElementName))
140 mCheckHeaders = readBool(xmlReader);
141
142 if (xmlReader.name() == QString(CppcheckXml::CheckUnusedTemplatesElementName))
143 mCheckUnusedTemplates = readBool(xmlReader);
144
145 if (xmlReader.name() == QString(CppcheckXml::InlineSuppression))
146 mInlineSuppression = readBool(xmlReader);
147
148 if (xmlReader.name() == QString(CppcheckXml::CheckLevelExhaustiveElementName))
149 mCheckLevel = CheckLevel::exhaustive;
150

Callers

nothing calls this directly

Calls 10

isEmptyMethod · 0.80
QStringClass · 0.70
clearFunction · 0.50
openMethod · 0.45
nameMethod · 0.45
loadFromXmlMethod · 0.45
containsMethod · 0.45
toStringMethod · 0.45
valueMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected