[Uml-devel] kdesdk/umbrello/umbrello/codegenerators

Brian Thomas thomas at mail630.gsfc.nasa.gov
Mon Apr 19 10:08:23 UTC 2004


CVS commit by thomas: 

bug fix/minor feature : cpp and Java codeoperation classes appended extra auto-generationed documentation incorrectly. Now users comments are preserved correctly. Also added @return documentation for Javacode ops


  M +11 -8     cppheadercodeoperation.cpp   1.12
  M +17 -9     javacodeoperation.cpp   1.13


--- kdesdk/umbrello/umbrello/codegenerators/javacodeoperation.cpp  #1.12:1.13
@@ -45,13 +45,4 @@ void JavaCodeOperation::updateMethodDecl
         QString endLine = getNewLineEndingChars();
 
-        // first, the comment on the operation
-        QString comment = o->getDoc();
-        UMLAttributeList* paramaters = o->getParmList();
-        for(UMLAttributeListIt iterator(*paramaters); iterator.current(); ++iterator) {
-                comment += endLine + "@param " + iterator.current()->getName() + " ";
-                comment += iterator.current()->getDoc();
-        }
-        getComment()->setText(comment);
-
         // now, the starting text.
         QString strVis = javadoc->scopeToJavaDecl(o->getScope());
@@ -91,4 +82,21 @@ void JavaCodeOperation::updateMethodDecl
         setStartMethodText(startText);
 
+        // Lastly, for text content generation, we fix the comment on the 
+        // operation, IF the codeop is autogenerated & currently empty
+        QString comment = o->getDoc();
+        if(comment.isEmpty() && getContentType() == CodeBlock::AutoGenerated)
+        {
+                UMLAttributeList* paramaters = o->getParmList();
+                for(UMLAttributeListIt iterator(*paramaters); iterator.current(); ++iterator) {
+                        comment += endLine + "@param " + iterator.current()->getName() + " ";
+                        comment += iterator.current()->getDoc();
+                }
+                // add a returns statement too
+                if(!returnType.isEmpty())
+                        comment += endLine + "@return " + returnType + " ";
+                getComment()->setText(comment);
+        }
+
+
         // In Java, for interfaces..we DONT write out non-public 
         // method declarations.

--- kdesdk/umbrello/umbrello/codegenerators/cppheadercodeoperation.cpp  #1.11:1.12
@@ -60,6 +60,8 @@ void CPPHeaderCodeOperation::updateMetho
         QString endLine = getNewLineEndingChars();
 
-        // first, the comment on the operation
+        // first, the comment on the operation, IF its autogenerated/empty
         QString comment = o->getDoc();
+        if(comment.isEmpty() && getContentType() == CodeBlock::AutoGenerated)
+        {
         UMLAttributeList* paramaters = o->getParmList();
         for(UMLAttributeListIt iterator(*paramaters); iterator.current(); ++iterator) {
@@ -68,4 +70,5 @@ void CPPHeaderCodeOperation::updateMetho
         }
         getComment()->setText(comment);
+        }
 
         // no return type for constructors






More information about the umbrello-devel mailing list