[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport

Oliver Kellogg okellogg at users.sourceforge.net
Sun Jan 14 19:21:55 UTC 2007


SVN commit 623418 by okellogg:

m_parsedFiles: Document changed usage. Hook up with parseFile().


 M  +8 -1      nativeimportbase.cpp  
 M  +6 -4      nativeimportbase.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/nativeimportbase.cpp #623417:623418
@@ -5,7 +5,7 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *  copyright (C) 2005-2006                                                *
+ *  copyright (C) 2005-2007                                                *
  *  Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                   *
  ***************************************************************************/
 
@@ -261,6 +261,11 @@
 }
 
 void NativeImportBase::parseFile(const QString& filename) {
+    QString nameWithoutPath = filename;
+    nameWithoutPath.remove(QRegExp("^.*/"));
+    if (m_parsedFiles.contains(nameWithoutPath))
+        return;
+    m_parsedFiles.append(nameWithoutPath);
     QString fname = filename;
     const QString msgPrefix = "NativeImportBase::parseFile(" + filename + "): ";
     if (filename.contains('/')) {
@@ -298,6 +303,7 @@
         kError() << msgPrefix << "cannot open file" << endl;
         return;
     }
+    kDebug() << msgPrefix << "parsing." << endl;
     // Scan the input file into the QStringList m_source.
     m_source.clear();
     m_srcIndex = 0;
@@ -325,6 +331,7 @@
            skipStmt();
         m_comment = QString();
     }
+    kDebug() << msgPrefix << "end of parse." << endl;
 }
 
 void NativeImportBase::initialize() {
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/nativeimportbase.h #623417:623418
@@ -5,7 +5,7 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *  copyright (C) 2005-2006                                                *
+ *  copyright (C) 2005-2007                                                *
  *  Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                   *
  ***************************************************************************/
 
@@ -172,7 +172,7 @@
     uint m_srcIndex;
 
     /**
-     * Stack of scopes.
+     * Stack of scopes for use by the specific importer.
      */
     UMLPackage *m_scope[32];
     /**
@@ -203,8 +203,10 @@
     bool m_isAbstract;
 
     /**
-     * List of parsed files. The exact syntax of the items
-     * stored here depend on the specific code importer.
+     * List of parsed files. Contains file names without paths.
+     * Before actually parsing a given file, NativeImportBase checks
+     * whether the name is already present in this list in order to
+     * avoid parsing the same file multiple times.
      */
     QStringList m_parsedFiles;
 




More information about the umbrello-devel mailing list