1

I have two class templates and I need to document them using Sphinx. As usual, I have used the Doxygen style comment for the classes. But while I have used the doxygen directive I am not able to get the proper documentation.

Sample classes

namespace X
{
    /// Base Class
    /**
     * Description of Base Class
     * */
    class A
    {
        // Intentionally kept blank
    };


    /// Child Class First
    /**
     * Description of First Child Class
     * */
    template <typename T, int length_x>
    class B : public A
    {
        // Intentionally kept blank
    };


    /// Child Class Second
    /**
     * Description of Second Child Class
     * */
    template<typename T>
    class B<T, 1>  : public A
    {
        // Intentionally kept blank
    };
}

Content of the rst file

.. _dummy class:

Dummy Class
===========

.. doxygenclass:: X::A
   :members:
   :protected-members:
   :private-members:

.. doxygenclass:: X::B
   :members:
   :protected-members:
   :private-members:

.. I know that the following will not work but given as my approach

.. doxygenclass:: X::B
   :members:
   :protected-members:
   :private-members:

I have also tried the following by seeing this, but failed.

.. _dummy class:

Dummy Class
===========

.. doxygenclass:: X::A
   :members:
   :protected-members:
   :private-members:

.. doxygenclass:: X::B
   :members:
   :protected-members:
   :private-members:

.. doxygenclass:: X::B<T, 1>
   :members:
   :protected-members:
   :private-members:

Is there any way to document both child classes using Sphinx?

user10634362
  • 549
  • 5
  • 21
  • Which version of doxygen are you using? How do the results look like in the HTML version as generated by doxygen? – albert Nov 30 '21 at 16:38
  • @albert `Doxygen version 1.8.17`. HTML generated by Doxygen looks normal (both classes are documented one after another). Do you want to know something else about the HTML of Doxygen? – user10634362 Nov 30 '21 at 21:16
  • The doxygen version 1.8.17 is from December 27 2019, it might be useful to upgrade to the current version (1.9.2). As the HTML looks OK the next thing to check would be to see whether all information is present in the xml files (and the correct links are there). It looks OK to me but has to be checked properly. In case the information is present in the xml files the problem lies (in my opinion) on the Sphinx side (I cannot help you here). – albert Dec 01 '21 at 09:00
  • The solution lies in the `Sphinx` side. I have to use some of the directives from [breathe](https://breathe.readthedocs.io/en/latest/directives.html#doxygenclass) but unfortunately could not find. – user10634362 Dec 01 '21 at 10:08

1 Answers1

0

Finally, got the answer. It was a typo of writing the doxygendirective

.. _dummy class:

Dummy Class
===========

.. doxygenclass:: X::A
   :members:
   :protected-members:
   :private-members:

.. doxygenclass:: X::B
   :members:
   :protected-members:
   :private-members:

.. doxygenclass:: X::B< T, 1 >
   :members:
   :protected-members:
   :private-members:

Most important part is this .. doxygenclass:: X::B< T, 1 >. A space after and before < >. Documentation is here.

user10634362
  • 549
  • 5
  • 21