MCPcopy Create free account
hub / github.com/OneMoreGres/ScreenTranslator / parse

Method parse

src/service/updates.cpp:153–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153QString Model::parse(const QByteArray &data)
154{
155 QJsonParseError error;
156 const auto doc = QJsonDocument::fromJson(data, &error);
157 if (doc.isNull()) {
158 return tr("Failed to parse: %1 at %2")
159 .arg(error.errorString())
160 .arg(error.offset);
161 }
162
163 const auto json = doc.object();
164 const auto version = json[versionKey].toInt();
165 if (version != 1) {
166 return tr("Wrong updates version: %1").arg(version);
167 }
168
169 beginResetModel();
170
171 root_ = parse(json);
172 if (root_)
173 updateStates();
174
175 endResetModel();
176
177 if (!root_)
178 return tr("No data parsed");
179 return {};
180}
181
182std::unique_ptr<Model::Component> Model::parse(const QJsonObject &json) const
183{

Callers 5

translateFunction · 0.80
downloadedMethod · 0.80
get_qt_ssl.pyFile · 0.80
get_qt.pyFile · 0.80
TESTFunction · 0.80

Calls 8

toListFunction · 0.85
shuffleFunction · 0.85
isNullMethod · 0.80
toStringMethod · 0.80
sizeMethod · 0.45
isValidMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.64