[Uml-devel] branches/work/soc-umbrello/umbrello

Andi Fischer andi.fischer at hispeed.ch
Tue Nov 29 07:30:28 UTC 2011


SVN commit 1266310 by fischer:

Codeimport for C# added. Intermediate version and still not working properly.

 M  +2 -0      CMakeLists.txt  
 M  +3 -0      codeimport/classimport.cpp  
 A             codeimport/csharp (directory)  
 A             codeimport/csharp/csharpimport.cpp   [License: GPL (v2+)]
 A             codeimport/csharp/csharpimport.h   [License: GPL (v2+)]
 M  +5 -2      codeimport/import_utils.cpp  
 M  +2 -2      codeimport/nativeimportbase.cpp  
 M  +0 -1      codeimport/nativeimportbase.h  
 M  +3 -0      codeimpwizard/codeimpselectpage.cpp  


--- branches/work/soc-umbrello/umbrello/CMakeLists.txt #1266309:1266310
@@ -43,6 +43,7 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/codegenerators/xml/
   ${CMAKE_CURRENT_SOURCE_DIR}/codegenwizard/
   ${CMAKE_CURRENT_SOURCE_DIR}/codeimport/
+  ${CMAKE_CURRENT_SOURCE_DIR}/codeimport/csharp/
   ${CMAKE_CURRENT_SOURCE_DIR}/codeimpwizard/
   ${CMAKE_CURRENT_SOURCE_DIR}/controller/
   ${CMAKE_CURRENT_SOURCE_DIR}/debug/
@@ -259,6 +260,7 @@
     codeimport/nativeimportbase.cpp
     codeimport/pascalimport.cpp
     codeimport/pythonimport.cpp
+    codeimport/csharp/csharpimport.cpp
 )
 
 if (WIN32 AND NOT MSVC)
--- branches/work/soc-umbrello/umbrello/codeimport/classimport.cpp #1266309:1266310
@@ -27,6 +27,7 @@
 #ifndef DISABLE_CPP_IMPORT
 #include "cppimport.h"
 #endif
+#include "csharpimport.h"
 #include "codeimpthread.h"
 
 /**
@@ -47,6 +48,8 @@
         classImporter = new AdaImport();
     else if (fileName.endsWith(QLatin1String(".pas")))
         classImporter = new PascalImport();
+    else if (fileName.endsWith(QLatin1String(".cs")))
+        classImporter = new CSharpImport(thread);
 #ifndef DISABLE_CPP_IMPORT
     else
         classImporter = new CppImport(thread);  // the default.
--- branches/work/soc-umbrello/umbrello/codeimport/import_utils.cpp #1266309:1266310
@@ -166,7 +166,6 @@
     QString name = inName;
     UMLDoc *umldoc = UMLApp::app()->document();
     UMLFolder *logicalView = umldoc->rootFolder(Uml::ModelType::Logical);
-    const Uml::ProgrammingLanguage pl = UMLApp::app()->activeLanguage();
     if (parentPkg == NULL) {
         // uDebug() << "Import_Utils::createUMLObject(" << name
         //     << "): parentPkg is NULL, assuming Logical View";
@@ -208,8 +207,9 @@
                         continue;
                     }
                     int wantNamespace = KMessageBox::Yes;
+                    const Uml::ProgrammingLanguage pl = UMLApp::app()->activeLanguage();
                     if (pl == Uml::ProgrammingLanguage::Cpp) {
-                        /* We know std and Qt are namespaces */
+                        // We know std and Qt are namespaces.
                         if (scopeName != "std" && scopeName != "Qt") {
                             wantNamespace = KMessageBox::questionYesNo(NULL,
                                         i18n("Is the scope %1 a namespace or a class?", scopeName),
@@ -302,6 +302,9 @@
         assoc->setUMLPackage(umldoc->rootFolder(Uml::ModelType::Logical));
         umldoc->addAssociation(assoc);
     }
+    if (o == NULL) {
+        uError() << "is NULL!";
+    }
     return o;
 }
 
--- branches/work/soc-umbrello/umbrello/codeimport/nativeimportbase.cpp #1266309:1266310
@@ -393,7 +393,7 @@
         uError() << msgPrefix << "cannot open file";
         return;
     }
-    log("parsing...");
+    log(nameWithoutPath, "parsing...");
     // Scan the input file into the QStringList m_source.
     m_source.clear();
     m_srcIndex = 0;
@@ -421,7 +421,7 @@
            skipStmt();
         m_comment.clear();
     }
-    log("...end of parse");
+    log(nameWithoutPath, "...end of parse");
 }
 
 /**
--- branches/work/soc-umbrello/umbrello/codeimport/nativeimportbase.h #1266309:1266310
@@ -120,4 +120,3 @@
 };
 
 #endif
-
--- branches/work/soc-umbrello/umbrello/codeimpwizard/codeimpselectpage.cpp #1266309:1266310
@@ -328,6 +328,9 @@
     case Uml::ProgrammingLanguage::Python:
         m_fileExtensions << "*.py" << "*.pyw";
         break;
+    case Uml::ProgrammingLanguage::CSharp:
+        m_fileExtensions << "*.cs";
+        break;
     default:
         break;
     }




More information about the umbrello-devel mailing list