[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sun May 27 13:09:48 UTC 2007


SVN commit 668743 by okellogg:

merge r667186:668653 from branches/KDE/3.5

 M  +4 -0      ChangeLog  
 M  +26 -9     umbrello/codegenerators/pythonwriter.cpp  
 M  +9 -0      umbrello/codegenerators/pythonwriter.h  
 M  +3 -3      umbrello/codeimport/cppimport.cpp  
 M  +1 -1      umbrello/docgenerators/xhtmlgenerator.cpp  
 M  +6 -0      umbrello/docgenerators/xmi2docbook.xsl  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #668742:668743
@@ -1,8 +1,12 @@
 Version 1.5.71
 
 * Bugs/wishes from http://bugs.kde.org:
+* Preprocessor keywords ignored which causes endless loop in code import (119125)
 * Unstable saves and loads, class names become dirty (145709)
 * Crash on deleting class in list view (145762)
+* Class attribute documentation not generated for python (145916)
+* Python code generator does not wrap lines properly (145918)
+* Attribute documentation not generated for 'Export to XHTML' (145972)
 
 Version 1.5.7
 
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.cpp #668742:668743
@@ -30,6 +30,7 @@
 #include "../association.h"
 #include "../attribute.h"
 #include "../classifier.h"
+#include "../attribute.h"
 #include "../operation.h"
 #include "../umlnamespace.h"
 
@@ -134,15 +135,18 @@
 
     h<<(superclasses.count() > 0 ? ")":"")<<":"<<m_endl<<m_endl;
 
-    if(forceDoc() || !c->getDoc().isEmpty()) {
-        h<<m_indentation<<"\"\"\""<<m_endl;
-        h<<m_indentation<<c->getDoc()<<m_endl;
-        h<<m_indentation<<":version:"<<m_endl;
-        h<<m_indentation<<":author:"<<m_endl;
-        h<<m_indentation<<"\"\"\""<<m_endl<<m_endl;
+    if (forceDoc() || !c->getDoc().isEmpty()) {
+        h << m_indentation << "\"\"\"" << m_endl;
+        h << formatDoc(c->getDoc(), m_indentation + ' ') << m_endl;
+        h << m_indentation << ":version:" << m_endl;
+        h << m_indentation << ":author:" << m_endl;
+        h << m_indentation << "\"\"\"" << m_endl << m_endl;
         m_bNeedPass = false;
     }
 
+    // attributes
+    writeAttributes(c->getAttributeList(), h);
+
     //operations
     writeOperations(c,h);
 
@@ -161,8 +165,21 @@
 ////////////////////////////////////////////////////////////////////////////////////
 //  Helper Methods
 
-void PythonWriter::writeOperations(UMLClassifier *c,QTextStream &h) {
+void PythonWriter::writeAttributes(UMLAttributeList atList, QTextStream &py) {
+    if (!forceDoc() || atList.count() == 0)
+        return;
+    py << m_indentation << "\"\"\" ATTRIBUTES" << m_endl << m_endl;
+    for (UMLAttribute *at = atList.first(); at; at = atList.next()) {
+        py << formatDoc(at->getDoc(), m_indentation + ' ') << m_endl;
+        Uml::Visibility vis = at->getVisibility();
+        py << m_indentation << cleanName(at->getName()) << "  ("
+            << vis.toString() << ")" << m_endl << m_endl ;
+    } // end for
+    py << m_indentation << "\"\"\"" << m_endl << m_endl;
+}
 
+void PythonWriter::writeOperations(UMLClassifier *c, QTextStream &h) {
+
     //Lists to store operations  sorted by scope
     UMLOperationList oppub,opprot,oppriv;
 
@@ -247,8 +264,8 @@
 
         if( writeDoc )  //write method documentation
         {
-            h<<m_indentation<<m_indentation<<"\"\"\""<<m_endl;
-            h<<m_indentation<<m_indentation<<op->getDoc()<<m_endl<<m_endl;
+            h << m_indentation << m_indentation << "\"\"\"" << m_endl;
+            h << formatDoc(op->getDoc(), m_indentation + m_indentation + ' ') << m_endl;
 
             for (at = atl.first(); at; at = atl.next())  //write parameter documentation
             {
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.h #668742:668743
@@ -20,6 +20,7 @@
 #define PYTHONWRITER_H
 
 #include "simplecodegenerator.h"
+#include "../umlattributelist.h"
 #include "../umloperationlist.h"
 
 enum Access {PRIVATE, PUBLIC, PROTECTED};
@@ -54,6 +55,14 @@
 private:
 
     /**
+     * write all attributes for a given class
+     *
+     * @param c   the concept we are generating code for
+     * @param py  output stream for the header file
+     */
+    void writeAttributes(UMLAttributeList atList, QTextStream &py);
+
+    /**
       * write all operations for a given class
       *
       * @param c the concept we are generating code for
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/cppimport.cpp #668742:668743
@@ -50,6 +50,9 @@
 CppImport::~CppImport() {}
 
 void CppImport::feedTheModel(const QString& fileName) {
+    if (ms_seenFiles.find(fileName) != ms_seenFiles.end())
+        return;
+    ms_seenFiles.append(fileName);
     QMap<QString, Dependence> deps = ms_driver->dependences(fileName);
     if (! deps.empty()) {
         QMap<QString, Dependence>::Iterator it;
@@ -67,9 +70,6 @@
                 feedTheModel(includeFile);
         }
     }
-    if (ms_seenFiles.find(fileName) != ms_seenFiles.end())
-        return;
-    ms_seenFiles.append(fileName);
     TranslationUnitAST *ast = ms_driver->translationUnit( fileName );
     if (ast == NULL) {
         kError() << "CppImport::feedTheModel: " << fileName << " not found" << endl;
--- trunk/KDE/kdesdk/umbrello/umbrello/docgenerators/xhtmlgenerator.cpp #668742:668743
@@ -1,5 +1,5 @@
 /***************************************************************************
- *                        xhtmlgenerator.cpp  -  description             *
+ *                        xhtmlgenerator.cpp  -  description               *
  *                           -------------------                           *
  *  copyright            : (C) 2006 by Gael de Chalendar (aka Kleag)       *
  *    (C) 2006 Umbrello UML Modeller Authors <uml-devel at uml.sf.net>        *
--- trunk/KDE/kdesdk/umbrello/umbrello/docgenerators/xmi2docbook.xsl #668742:668743
@@ -666,6 +666,12 @@
       <xsl:value-of select="@name"/>
       </entry>
   </row>
+
+  <row>
+      <entry role="comment"/>
+      <entry namest="c2" nameend="c3" role="comment"><xsl:value-of select="@comment"/></entry>
+  </row>
+
 </xsl:template>
 
 




More information about the umbrello-devel mailing list