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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kconfig_compiler
From:       Marco Gulino <marco () kmobiletools ! org>
Date:       2007-05-14 20:34:36
Message-ID: 1179174876.701093.4715.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 664767 by gulino:

Allowing to force QString as filename argument, and apidox.


 M  +6 -1      README.dox  
 M  +10 -4     kconfig_compiler.cpp  


--- trunk/KDE/kdelibs/kdecore/kconfig_compiler/README.dox #664766:664767
@@ -175,8 +175,13 @@
   the return value of accessor functions and for the parameter of mutator
   functions. This eliminates the need to cast accessor return values to the enum
   type if you want to use the enum type in your own code. If set to false,
-  accessor return values and mutator parameters will be of type int.
+  accessor return values and mutator parameters will be of type int.</td>
 </tr>
+<tr>
+  <td><b>ForceStringFilename</b></td>
+  <td>bool</td>
+  <td>false</td>
+  <td>If set to true, forces the first parameter of the generated class to be a \
QString when using an argument for the filename. This is useful to specify at runtime \
the filename of the configuration class.</td>  </table>
 
 
--- trunk/KDE/kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp #664766:664767
@@ -1139,6 +1139,7 @@
   QString inherits = codegenConfig.value("Inherits").toString();
   QString visibility = codegenConfig.value("Visibility").toString();
   if (!visibility.isEmpty()) visibility+=' ';
+  bool forceStringFilename = codegenConfig.value("ForceStringFilename", \
false).toBool();  bool singleton = codegenConfig.value("Singleton", false).toBool();
   bool staticAccessors = singleton;
   //bool useDPointer = codegenConfig.readEntry("DPointer", false);
@@ -1404,13 +1405,18 @@
    h << " };" << dec << endl;
   }
   h << endl;
-
   // Constructor or singleton accessor
   if ( !singleton ) {
     h << "    " << className << "(";
     if (cfgFileNameArg)
-       h << " KSharedConfig::Ptr config"
-         << (parameters.isEmpty() ? " = KGlobal::config()" : ", ");
+    {
+        if(forceStringFilename)
+            h << " const QString &cfgfilename"
+                << (parameters.isEmpty() ? " = QString()" : ", ");
+        else
+            h << " KSharedConfig::Ptr config"
+                << (parameters.isEmpty() ? " = KGlobal::config()" : ", ");
+    }
     for (QList<Param>::ConstIterator it = parameters.begin();
          it != parameters.end(); ++it)
     {
@@ -1749,7 +1755,7 @@
   // Constructor
   cpp << className << "::" << className << "( ";
   if ( cfgFileNameArg ) {
-    if ( !singleton )
+    if ( !singleton && ! forceStringFilename)
       cpp << " KSharedConfig::Ptr config";
     else
       cpp << " const QString& config";


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

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