MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / onLine

Method onLine

MiniZincIDE/codechecker.cpp:45–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void 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
74void CodeChecker::onFinished()
75{

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected