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

Method readBasicAttributes

src/backend/core/AbstractAspect.cpp:948–976  ·  view source on GitHub ↗

* \brief Load name and creation time from XML * * \return false on error */

Source from the content-addressed store, hash-verified

946 * \return false on error
947 */
948bool AbstractAspect::readBasicAttributes(XmlStreamReader* reader) {
949 const QXmlStreamAttributes& attribs = reader->attributes();
950
951 // name
952 QString str = attribs.value(QLatin1String("name")).toString();
953 if (str.isEmpty())
954 reader->raiseWarning(i18n("Attribute 'name' is missing or empty."));
955
956 d->m_name = str;
957
958 // creation time
959 str = attribs.value(QLatin1String("creation_time")).toString();
960 if (str.isEmpty()) {
961 reader->raiseWarning(i18n("Invalid creation time for '%1'. Using current time.", name()));
962 d->m_creation_time = QDateTime::currentDateTime();
963 } else {
964 QDateTime creation_time = QDateTime::fromString(str, QLatin1String("yyyy-dd-MM hh:mm:ss:zzz"));
965 if (creation_time.isValid())
966 d->m_creation_time = std::move(creation_time);
967 else
968 d->m_creation_time = QDateTime::currentDateTime();
969 }
970
971 str = attribs.value(QLatin1String("uuid")).toString();
972 if (!str.isEmpty()) {
973 d->m_uuid = QUuid(str);
974 }
975 return true;
976}
977
978////////////////////////////////////////////////////////////////////////////////////////////////////
979//@}

Callers

nothing calls this directly

Calls 5

raiseWarningMethod · 0.80
toStringMethod · 0.45
valueMethod · 0.45
isEmptyMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected