[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kconfig_compiler
From:       Pino Toscano <pino () kde ! org>
Date:       2009-07-04 17:32:07
Message-ID: 1246728727.667630.30231.nullmailer () svn ! kde ! org
[Download RAW message or body]

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;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic