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 ("rc"). The \ 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. \"header.h"\). The remaining entries in the XML file are grouped by the tag \ 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 \ tag should contain the code="true" attribute. The contents of the \ tag is then considered to be a C++ expression. Note that in this case you -might have to add an \ tag as described above so that the code -which computes the default value can be compiled. +might have to add an \ 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 \ tag. The contents of the \ tag is @@ -134,9 +137,19 @@ IncludeFiles comma separated list of strings - - Names of files to be included in the header of the generated class + 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 <...>. + SourceIncludeFiles + comma separated list of strings + - + 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 <...>. + + Mutators true, false or a comma separated list of options - --- 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 " << endl << endl; // Header required by singleton implementation