[Uml-devel] kdesdk/umbrello/umbrello
    Oliver Kellogg 
    okellogg at users.sourceforge.net
       
    Mon Mar 29 21:00:00 UTC 2004
    
    
  
CVS commit by okellogg: 
importCPP(): Support package nesting.
  M +11 -6     classimport.cpp   1.22
--- kdesdk/umbrello/umbrello/classimport.cpp  #1.21:1.22
@@ -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