Custom tags with Doxygen

Viewed 26322

I am trying to figure out if there is a way to create a custom tag using Doxygen. I did find the ALIAS configuration file option but that does not do exactly what I need. Basically in my code I want to be able to write something like

/// \req Requirement #322 - blah blah

And then have Doxygen create a list like it does for \bug and \todo commands for lines that have this custom tag. Is this possible with Doxygen?

3 Answers

The generalization of \bug and \todo is \xrefitem.

The solution I suggest is:

  • in Doxyfile:

    ALIASES += "req=\xrefitem req \"Requirement\" \"Requirements\" "
    
  • in documented code:

    /// \req #42 - The system shall work in any situation
    

Combining the two answers above, you can have a single clean requirement tag that will build a cross-reference table, and, also provide a direct link to the requirement repo in your docs:

Doxygen CONFIG file:

ALIASES = "requirement{1}=@xrefitem requirement \"Requirements\" \"Requirements Traceability\" <a href=\"http://your.requirementtool.com/browse/\1\">\1</a>"

Source code:

@requirement{REQ-123} Brief textual summary of this requirement item

This will render in the documentation as:

Requirements:

  • REQ-123 Brief textual summary of this requirement item
Related