Reputation: 315
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?
Upvotes: 15
Views: 3513
Reputation: 437
You can use alias like this:
ALIASES += refmylib{1}="@ref MyLibraryNamespace::\1 \"\1\""
This is an usage example:
/**
* \mainpage My Library
*
* Use @refmylib{MyClass} to ...
*/
And above will be processed by doxygen like this:
/**
* \mainpage My Library
*
* Use @ref MyLibraryNamespace::MyClass "MyClass" to ...
*/
Upvotes: 4
Reputation: 17969
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
Upvotes: 14