Bug 126489

Summary: Code generation wizard fails at generating C++ implementation code
Product: [Applications] umbrello Reporter: greatbunzinni
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.5.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description greatbunzinni 2006-04-29 22:21:49 UTC
Version:           1.5.2 (using KDE KDE 3.5.2)

The code generation wizard fails at generating C++ implementation code. Instead of generating the implementation of the class' methods,  the code generation wizard writes only the method's name and ommits the class name and the scope operator. For example:

instead of 
<code>
void testclass::testmethod()
{
}
</code>

The code generation wizard produces code like so:
<code>
void testmethod()
{
}
</code>
Comment 1 Oliver Kellogg 2006-04-30 17:46:13 UTC
How did you generate the code?
I can't confirm - but I only tried "Generate All Code" from the "Code" menu.
Comment 2 greatbunzinni 2006-04-30 22:50:35 UTC
I've generated the code through the code generation wizard from the  a class diagram which I've created with Umbrello. I tested it again and again the classes had no class name or reference operator. If you wish I can add the Umbrello file as an attachment.
Comment 3 Oliver Kellogg 2006-04-30 23:08:36 UTC
Ah, okay, now I see it.
Comment 4 Oliver Kellogg 2006-05-18 09:11:25 UTC
SVN commit 542071 by okellogg:

Constructor, updateMethodDeclaration(): The comment says
  // if a property has a friend stereotype, the operation should
  // not be a class name
but the code is not writen that way.
Thanks to Tobias Klein <lists_at_tklein.info> for spotting the problem at
http://www.geeksoc.org/~jr/umbrello/uml-devel/9495.html
BUG:126489


 M  +6 -6      cppsourcecodeoperation.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/cppsourcecodeoperation.cpp #542070:542071
@@ -76,11 +76,11 @@
     else if (returnType.isEmpty())
         returnType = QString("void");
 
+    QString startText = returnType + " ";
+
     // if a property has a friend stereotype, the operation should
     // not be a class name
-    QString startText = returnType + " ";
-
-    if (!o->getStereotype().isEmpty() && o->getStereotype(false) == "friend")
+    if (o->getStereotype() != "friend")
         startText += className + "::";
     startText += methodName + " ("+paramStr+")";
     if (o->getConst())
@@ -166,11 +166,11 @@
     else if (returnType.isEmpty())
         returnType = QString("void");
 
+    QString startText = returnType + " ";
+
     // if a property has a friend stereotype, the operation should
     // not be a class name
-    QString startText = returnType + " ";
-
-    if (!o->getStereotype().isEmpty() && o->getStereotype(false) == "friend")
+    if (o->getStereotype() != "friend")
         startText += className + "::";
     startText += methodName + " ("+paramStr+")";
     if (o->getConst())