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

Method load

src/backend/datasources/LiveDataSource.cpp:848–995  ·  view source on GitHub ↗

! Loads from XML. */

Source from the content-addressed store, hash-verified

846 Loads from XML.
847*/
848bool LiveDataSource::load(XmlStreamReader* reader, bool preview) {
849 if (!readBasicAttributes(reader))
850 return false;
851
852 QXmlStreamAttributes attribs;
853 QString str;
854
855 while (!reader->atEnd()) {
856 reader->readNext();
857 if (reader->isEndElement()
858 && (reader->name() == QLatin1String("liveDataSource")
859 || reader->name() == QLatin1String("LiveDataSource"))) // TODO: remove "LiveDataSources" in couple of releases
860 break;
861
862 if (!reader->isStartElement())
863 continue;
864
865 if (reader->name() == QLatin1String("comment")) {
866 if (!readCommentElement(reader))
867 return false;
868 } else if (reader->name() == QLatin1String("general")) {
869 attribs = reader->attributes();
870
871 str = attribs.value(QStringLiteral("fileName")).toString();
872 if (str.isEmpty())
873 reader->raiseMissingAttributeWarning(QStringLiteral("fileName"));
874 else
875 m_fileName = str;
876
877 str = attribs.value(QStringLiteral("fileType")).toString();
878 if (str.isEmpty())
879 reader->raiseMissingAttributeWarning(QStringLiteral("fileType"));
880 else
881 m_fileType = (AbstractFileFilter::FileType)str.toInt();
882
883 str = attribs.value(QStringLiteral("fileLinked")).toString();
884 if (str.isEmpty())
885 reader->raiseMissingAttributeWarning(QStringLiteral("fileLinked"));
886 else
887 m_fileLinked = str.toInt();
888
889 str = attribs.value(QStringLiteral("relativePath")).toString();
890 if (str.isEmpty())
891 reader->raiseMissingAttributeWarning(QStringLiteral("relativePath"));
892 else
893 m_relativePath = str.toInt();
894
895 str = attribs.value(QStringLiteral("updateType")).toString();
896 if (str.isEmpty())
897 reader->raiseMissingAttributeWarning(QStringLiteral("updateType"));
898 else
899 m_updateType = static_cast<UpdateType>(str.toInt());
900
901 str = attribs.value(QStringLiteral("sourceType")).toString();
902 if (str.isEmpty())
903 reader->raiseMissingAttributeWarning(QStringLiteral("sourceType"));
904 else
905 m_sourceType = static_cast<SourceType>(str.toInt());

Callers

nothing calls this directly

Calls 10

atEndMethod · 0.80
setFixedMethod · 0.80
skipToEndElementMethod · 0.80
QStringClass · 0.70
nameMethod · 0.45
toStringMethod · 0.45
valueMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected