[Qt-creator] Use of namespaces in Qt Creator's own code

Oswald Buddenhagen oswald.buddenhagen at digia.com
Tue Jul 9 13:35:26 CEST 2013


On Tue, Jul 09, 2013 at 12:51:51PM +0200, Ziller Eike wrote:
> 
> On 09.07.2013, at 11:11, Oswald Buddenhagen <oswald.buddenhagen at digia.com> wrote:
> 
> > On Mon, Jul 08, 2013 at 09:01:56PM +0200, André Pönitz wrote:
> >> (b) Lower case outermost namespace
> >> Contra:
> >>  - It works as it is.
> >> 
> > - it's non-qt
> 
> I don't see the point, Qt doesn't use namespaces at all. So going the Qt way would be to remove all namespacing...
> 
orly?
namespace Ui (any uic-generated file)
namespace QtPrivate (lots of internals, obviously)
namespace QDBus
namespace QTest
namespace QtConcurrent
namespace QPatternist

i got bored at this point ...

> > to solve the clash problem, there are two approaches:
> > - use an additional convention (ugly)
> >  - FooNames::Foo
> >  - Foo::FooClass
> > - remove the redundancy
> >  - Foo::Plugin
> 
> The clash is with things like CppEditor::CppEditor.
>
maybe the problem is the namespace name then?
the vcs plugins don't have any suffix. maybe the same should be done for
the laguage plugins.
or, because the namespace belongs to the plugin, name it
CppEditorPlugin. of course this would then produce
CppEditorPlugin::Plugin ...
yet another option would be "big endian" notation for the plugin names:
EditorCpp, VcsGit, ProjectManagerQmake, etc. a bit unnatural, but sorts
nicely (easier to catch omissions during refactoring), and is profoundly
distinct from the class naming convention.




More information about the Qt-creator mailing list