Doxygen C ++ - Not documenting virtual functions in a template class

I have a template class that contains a bunch of pure virtual and implemented virtual functions. Then I have children inherited from this class. I want to document functions in a virtual parent class and have child inheritance of this documentation in Doxygen.

For example (I cannot post a real source).

template <typename A> class Parent { /** Documentation */ virtual void pure() = 0; /** More Docs */ virtual void notpure() { ... } }; 

In another file with all relevant included (at least for the compiler)

 class Child: public Parent<int> { void pure() { ... } }; 

Then I want Doxygen to create documentation for both classes with the same documentation for each function, unless I re-document the overridden function.

I am running Ubuntu 14.04 and using the Doxygen 1.8.6 repository in case that matters.

thanks

+5
source share
3 answers

So, I will answer my question. Sorting.

If anyone has the same problem, be sure to check the comment errors. Doxygen did a great job with my templates, but I had a problem because I had the habit of putting / * code / ** / in my programs so that I could quickly uncomment large blocks of code during debugging. Doxygen doesn't like this!

I got an error message

The file ended in the middle of the comment block! Perhaps missing \ endcode?

It took me a while to get through the warnings created because I had several undocumented files. This was taken care of using

EXTRACT_ALL = YES

In my configuration file. HERE is the one who has the same problem as me.

+3
source

According to the INHERIT_DOCS tag, it should already do this if you have set it to yes.

AFAIK doxygen had problems parsing template classes, and this may be the reason that your documentation is not duplicated (i.e. doxygen thinks that Child inherits from another Parent class).

You can try to force this behavior to use the \ copydoc command . If this still does not work, you may have to either ask for the patch or fix it yourself.

+3
source

I had a similar problem creating documents of an abstract class. The solution was to make the methods public (by default, in the C ++ class, all methods are private, and you need to set EXTRACT_PRIVATE to YES in your Doxygen configuration file to create documents).

Hope this helps someone!

+1
source

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


All Articles