[Uml-devel] KDE/kdesdk/umbrello/umbrello/codeimport/kdevcppparser

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sat Oct 13 20:13:41 UTC 2007


SVN commit 724903 by chehrlic:

qt3support--

 M  +4 -4      cpptree2uml.cpp  
 M  +10 -9     driver.cpp  
 M  +11 -11    urlutil.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/kdevcppparser/cpptree2uml.cpp #724902:724903
@@ -71,7 +71,7 @@
         QFileInfo fileInfo( m_fileName );
         QString shortFileName = fileInfo.baseName();
 
-        nsName.sprintf( "(%s_%d)", shortFileName.local8Bit().data(), m_anon++ );
+        nsName.sprintf( "(%s_%d)", shortFileName.toLocal8Bit().constData(), m_anon++ );
     } else {
         nsName = ast->namespaceName()->text();
     }
@@ -302,7 +302,7 @@
     UMLOperation *m = Import_Utils::makeOperation(c, id);
     // if a class has no return type, it could be a constructor or
     // a destructor
-    if (d && returnType.isEmpty() && id.find("~") == -1)
+    if (d && returnType.isEmpty() && id.indexOf('~') == -1)
         isConstructor = true;
 
     parseFunctionArguments( d, m );
@@ -336,7 +336,7 @@
     } else if( !ast->name() ){
         QFileInfo fileInfo( m_fileName );
         QString shortFileName = fileInfo.baseName();
-        className.sprintf( "(%s_%d)", shortFileName.local8Bit().data(), m_anon++ );
+        className.sprintf( "(%s_%d)", shortFileName.toLocal8Bit().constData(), m_anon++ );
     } else {
         className = ast->name()->unqualifiedName()->text().trimmed();
     }
@@ -532,7 +532,7 @@
     UMLOperation *m = Import_Utils::makeOperation(c, id);
     // if a class has no return type, it could de a constructor or
     // a destructor
-    if (d && returnType.isEmpty() && id.find("~") == -1)
+    if (d && returnType.isEmpty() && id.indexOf('~') == -1)
         isConstructor = true;
 
     parseFunctionArguments( d, m );
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/kdevcppparser/driver.cpp #724902:724903
@@ -41,7 +41,7 @@
 	QFile f( fileName );
 	if( f.open(QIODevice::ReadOnly) ){
 	    QTextStream s( &f );
-	    source = s.read();
+	    source = s.readAll();
 	    f.close();
 	}
 	return source;
@@ -90,11 +90,12 @@
     m_problems.clear();
     m_includePaths.clear();
 
-    while( m_parsedUnits.size() ){
-	TranslationUnitAST* unit = *m_parsedUnits.begin();
-	m_parsedUnits.remove( m_parsedUnits.begin() );
-	delete( unit );
+    QMapIterator<QString, TranslationUnitAST*> it(m_parsedUnits);
+    while (it.hasNext()){
+        it.next();
+        delete( it.value() );
     }
+    m_parsedUnits.clear();
 }
 
 void Driver::remove( const QString & fileName )
@@ -203,7 +204,7 @@
 {
     QMap<QString, QMap<QString, Dependence> >::ConstIterator it = m_dependences.find( fileName );
     if( it != m_dependences.end() )
-	return it.data();
+        return it.value();
     return QMap<QString, Dependence>();
 }
 
@@ -216,14 +217,14 @@
 {
     QMap<QString, Q3ValueList<Problem> >::ConstIterator it = m_problems.find( fileName );
     if( it != m_problems.end() )
-	return it.data();
+        return it.value();
     return Q3ValueList<Problem>();
 }
 
 void Driver::parseFile( const QString& fileName, bool onlyPreProcess, bool force )
 {
     QFileInfo fileInfo( fileName );
-    QString absoluteFilePath = fileInfo.absFilePath();
+    QString absoluteFilePath = fileInfo.absoluteFilePath();
 
     QMap<QString, TranslationUnitAST*>::Iterator it = m_parsedUnits.find( absoluteFilePath );
 
@@ -404,7 +405,7 @@
     QString fileName = dep.first;
 
     if( dep.second == Dep_Local ){
-        QString path = QFileInfo( currentFileName() ).dirPath( true );
+        QString path = QFileInfo( currentFileName() ).absolutePath();
         QFileInfo fileInfo( QFileInfo(path, fileName) );
 	if ( fileInfo.exists() && fileInfo.isFile() )
 	    return fileInfo.absoluteFilePath();
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/kdevcppparser/urlutil.cpp #724902:724903
@@ -40,14 +40,14 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 QString URLUtil::filename(const QString & name) {
-  int slashPos = name.findRev("/");
+  int slashPos = name.lastIndexOf('/');
   return slashPos<0 ? name : name.mid(slashPos+1);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
 QString URLUtil::directory(const QString & name) {
-  int slashPos = name.findRev("/");
+  int slashPos = name.lastIndexOf('/');
   return slashPos<0 ? QString("") : name.left(slashPos);
 }
 
@@ -72,7 +72,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 QString URLUtil::upDir(const QString & path, bool slashSuffix) {
-  int slashPos = path.findRev("/");
+  int slashPos = path.lastIndexOf('/');
   if (slashPos<1) return QString();
   return path.mid(0,slashPos+ (slashSuffix ? 1 : 0) );
 }
@@ -101,8 +101,8 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 QString URLUtil::getExtension(const QString & path) {
-  int dotPos = path.findRev('.');
-  if (dotPos<0) return QString("");
+  int dotPos = path.lastIndexOf('.');
+  if (dotPos<0) return QString();
   return path.mid(dotPos+1);
 }
 
@@ -112,7 +112,7 @@
 {
   QString absBase = extractPathNameAbsolute( baseDirUrl ),
     absRef = extractPathNameAbsolute( url );
-  int i = absRef.find( absBase, 0, true );
+  int i = absRef.indexOf( absBase, 0, Qt::CaseSensitive );
 
   if (i == -1)
     return QString();
@@ -220,11 +220,11 @@
   if (dirUrl.isEmpty() || (dirUrl == "/"))
     return fileUrl;
 
-  QStringList dir = QStringList::split("/", dirUrl, false);
-  QStringList file = QStringList::split("/", fileUrl, false);
+  QStringList dir = dirUrl.split('/', QString::SkipEmptyParts);
+  QStringList file = fileUrl.split('/', QString::SkipEmptyParts);
 
   QString resFileName = file.last();
-  file.remove(file.last());
+  file.removeLast();
 
   uint i = 0;
   while ( (i < dir.count()) && (i < (file.count())) && (dir[i] == file[i]) )
@@ -238,7 +238,7 @@
   {
     i >= dir.count() ? currDir = "" : currDir = dir[i];
     i >= file.count() ? currFile = "" : currFile = file[i];
-    qWarning("i = %d, currDir = %s, currFile = %s", i, currDir.latin1(), currFile.latin1());
+    qWarning("i = %d, currDir = %s, currFile = %s", i, currDir.toLatin1(), currFile.toLatin1());
     if (currDir.isEmpty() && currFile.isEmpty())
       break;
     else if (currDir.isEmpty())
@@ -292,7 +292,7 @@
       if (pos < 0)
         pos = len;
 
-      char* ret = getenv( QConstString(str.unicode()+1, pos-1).string().local8Bit().data() );
+      const char* ret = qgetenv( QString(str.unicode()+1, pos-1).toLocal8Bit().constData() );
 
       if (ret)
       {




More information about the umbrello-devel mailing list