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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kconfig_compiler
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2007-10-06 14:07:29
Message-ID: 1191679649.637787.24296.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 722053 by djarvie:

Add SourceFileIncludes option to .kcfgc file.
Allow #include "..." to be specified instead of #include <...>.


 M  +17 -4     README.dox  
 M  +18 -2     kconfig_compiler.cpp  


--- trunk/KDE/kdelibs/kdecore/kconfig_compiler/README.dox #722052:722053
@@ -19,7 +19,9 @@
 file ("<appname>rc").
 
 The \<include\> tags are optional and may contain C++ header files that
-are needed to compile the code needed to compute default values.
+are needed to compile the code needed to compute default values. To generate
+a #include "..." statement instead of #include <...>, enclose the header
+file name in double quotes (e.g. \<include\>"header.h"\</include\>).
 
 The remaining entries in the XML file are grouped by the tag \<group\> 
 which describes the corresponding group in the configuration file.
@@ -56,8 +58,9 @@
 or if it needs to be obtained from a function call, the \<default\> tag
 should contain the code="true" attribute. The contents of the \<default\>
 tag is then considered to be a C++ expression. Note that in this case you
-might have to add an \<include\> tag as described above so that the code
-which computes the default value can be compiled.
+might have to add an \<include\> tag as described above, or a
+SourceIncludeFiles entry in the .kcfgc file as described below, so that the
+code which computes the default value can be compiled.
 
 Additional code for computing default values can be provided outside any
 entry definition via the \<code\> tag. The contents of the \<code\> tag is
@@ -134,9 +137,19 @@
   <td><b>IncludeFiles</b></td>
   <td>comma separated list of strings</td>
   <td>-</td>
-  <td>Names of files to be included in the header of the generated class</td>
+  <td>Names of files to be included in the header of the generated class. Enclose a
+  file name in (escaped) double quotes to generate #include "..." instead of
+  #include <...>.</td>
 </tr>
 <tr>
+  <td><b>SourceIncludeFiles</b></td>
+  <td>comma separated list of strings</td>
+  <td>-</td>
+  <td>Names of files to be included in the source file of the generated class. Enclose
+  a file name in (escaped) double quotes to generate #include "..." instead of
+  #include <...>.</td>
+</tr>
+<tr>
   <td><b>Mutators</b></td>
   <td>true, false or a comma separated list of options</td>
   <td>-</td>
--- trunk/KDE/kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp #722052:722053
@@ -1173,6 +1173,7 @@
   bool customAddons = codegenConfig.value("CustomAdditions", false).toBool();
   QString memberVariables = codegenConfig.value("MemberVariables").toString();
   QStringList headerIncludes = codegenConfig.value("IncludeFiles", QStringList()).toStringList();
+  QStringList sourceIncludes = codegenConfig.value("SourceIncludeFiles", QStringList()).toStringList();
   QStringList mutators = codegenConfig.value("Mutators", QStringList()).toStringList();
   bool allMutators = false;
   if ((mutators.count() == 1) && (mutators.at(0).toLower() == "true"))
@@ -1333,7 +1334,10 @@
   // Includes
   QStringList::ConstIterator it;
   for( it = headerIncludes.begin(); it != headerIncludes.end(); ++it ) {
-    h << "#include <" << *it << ">" << endl;
+    if ( (*it).startsWith('"') )
+      h << "#include " << *it << endl;
+    else
+      h << "#include <" << *it << ">" << endl;
   }
 
   if ( headerIncludes.count() > 0 ) h << endl;
@@ -1346,7 +1350,10 @@
 
   // Includes
   for( it = includes.begin(); it != includes.end(); ++it ) {
-    h << "#include <" << *it << ">" << endl;
+    if ( (*it).startsWith('"') )
+      h << "#include " << *it << endl;
+    else
+      h << "#include <" << *it << ">" << endl;
   }
 
   if ( !nameSpace.isEmpty() )
@@ -1687,6 +1694,15 @@
 
   cpp << "#include \"" << headerFileName << "\"" << endl << endl;
 
+  for( it = sourceIncludes.begin(); it != sourceIncludes.end(); ++it ) {
+    if ( (*it).startsWith('"') )
+      cpp << "#include " << *it << endl;
+    else
+      cpp << "#include <" << *it << ">" << endl;
+  }
+
+  if ( sourceIncludes.count() > 0 ) cpp << endl;
+
   if ( setUserTexts ) cpp << "#include <klocale.h>" << endl << endl;
 
   // Header required by singleton implementation
[prev in list] [next in list] [prev in thread] [next in thread] 

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