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.
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.
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.
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.
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?
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 #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!