Changeset View
Changeset View
Standalone View
Standalone View
src/lib/definition.cpp
Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Line(s) | |||||
279 | 279 | | |||
280 | bool DefinitionData::isLoaded() const | 280 | bool DefinitionData::isLoaded() const | ||
281 | { | 281 | { | ||
282 | return !contexts.isEmpty(); | 282 | return !contexts.isEmpty(); | ||
283 | } | 283 | } | ||
284 | 284 | | |||
285 | bool DefinitionData::load() | 285 | bool DefinitionData::load() | ||
286 | { | 286 | { | ||
287 | if (fileName.isEmpty()) | ||||
288 | return false; | ||||
289 | | ||||
287 | if (isLoaded()) | 290 | if (isLoaded()) | ||
288 | return true; | 291 | return true; | ||
289 | 292 | | |||
290 | Q_ASSERT(!fileName.isEmpty()); | | |||
291 | QFile file(fileName); | 293 | QFile file(fileName); | ||
292 | if (!file.open(QFile::ReadOnly)) | 294 | if (!file.open(QFile::ReadOnly)) | ||
293 | return false; | 295 | return false; | ||
294 | 296 | | |||
295 | QXmlStreamReader reader(&file); | 297 | QXmlStreamReader reader(&file); | ||
296 | while (!reader.atEnd()) { | 298 | while (!reader.atEnd()) { | ||
297 | const auto token = reader.readNext(); | 299 | const auto token = reader.readNext(); | ||
298 | if (token != QXmlStreamReader::StartElement) | 300 | if (token != QXmlStreamReader::StartElement) | ||
▲ Show 20 Lines • Show All 325 Lines • Show Last 20 Lines |