From kde-commits Sat Jul 04 17:32:07 2009 From: Pino Toscano Date: Sat, 04 Jul 2009 17:32:07 +0000 To: kde-commits Subject: KDE/kdelibs/kdecore/kconfig_compiler Message-Id: <1246728727.667630.30231.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124672873609886 SVN commit 991355 by pino: output the body of default value getters always in the cpp their value could rely on stuff included in the implementation only, so not available when inlining them M +23 -27 kconfig_compiler.cpp --- trunk/KDE/kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp #991354:991355 @@ -1624,19 +1624,7 @@ h << " " << getDefaultFunction(n) << "("; if ( !(*itEntry)->param().isEmpty() ) h << " " << cppType( (*itEntry)->paramType() ) <<" i "; - h << ")" << Const; - // function body inline only if not using dpointer - // for BC mode - if ( !dpointer ) - { - h << endl << " {" << endl; - h << indent(memberGetDefaultBody(*itEntry), 4 ); - h << " }" << endl; - } - else - { - h << ";" << endl; - } + h << ")" << Const << ";" << endl; } // Item accessor @@ -2102,20 +2090,7 @@ cpp << indent(memberAccessorBody( *itEntry ), 2); cpp << "}" << endl << endl; - // Default value Accessor - if (!(*itEntry)->defaultValue().isEmpty()) { - if (useEnumTypes && t == "Enum") - cpp << enumType(*itEntry); - else - cpp << cppType(t); - cpp << " " << getDefaultFunction(n, className) << "("; - if ( !(*itEntry)->param().isEmpty() ) - cpp << " " << cppType( (*itEntry)->paramType() ) <<" i "; - cpp << ")" << Const << endl; - cpp << endl << "{" << endl; - cpp << memberGetDefaultBody(*itEntry); - cpp << "}" << endl << endl; - } + // Default value Accessor -- written by the loop below // Item accessor if ( itemAccessors ) @@ -2136,6 +2111,27 @@ } } + // default value getters always go in Cpp + for( itEntry = entries.constBegin(); itEntry != entries.constEnd(); ++itEntry ) { + QString n = (*itEntry)->name(); + QString t = (*itEntry)->type(); + + // Default value Accessor + if (!(*itEntry)->defaultValue().isEmpty()) { + if (useEnumTypes && t == "Enum") + cpp << enumType(*itEntry); + else + cpp << cppType(t); + cpp << " " << getDefaultFunction(n, className) << "("; + if ( !(*itEntry)->param().isEmpty() ) + cpp << " " << cppType( (*itEntry)->paramType() ) <<" i "; + cpp << ")" << Const << endl; + cpp << "{" << endl; + cpp << memberGetDefaultBody(*itEntry) << endl; + cpp << "}" << endl << endl; + } + } + // Destructor cpp << className << "::~" << className << "()" << endl; cpp << "{" << endl;