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

Method load

src/backend/datasources/MQTTSubscription.cpp:140–176  ·  view source on GitHub ↗

! Loads from XML. */

Source from the content-addressed store, hash-verified

138 Loads from XML.
139*/
140bool MQTTSubscription::load(XmlStreamReader* reader, bool preview) {
141 if (!readBasicAttributes(reader))
142 return false;
143
144 QXmlStreamAttributes attribs;
145
146 while (!reader->atEnd()) {
147 reader->readNext();
148 if (reader->isEndElement() && reader->name() == QLatin1String("MQTTSubscription"))
149 break;
150
151 if (!reader->isStartElement())
152 continue;
153
154 if (reader->name() == QLatin1String("comment")) {
155 if (!readCommentElement(reader))
156 return false;
157 } else if (reader->name() == QLatin1String("general")) {
158 attribs = reader->attributes();
159 m_subscriptionName = attribs.value(QStringLiteral("subscriptionName")).toString();
160 } else if (reader->name() == QLatin1String("MQTTTopic")) {
161 auto* topic = new MQTTTopic(QString(), this, false);
162 if (!topic->load(reader, preview)) {
163 delete topic;
164 return false;
165 }
166 addChildFast(topic);
167 } else { // unknown element
168 reader->raiseWarning(i18n("unknown element '%1'", reader->name().toString()));
169 if (!reader->skipToEndElement())
170 return false;
171 }
172 }
173
174 Q_EMIT loaded(this->subscriptionName());
175 return !reader->hasError();
176}

Callers

nothing calls this directly

Calls 8

subscriptionNameMethod · 0.95
atEndMethod · 0.80
raiseWarningMethod · 0.80
skipToEndElementMethod · 0.80
QStringClass · 0.70
nameMethod · 0.45
toStringMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected