Directory organization for frameworks with a namespace

David Faure faure at kde.org
Wed Oct 24 22:13:23 UTC 2012


Our standard directory structure for frameworks is like
staging/kwidgets/src/dialogs/kdialog.h 
where "dialogs" is an arbitrary subdir name,
which works fine for such easy cases (#include <kdialog.h>)

But what about frameworks which want to use a namespace for their headers,
(#include <framework/foo.h>), like kjs and kio?

I solved the issue for kjs by using "kjs" as the name of the subdirectory:
tier1/kjs/src/kjs/

But in KIO, for source compat reasons, we want kio/job.h and 
kio/renamedialog.h although the first one will be in "kiocore" and the second 
in "kiowidgets". So a single subdir doesn't work.

I started to create a staging/kio/src/core but this will break "kio/job.h" 
from other public headers.

The only "quick" solution I can think of is
staging/kio/src/core/kio/ and
staging/kio/src/widgets/kio/
with nothing else under core and widgets, which looks a bit ugly.

The Qt solution would be to generate headers in staging/kio/include/kio
which forward to src/core and src/widgets ... but we don't have such a 
solution at hand AFAIK. Any volunteer? Should I write this?

Preferences?
Any other ideas?

I don't think we want <kiocore/job.h> because this is like <QtGui/QLineEdit>, 
which as we've seen creates stupid source incompatibilities in the long term.
A conceptual namespace, yes, but not an implementation detail shining through.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list