Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"using namespace" for Doxygen comments

All classes of my library are defined within a namespace. When I create a mainpage for Doxygen I have to explicitly use this namespace within comments to make Doxygen generate links. I would like to use something like "using namespace" for the whole comment block.

An example:

/**
* \mainpage My Library
*
* Use MyLibraryNamespace::MyClass to ...
*/

Here Doxygen automatically generates a link to the documentation of MyLibraryNamespace::MyClass.

/**
* \mainpage My Library
*
* Use MyClass to ...
*/

Here Doxygen does not generate a link to the documentation of MyLibraryNamespace::MyClass (as there might be multiple MyClass definitions in different namespaces I suppose). To ease the reading I would like to omit the namespace prefix in the comment. Is that possible without having to type \ref MyLibraryNamespace::MyClass "MyClass" every time?

like image 380
Stephan Avatar asked Mar 23 '10 10:03

Stephan


1 Answers

You can make this work for one namespace by putting your comment inside the namespace. This bugs me considerably as we have multiple nested namespaces and I hate having to use them in Doxygen comments.

namespace MyLibraryNamespace {
/**
* \mainpage My Library
*
* Use MyClass to ...
*/
};

2016 Update from Markdown Perspective

I'm using Doxygen for the C# docs for Realm (yes Doxygen handles the typical C# XML comment format too!). The Markdown main page uses the @ref to refer to namespaced classes:

The main classes you will use are:

- [Realm](@ref Realms.Realm)
- [RealmObject](@ref Realms.RealmObject)
- [RealmList](@ref Realms.RealmList)
- [Transaction](@ref Realms.Transaction)

You can see a rendered version online here

like image 188
Andy Dent Avatar answered Sep 19 '22 14:09

Andy Dent