MCPcopy Create free account
hub / github.com/KDE/labplot / loadFromXmlFile

Method loadFromXmlFile

src/3rdparty/QXlsx/source/xlsxsharedstrings.cpp:351–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351bool SharedStrings::loadFromXmlFile(QIODevice *device)
352{
353 QXmlStreamReader reader(device);
354 int count = 0;
355 bool hasUniqueCountAttr=true;
356 while (!reader.atEnd()) {
357 QXmlStreamReader::TokenType token = reader.readNext();
358 if (token == QXmlStreamReader::StartElement) {
359 if (reader.name() == QLatin1String("sst")) {
360 QXmlStreamAttributes attributes = reader.attributes();
361 if ((hasUniqueCountAttr = attributes.hasAttribute(QLatin1String("uniqueCount"))))
362 count = attributes.value(QLatin1String("uniqueCount")).toInt();
363 } else if (reader.name() == QLatin1String("si")) {
364 readString(reader);
365 }
366 }
367 }
368
369 if (hasUniqueCountAttr && m_stringList.size() != count) {
370 qDebug("Error: Shared string count");
371 return false;
372 }
373
374 if (m_stringList.size() != m_stringTable.size()) {
375 //qDebug("Warning: Duplicated items exist in shared string table.");
376 //Nothing we can do here, as indices of the strings will be used when loading sheets.
377 }
378
379 return true;
380}
381
382QT_END_NAMESPACE_XLSX

Callers

nothing calls this directly

Calls 4

atEndMethod · 0.80
nameMethod · 0.45
valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected