Forwarding headers for kdelibs
Hamish Rodda
rodda at kde.org
Mon Oct 2 14:02:40 BST 2006
Hi,
Just wanted to let you know I've started work on creating forwarding headers
for kdelibs classes, to support Qt4 style includes on kde classes. This can
of course be extended to any other kde library.
My generator uses both the build system and a c++ parser (Roberto's
kdevelop-pg like c++ parser, which will be in kdevelop4). This means that
the generated headers should be correct, even down to only generating headers
for exported classes only. (There is a problem at the moment because I am
not parsing other included headers, and thus macros can get in the way of
correct parsing, but I intend to fix this.)
To try these headers out, you can eg. symlink the directory
(branches/work/forwardingincludes) to kdelibs/includes, and then add the
add_subdirectory line to the top CMakeLists.txt file. The includes are then
installed under <yourkde4includedir>/KDE, so that includes like the following
should work:
#include <KDE/KConfig>
or, if you also put the include/KDE dir into your include_directories
statement,
#include <KConfig>
Namespaces are handled with subdirectories, eg:
#include <KDE/KTextEditor/Cursor>
(or just #include <KTextEditor/Cursor> with the extra include_directories
statement)
Currently, I'm not generating forwarding includes for subclasses, as you can't
have a directory and a file with the same name (eg. #include <KStyle> and
#include <KStyle/Option> couldn't both work)
The generator app is at trunk/KDE/kdevelop/languages/cpp/parser/headergen (to
compile, enable tests). To use this yourself, you'd need a patched cmake
(Matt Rogers is working on an xml generator for cmake, and I modified it a
bit). Down the track I expect a variant of this patch will be merged into
cmake so that anyone can then do the header generation themselves.
Feedback welcome...
Cheers,
Hamish.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061002/1ac1b2a4/attachment.sig>
More information about the kde-core-devel
mailing list