Doxygen: Documenting Overloaded Functions

If I have my documentation separate from my code, how can I help Doxygen distinguish between overloaded functions (what to use in the \fn field)? One function will be documented as follows:

 void func() { } /** \fn func \details Description here. */ 

What if I have two functions called func ?

 void func() { } void func(int i) { } /** \fn [What goes here?] \details Description here. */ 
+5
source share
2 answers

You can simply document each overload as if it were a separate method (which it really is :-) - just put the entire method signature in the \ fn command instead of the method name. How in:

 /** \fn func() \details Description here. */ void func() { } /** \fn func(int i) \details Description here. */ void func(int i) { } 

(Sorry, I just had to move the doc comments over the methods in which they belong :-)

Indeed, you do not need the \ fn command at all if the comment is immediately before the code element to which it refers.

 /** \details Description here. */ void func() { } /** \details Description here. */ void func(int i) { } 
+4
source

For such cases, there is the \ overload doxygen command. See the doxygen command reference . Use your regular \ fn command for the base case and use \ overload for any, well, generally overload. :)

+16
source

Source: https://habr.com/ru/post/1347748/


All Articles