Bug 85553 - accessor methods are private instead of public
Summary: accessor methods are private instead of public
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.2.1
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-20 13:32 UTC by Florian Hackenberger
Modified: 2006-10-13 06:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Hackenberger 2004-07-20 13:32:05 UTC
Version:           1.2.1 (using KDE 3.2.1, Gentoo)
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)
OS:                Linux (i686) release 2.6.7-gentoo-r5

When generating c++ code, accessors of protected or private members are set to protected/private too. They should be public, otherwise they are useless.
Comment 1 Sebastian Stein 2004-08-13 09:16:07 UTC
I already looked a little bit into this problem. Accessor methods are generated from the attributes and get the scope of the attribute. So if you have a public attribute, you will also get a public accessor method. Nevertheless, I didn't found a way how to fix this yet.
Comment 2 Henrik Steffien 2005-01-16 22:01:51 UTC
The problem still exists in version 1.4.0-beta1. (compiled from source tarball from 2005-01-15 05:07).
With this behaviour accessor methods are completely useless.
Please try to fix it.
Comment 3 march 2005-05-15 17:38:40 UTC
There is also a problem if you don't want accessor method, it is not possible. If you select it in the umbrello configuration menu it takes no effect. 
So please try to fix the accesor bug.
Comment 4 chenpuning 2006-10-11 11:30:37 UTC
This bug is still present in 1.5.4. A similar bug in Java code generator has been fixed according to #59049 more than 3 years ago. Can we have this C++ code generation bug fixed also?
Comment 5 Oliver Kellogg 2006-10-11 20:42:54 UTC
SVN commit 594617 by okellogg:

writeHeaderAttributeAccessorMethods(): Switch to public if need be.
BUG:85553


 M  +5 -0      ChangeLog  
 M  +7 -2      umbrello/codegenerators/cppwriter.cpp  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #594616:594617
@@ -1,3 +1,8 @@
+Version 2.0
+
+* Bugs/wishes from http://bugs.kde.org:
+* Accessor methods are private instead of public (85553)
+
 Version 1.5.5
 
 * PHP5 generator creates stub methods for all interfaces a class implements (C. Brunsdon)
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppwriter.cpp #594616:594617
@@ -552,8 +552,6 @@
 
     }
 
-    return;
-
 }
 
 void CppWriter::writeHeaderAttributeAccessorMethods (Uml::Visibility visibility, bool writeStatic, QTextStream &stream )
@@ -585,9 +583,16 @@
         break;
     }
 
+    // switch to public
+    if (visibility != Uml::Visibility::Public)
+        stream << "public:" << m_endl << m_endl;
+
     // write accessor methods for attribs we found
     writeAttributeMethods(list, visibility, true, false, INLINE_ATTRIBUTE_METHODS, stream);
 
+    // switch back to previous vis.
+    if (visibility != Uml::Visibility::Public)
+        stream << visibility.toString() << ":" << m_endl << m_endl;
 }
 
 // this is for writing *source* or *header* file attribute methods
Comment 6 Oliver Kellogg 2006-10-13 06:40:38 UTC
> Comment #4 From chenpuning@gmail.com  
> [...] A similar bug in Java code generator has been fixed [...]
> more than 3 years ago. Can we have this C++ code generation bug
> fixed also?

The bug fixing is so slow because there aren't enough contributors.
I've said this many times: Please everybody consider contributing!