| 281 | } |
| 282 | |
| 283 | bool ThreadHandler::needsReCheck(const QString &filename, std::set<QString> &modified, std::set<QString> &unmodified) const |
| 284 | { |
| 285 | if (modified.find(filename) != modified.end()) |
| 286 | return true; |
| 287 | |
| 288 | if (unmodified.find(filename) != unmodified.end()) |
| 289 | return false; |
| 290 | |
| 291 | if (QFileInfo(filename).lastModified() > mLastCheckTime) { |
| 292 | return true; |
| 293 | } |
| 294 | |
| 295 | // Parse included files recursively |
| 296 | QFile f(filename); |
| 297 | if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) |
| 298 | return false; |
| 299 | |
| 300 | // prevent recursion.. |
| 301 | unmodified.insert(filename); |
| 302 | |
| 303 | QTextStream in(&f); |
| 304 | while (!in.atEnd()) { |
| 305 | QString line = in.readLine(); |
| 306 | if (line.startsWith("#include \"")) { |
| 307 | line.remove(0,10); |
| 308 | const int i = line.indexOf("\""); |
| 309 | if (i > 0) { |
| 310 | line.remove(i,line.length()); |
| 311 | line = QFileInfo(filename).absolutePath() + "/" + line; |
| 312 | if (needsReCheck(line, modified, unmodified)) { |
| 313 | modified.insert(std::move(line)); |
| 314 | return true; |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | return false; |
| 321 | } |
| 322 | |
| 323 | QDateTime ThreadHandler::getCheckStartTime() const |
| 324 | { |
nothing calls this directly
no test coverage detected