Bug 108223 - failure in C++ Code generation
Summary: failure in C++ Code generation
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-27 16:19 UTC by Rüdiger Ranft
Modified: 2005-06-27 21:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Hack to get around the problems (2.73 KB, patch)
2005-06-27 16:22 UTC, Rüdiger Ranft
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rüdiger Ranft 2005-06-27 16:19:27 UTC
Version:           1.4.89 (using KDE 3.2.1, SuSE)
Compiler:          gcc version 3.3.3 (SuSE Linux)
OS:                Linux (i686) release 2.6.4-52-esa

The C++ generator places the UML mnemonics (+-#) instead of correct keywords into the generated clases.

Also the Unidirectional association sems to be broken, since the header of the referring element gets included into the header of the base element.
Comment 1 Rüdiger Ranft 2005-06-27 16:22:10 UTC
Created attachment 11603 [details]
Hack to get around the problems

Apply with pach -p1 <Patch
from $(top_srcdir)

Changes:
codegenerator.cpp: removed the inclusion of the object where the
Uml::at_UniAssociation points to from the output list, since this would
lead to an wrong include list.

umlobject.h: Changed the default namespace seperator to "::", but this
is more a hack, since I 've no clue where to get the information about
the currently selected output language and their seperator string.

codegenerators/cppheaderclassdeclarationblock.cpp: changed the mnemonic
parameter to false, since my c++ compiler refuses to compile "class x: +
y{}; " ;). It seems to me, this parameter were added while some other
code already exists which depends on the old method signature. So I
guess the other generators might also be broken by the same bug.
Comment 2 Oliver Kellogg 2005-06-27 20:55:35 UTC
Yow! This one is on me.
Comment 3 Oliver Kellogg 2005-06-27 21:34:23 UTC
SVN commit 429465 by okellogg:

Patch by Rüdiger Ranft (kdebugs_AT_rranft1.mail.htwm.de) fixes various
C++ code generation problems.
BUG:108223


 M  +2 -2      ChangeLog  
 M  +8 -3      umbrello/codegenerator.cpp  
 M  +1 -1      umbrello/codegenerators/cppheaderclassdeclarationblock.cpp  
 M  +1 -1      umbrello/codegenerators/cppsourcecodeclassfielddeclarationblock.cpp  
 M  +1 -1      umbrello/codegenerators/cppwriter.cpp  
 M  +1 -1      umbrello/umlobject.cpp  
 M  +1 -1      umbrello/umlobject.h  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #429464:429465
@@ -5,12 +5,12 @@
 * Change interface into class and vice versa (if abstract and no attributes)
 
 * Bugs fixed / wishes implemented (see http://bugs.kde.org)
-57588 67719 79433 87252 88117 105564 107551
+57588 67719 79433 87252 88117 105564 108223
 
 Version 1.4.2 (maintenance release)
 
 * Bugs fixed from http://bugs.kde.org :
-72016 103170 106356 106632 106673
+72016 103170 106356 106632 106673 107551
 
 Version 1.4.1 (maintenance release)
 
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerator.cpp #429464:429465
@@ -599,10 +599,15 @@
 				// These typically DONT have a rolename specified. Oh well, we
 				// shall include it. The individual code generators will need to know
 				// what to do with a "role-less" uni-associated classifier. -b.t.
-				if(a->getWidgetID(Uml::A)!=c->getID())
-					temp = (UMLClassifier*)m_document->findObjectById(a->getWidgetID(Uml::A));
-				else if(a->getWidgetID(Uml::B)!=c->getID())
+				/* if(a->getWidgetID(Uml::A)!=c->getID()){
+//					temp = (UMLClassifier*)m_document->findObjectById(a->getWidgetID(Uml::A));
+					// Remove the link from child->base, since it breaks
+					// C++ code generation.
+				}
+				else */
+				if(a->getWidgetID(Uml::B)!=c->getID()){
 					temp = (UMLClassifier*)m_document->findObjectById(a->getWidgetID(Uml::B));
+				}
 				break;
 			case Uml::at_Aggregation:
 			case Uml::at_Composition:
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppheaderclassdeclarationblock.cpp #429464:429465
@@ -127,7 +127,7 @@
 		startText.append(" : ");
 	for (UMLClassifier * concept= superclasses.first(); concept; concept = superclasses.next())
 	{
-		startText.append(Umbrello::scopeToString(concept->getScope())+" "+parentDoc->getCPPClassName(concept->getName()));
+		startText.append(Umbrello::scopeToString(concept->getScope(), false)+" "+parentDoc->getCPPClassName(concept->getName()));
 		if(i != (nrof_superclasses-1))
 		      startText.append(", ");
 		i++;
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppsourcecodeclassfielddeclarationblock.cpp #429464:429465
@@ -53,7 +53,7 @@
 
         // Set the body
         QString staticValue = getParentObject()->getStatic() ? "static " : "";
-        QString scopeStr = Umbrello::scopeToString(getParentObject()->getScope());
+        QString scopeStr = Umbrello::scopeToString(getParentObject()->getScope(), false);
 
         QString typeName = jcf->getTypeName();
         QString fieldName = jcf->getFieldName();
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppwriter.cpp #429464:429465
@@ -539,7 +539,7 @@
         //write documentation
         if(forceDoc() || list->count() > 0)
         {
-                QString strVis = capitalizeFirstLetter(Umbrello::scopeToString(visibility));
+                QString strVis = capitalizeFirstLetter(Umbrello::scopeToString(visibility, false));
                 QString strStatic = writeStatic ? "Static ":"";
                 writeComment(strStatic+strVis+" attributes",getIndent(), stream);
                 writeComment(" ",getIndent(), stream);
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.cpp #429464:429465
@@ -110,7 +110,7 @@
 	return m_Name;
 }
 
-QString UMLObject::getFullyQualifiedName(const QString &separator /* = "." */) const {
+QString UMLObject::getFullyQualifiedName(const QString &separator /* = "::" */) const {
 	QString fqn;
 	if (m_pUMLPackage) {
 		fqn = m_pUMLPackage->getFullyQualifiedName(separator);
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.h #429464:429465
@@ -226,7 +226,7 @@
 	 * @param separator	The separator string to use.
 	 * @return	The fully qualified name of this UMLObject.
 	 */
-	virtual QString getFullyQualifiedName(const QString &separator = ".") const;
+	virtual QString getFullyQualifiedName(const QString &separator = "::" ) const;
 
 	/**
 	 * Returns the abstract state of the object.