Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documenting Macro Functions in C++ with Doxygen

Tags:

How do I document a macro function in C++ using Doxygen, and refer to it in the documentation of my non-Evil code?

More specifically, I have some regular class called "Message" defined in Message.H that users can inherit from to define their own messages. In another file ("MessageHelpers.H") I have a crazy macro like this:

//! Users must call this macro to register their messages... /*!     ...lest they be forced to type all sorts of boring and     error-prone boiler plate code.     blah blah blah... More specific documentation and explanation... */ #define REGISTER_MESSAGE_TYPE(MSGTYPE) \  do_some(MSGTYPE);                     \  seriously();                          \  crazy_stuff(MSGTYPE);                        

In the documentation for Message, I would love it if the phrase "REGISTER_MESSAGE_TYPE" could automatically become a link and point to my documentation for the macro. E.g.

//! A cool message class /*!     Users can inherit from this class to create their own cool messages.    Just be sure to call REGISTER_MESSAGE_TYPE after your class definition! */ class Message {   virtual void doSomeStuff(); }; 

Is this possible?

like image 599
rcv Avatar asked Dec 27 '10 23:12

rcv


People also ask

How do I document macros in Doxygen?

The section "Special Commands" lists the \def command, and the section "Automatic link generation" describes what you want to link to the macro. Use \def to document a macro separate from the declaration. Use #MACRO(params) to auto-link to said macro definition.

Does Doxygen support C#?

Doxygen supports most of the XML commands that are typically used in C# code comments. The XML tags are defined in Appendix D of the ECMA-334 standard, which defines the C# language.

How do I comment out a code in Doxygen C++?

To create a Doxygen comment from scratch: Type one of the following symbols: /// , //! , /** or /*! and press Enter .


1 Answers

See http://www.doxygen.nl/manual/index.html

The section "Special Commands" lists the \def command, and the section "Automatic link generation" describes what you want to link to the macro.

Use \def to document a macro separate from the declaration.
Use #MACRO(params) to auto-link to said macro definition.

like image 93
Guerrero Avatar answered Oct 01 '22 00:10

Guerrero