[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sat Jan 3 20:22:01 UTC 2004
CVS commit by okellogg:
{saveTo,loadFrom}XMI: Add code for XMI_NEST_PACKAGES
(in development: approach UML DTD conformance)
M +32 -0 package.cpp 1.10
--- kdesdk/umbrello/umbrello/package.cpp #1.9:1.10
@@ -48,4 +48,11 @@ bool UMLPackage::saveToXMI(QDomDocument&
QDomElement packageElement = qDoc.createElement("UML:Package");
bool status = UMLObject::saveToXMI(qDoc, packageElement);
+
+#ifdef XMI_NEST_PACKAGES
+ // Under construction
+ for (UMLObject *obj = m_objects.first(); obj; obj = m_objects.next())
+ obj->saveToXMI (qDoc, packageElement);
+#endif
+
qElement.appendChild(packageElement);
return status;
@@ -56,4 +63,29 @@ bool UMLPackage::loadFromXMI(QDomElement
return false;
}
+ UMLDoc *parentDoc = (UMLDoc*)parent();
+
+ QDomNode node = element.firstChild();
+ QDomElement tempElement = node.toElement();
+ while (!tempElement.isNull()) {
+ QString type = tempElement.tagName();
+ UMLObject *pObject = parentDoc->makeNewUMLObject(type);
+ if( !pObject ) {
+ kdWarning() << "UMLPackage::loadFromXMI: "
+ << "Given wrong type of umlobject to create: "
+ << type << endl;
+ return false;
+ }
+ if (! pObject->loadFromXMI(element)) {
+ delete pObject;
+ return false;
+ }
+ pObject->setUMLPackage(this);
+ if (type == "UML:Generalization")
+ parentDoc->addAssocToConcepts((UMLAssociation *) pObject);
+ m_objects.append(pObject);
+
+ node = node.nextSibling();
+ tempElement = node.toElement();
+ }
return true;
}
More information about the umbrello-devel
mailing list