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

Andi Fischer andi.fischer at hispeed.ch
Mon Jan 30 20:52:33 UTC 2012


SVN commit 1276910 by fischer:

Small improvements to the C# code import.

 M  +15 -38    csharp/csharpimport.cpp  
 M  +4 -0      nativeimportbase.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/csharp/csharpimport.cpp #1276909:1276910
@@ -314,23 +314,6 @@
         return skipToClosing('{');
     }
 
-    if (keyword == "abstract") {
-        m_isAbstract = true;
-        return true;
-    }
-    if (keyword == "public") {
-        m_currentAccess = Uml::Visibility::Public;
-        return true;
-    }
-    if (keyword == "protected") {
-        m_currentAccess = Uml::Visibility::Protected;
-        return true;
-    }
-    if (keyword == "private") {
-        m_currentAccess = Uml::Visibility::Private;
-        return true;
-    }
-
     if ((keyword == "override") ||
             (keyword == "virtual") ||
             (keyword == "sealed")) {
@@ -527,24 +510,6 @@
     // move past ;
     skipStmt();
     return true;
-
-//     if (keyword == "package") {
-//         m_currentPackage = advance();
-//         const QString& qualifiedName = m_currentPackage;
-//         const QStringList names = qualifiedName.split('.');
-//         for (QStringList::ConstIterator it = names.begin(); it != names.end(); ++it) {
-//             QString name = (*it);
-//             log(keyword + ' ' + name);
-//             UMLObject *ns = Import_Utils::createUMLObject(UMLObject::ot_Package,
-//                             name, m_scope[m_scopeIndex], m_comment);
-//             m_scope[++m_scopeIndex] = static_cast<UMLPackage*>(ns);
-//         }
-//         if (advance() != ";") {
-//             uError() << "unexpected: " << m_source[m_srcIndex];
-//             skipStmt();
-//         }
-//         return true;
-//     }
 }
 
 /**
@@ -584,7 +549,7 @@
 
 /**
  * Check if keyword is belonging to a type-declaration.
- * @return   ...
+ * @return   result of check
  */
 bool CSharpImport::isTypeDeclaration(const QString& keyword)
 {
@@ -603,7 +568,7 @@
 
 /**
  * Check if keyword is a class-modifier.
- * @return   ...
+ * @return   result of check
  */
 bool CSharpImport::isClassModifier(const QString& keyword)
 {
@@ -611,6 +576,9 @@
         (keyword == "abstract")    ||
         (keyword == "sealed")) {
         // log("class-modifier: " + keyword);
+        if (keyword == "abstract") {
+            m_isAbstract = true;
+        }
         return true;
     }
     else {
@@ -620,7 +588,7 @@
 
 /**
  * Check if keyword is a interface, struct, enum or delegate modifier.
- * @return   ...
+ * @return   result of check
  */
 bool CSharpImport::isCommonModifier(const QString& keyword)
 {
@@ -629,6 +597,15 @@
         (keyword == "protected") ||
         (keyword == "internal")  ||
         (keyword == "private")) {
+        if (keyword == "public") {
+            m_currentAccess = Uml::Visibility::Public;
+        }
+        if (keyword == "protected") {
+            m_currentAccess = Uml::Visibility::Protected;
+        }
+        if (keyword == "private") {
+            m_currentAccess = Uml::Visibility::Private;
+        }
         return true;
     }
     else {
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/nativeimportbase.cpp #1276909:1276910
@@ -400,10 +400,14 @@
     m_srcIndex = 0;
     initVars();
     QTextStream stream(&file);
+    int lineCount = 0;
     while (! stream.atEnd()) {
         QString line = stream.readLine();
+        lineCount++;
         scan(line);
     }
+    log(nameWithoutPath, "file size: " + QString::number(file.size()) +
+                         " / lines: " + QString::number(lineCount));
     file.close();
     // Parse the QStringList m_source.
     m_klass = NULL;




More information about the umbrello-devel mailing list