cppsupportpart problem / small patch

Andreas Wuest AndreasWuest at gmx.de
Sat Dec 14 18:33:30 GMT 2002


Hi,

adding methods to a cpp class does not work properly
for me since every time i create a method a useless
"()" string is attached to the method declaration
and implementation, what i get looks like

void newMethod()();

void ClassName::newMethod()()
{
}


Looking at the code if found out that at the moment 
there are two methods that build the argument list
for a new created cpp class method. The methods are :

1.) CppAddMedthodDialog::getDecl ()
2.) some line in CppSupportPart::asHeaderCode and
    CppSupportPart::asCppCode

which one is the old and which one is the new
version (which is deprecated) ?? at the moment the code is created 
by 1.), the code of the 2.) is ignored because pm->arguments.count ()
always seems to be < 1, and because of that the else part is
executed (attaches the obsolete "()").
Removing that piece of code in the asHeaderCode and asCppCode in
the CppSupportPart fixes the problem for me (see attached
patch).
btw. i am using the lastet code from cvs.

Bye,

 Andreas 


-- 
The difference between theory and practice, is that in theory, 
there is no difference between theory and practice
-------------- next part --------------
Index: cppsupportpart.cpp
===================================================================
RCS file: /home/kde/kdevelop/parts/cppsupport/cppsupportpart.cpp,v
retrieving revision 1.71
diff -u -p -r1.71 cppsupportpart.cpp
--- cppsupportpart.cpp	14 Dec 2002 15:54:07 -0000	1.71
+++ cppsupportpart.cpp	14 Dec 2002 18:16:23 -0000
@@ -733,7 +733,8 @@ QString CppSupportPart::asHeaderCode(Par
     str += pm->type();
     str += " ";
     str += pm->name();
-    
+
+    /*   
     if( pm->arguments.count() > 0 ) {
 	str += "( ";
         for ( ParsedArgument* arg = pm->arguments.first(); arg != NULL; arg = pm->arguments.next() ) {
@@ -746,6 +747,7 @@ QString CppSupportPart::asHeaderCode(Par
     } else {
         str += "()";
     }
+    */
 
     if (pm->isConst())
         str += " const";
@@ -777,6 +779,7 @@ QString CppSupportPart::asCppCode(Parsed
     }
     str += pm->name();
 
+    /*
     if( pm->arguments.count() > 0 ) {
 	str += "( ";
         for ( ParsedArgument* arg = pm->arguments.first(); arg != NULL; arg = pm->arguments.next() ) {
@@ -789,6 +792,7 @@ QString CppSupportPart::asCppCode(Parsed
     } else {
         str += "()";
     }
+    */
     
     if (pm->isConst())
         str += " const";


More information about the KDevelop mailing list