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

Oliver Kellogg okellogg at users.sourceforge.net
Thu Aug 11 05:13:00 UTC 2005


SVN commit 445617 by okellogg:

fillSource(): Add comprehensibility.


 M  +17 -17    idlimport.cpp  
 M  +1 -1      idlimport.h  
 M  +7 -5      nativeimportbase.cpp  
 M  +3 -2      nativeimportbase.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/idlimport.cpp #445616:445617
@@ -103,35 +103,35 @@
             line = pre + post;
         }
     }
-    return false;  // Not done yet: There is still stuff to do.
+    return false;  // The input was not completely consumed by preprocessing.
 }
 
-void IDLImport::fillSource(QString lexeme) {
-    QString word;
-    const uint len = lexeme.length();
+void IDLImport::fillSource(QString word) {
+    QString lexeme;
+    const uint len = word.length();
     for (uint i = 0; i < len; i++) {
-        QChar c = lexeme[i];
+        QChar c = word[i];
         if (c.isLetterOrNumber() || c == '_') {
-            word += c;
-        } else if (c == ':' && lexeme[i + 1] == ':') {
-            // compress scoped name into word
-            word += "::";
+            lexeme += c;
+        } else if (c == ':' && word[i + 1] == ':') {
+            // compress scoped name into lexeme
+            lexeme += "::";
             i++;
         } else if (c == '<') {
-            // compress sequence or bounded string into word
+            // compress sequence or bounded string into lexeme
             do {
-                word += lexeme[i];
-            } while (lexeme[i] != '>' && ++i < len);
+                lexeme += word[i];
+            } while (word[i] != '>' && ++i < len);
         } else {
-            if (!word.isEmpty()) {
-                m_source.append(word);
-                word = QString::null;
+            if (!lexeme.isEmpty()) {
+                m_source.append(lexeme);
+                lexeme = QString::null;
             }
             m_source.append(c);
         }
     }
-    if (!word.isEmpty())
-        m_source.append(word);
+    if (!lexeme.isEmpty())
+        m_source.append(lexeme);
 }
 
 void IDLImport::parseFile(QString filename) {
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/idlimport.h #445616:445617
@@ -37,7 +37,7 @@
     /**
      * Implement abstract operation from NativeImportBase.
      */
-    void fillSource(QString lexeme);
+    void fillSource(QString word);
 
 protected:
     QString joinTypename();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/nativeimportbase.cpp #445616:445617
@@ -60,12 +60,12 @@
     line = line.simplifyWhiteSpace();
     if (line.isEmpty())
         return;
-    QStringList lexemes = QStringList::split( QRegExp("\\s+"), line );
-    for (QStringList::Iterator it = lexemes.begin(); it != lexemes.end(); ++it) {
-        QString lexeme = (*it).stripWhiteSpace();
-        if (lexeme.isEmpty())
+    QStringList words = QStringList::split( QRegExp("\\s+"), line );
+    for (QStringList::Iterator it = words.begin(); it != words.end(); ++it) {
+        QString word = (*it).stripWhiteSpace();
+        if (word.isEmpty())
             continue;
-        fillSource(lexeme);
+        fillSource(word);
     }
 }
 
@@ -75,6 +75,8 @@
             fileIT != fileList.end(); ++fileIT) {
         QString fileName = (*fileIT);
         umldoc->writeToStatusBar(i18n("Importing file: %1").arg(fileName));
+        m_source.clear();
+        m_srcIndex = 0;
         parseFile(fileName);
     }
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/nativeimportbase.h #445616:445617
@@ -74,10 +74,11 @@
     virtual bool preprocess(QString& line);
 
     /**
-     * Advance `m_srcIndex' and fill `m_source' given a single lexeme.
+     * Analyze the given word and fill `m_source'.
+     * A "word" is a whitespace delimited item from the input line.
      * To be provided by the specific importer class.
      */
-    virtual void fillSource(QString lexeme) = 0;
+    virtual void fillSource(QString word) = 0;
 
     /**
      * Advance m_srcIndex until m_souce[m_srcIndex] contains the lexeme




More information about the umbrello-devel mailing list