[Uml-devel] KDE_3_2_BRANCH: kdesdk/umbrello/umbrello

Jonathan Riddell jri at jriddell.org
Fri Apr 2 11:26:07 UTC 2004


CVS commit by jriddell: 

Backport commit from Tue Mar 30 05:59:06 2004
--
CVS commit by okellogg:

importCPP(): Support package nesting.


  M +11 -6     classimport.cpp   1.19.2.2


--- kdesdk/umbrello/umbrello/classimport.cpp  #1.19.2.1:1.19.2.2
@@ -157,11 +157,15 @@ void ClassImport::importCPP(QStringList 
         for(; it.current();++it ) {
                 CParsedClass* currentParsedClass =  classParser.store.getClassByName(it);
-                QPtrList<CParsedAttribute> *attributes = currentParsedClass->getSortedAttributeList();
-                QPtrListIterator<CParsedAttribute> aIt(*attributes);
 
-                QString pkgName( currentParsedClass->declaredInScope );
+                QStringList parentPkgs = QStringList::split('.', currentParsedClass->declaredInScope);
                 UMLPackage *pkg = NULL;
-                if( ! pkgName.isEmpty() )
-                        pkg = (UMLPackage *)createUMLObject(Uml::ot_Package, pkgName);
+                while (! parentPkgs.isEmpty()) {
+                        QString pkgName = parentPkgs.front();
+                        parentPkgs.pop_front();
+                        UMLPackage *parentPkg = pkg;
+                        pkg = (UMLPackage *)createUMLObject(Uml::ot_Package, pkgName, "", parentPkg);
+                        if (parentPkg)
+                                parentPkg->addObject( pkg );
+                }
                 UMLObject *currentClass = createUMLObject(Uml::ot_Class,
                                                           currentParsedClass->name,
@@ -171,5 +175,6 @@ void ClassImport::importCPP(QStringList 
                         pkg->addObject( currentClass );
 
-                for( ; aIt.current() ; ++aIt) {
+                QPtrList<CParsedAttribute> *attributes = currentParsedClass->getSortedAttributeList();
+                for (QPtrListIterator<CParsedAttribute> aIt(*attributes); aIt.current() ; ++aIt) {
                         CParsedAttribute *attr = aIt.current();
                         QString scope;






More information about the umbrello-devel mailing list