Fixed: Introduction of namespace had broken compatibility with file format.

This commit is contained in:
Tats
2016-03-16 20:15:49 -04:00
parent f02933d9a4
commit 3e04d19797
6 changed files with 37 additions and 4 deletions
+19 -1
View File
@@ -21,6 +21,24 @@
MM_BEGIN_NAMESPACE
QString Serializable::cleanClassName() const
{
return classNameRealToClean(metaObject()->className());
}
QString Serializable::classNameRealToClean(const QString& realClassName)
{
Q_ASSERT(realClassName.startsWith(MM::NAMESPACE_PREFIX));
// Removes the NAMESPACE:: prefix.
return realClassName.right( realClassName.size() - MM::NAMESPACE_PREFIX.size() );
}
QString Serializable::classNameCleanToReal(const QString& cleanClassName)
{
Q_ASSERT(!cleanClassName.startsWith(MM::NAMESPACE_PREFIX));
return MM::NAMESPACE_PREFIX + cleanClassName;
}
void Serializable::read(const QDomElement& obj)
{
QList<QString> attributeNames = _propertiesAttributes();
@@ -75,7 +93,7 @@ void Serializable::write(QDomElement& obj)
QList<QString> specialNames = _propertiesSpecial();
// Write up classname.
obj.setAttribute("className", metaObject()->className());
obj.setAttribute(ProjectLabels::CLASS_NAME, cleanClassName());
// Fill up properties.
int count = metaObject()->propertyCount();