| 43 | } |
| 44 | |
| 45 | void CodeChecker::onLine(const QString& l) |
| 46 | { |
| 47 | QJsonParseError error; |
| 48 | auto json = QJsonDocument::fromJson(l.toUtf8(), &error); |
| 49 | if (json.isNull()) { |
| 50 | return; |
| 51 | } |
| 52 | auto msg = json.object(); |
| 53 | if (msg["type"] != "error" && msg["type"] != "warning") { |
| 54 | return; |
| 55 | } |
| 56 | if (!msg["location"].isObject()) { |
| 57 | return; |
| 58 | } |
| 59 | auto loc = msg["location"].toObject(); |
| 60 | MiniZincError e; |
| 61 | e.isWarning = msg["type"] == "warning"; |
| 62 | e.filename = loc["filename"].toString(); |
| 63 | e.first_line = loc["firstLine"].toInt(); |
| 64 | e.first_col = loc["firstColumn"].toInt(); |
| 65 | e.last_line = loc["lastLine"].toInt(); |
| 66 | e.last_col = loc["lastColumn"].toInt(); |
| 67 | e.msg = msg["message"].toString(); |
| 68 | if (e.filename == "stdin") { |
| 69 | // Ignore errors that aren't from this file |
| 70 | mznErrors.push_back(e); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | void CodeChecker::onFinished() |
| 75 | { |