doxygenclass Directive

This directive generates the appropriate output for a single class. It takes the standard project, path, outline and no-link options and additionally the members, protected-members, private-members and undoc-members options.

members

Designed to behavior in a similar manner to the members option for the autoclass directive that comes with the Sphinx autodoc extension.

If you do not specify this option you will not get any information about the class members, just the general class documentation. If you provide it without arguments, then Breathe adds all the public members and their documentation. If you specify it with comma separated arguments, then Breathe will treat the arguments as names of members and provide documentation for only those members that have been named.

protected-members
If specified, the protected members of the class will be displayed.
private-members
If specified, the private members of the class will be displayed.
undoc-members
If specified, the undocumented members of the class will be displayed.

If you would like to always specify some combination of members, protected-members, private-members and undoc-members then you can use the breathe_default_members configuration variable to set it in the conf.py.

The output includes references to any base classes and derived classes of the specified class.

Basic Example

This displays the class documentation without any members:

.. doxygenclass:: Nutshell
   :project: nutshell

It produces this output:

class Nutshell

With a little bit of a elaboration, should you feel it necessary.

Template Specialisation Example

You can reference class template specialisations by include the specialisation in the name:

.. doxygenclass:: TemplateClass< T * >
   :project: template_specialisation

Produces this output:

template <typename T>
template<>
class TemplateClass<T *>

A partial specialization of TemplateClass for pointer types.

Where as without the specialisation, the directive references the generic declaration:

.. doxygenclass:: TemplateClass
   :project: template_specialisation

Produces this output:

template <typename T>
class TemplateClass

A generic template class.

Members Example

This directive call will display the class documentation with all the public members:

.. doxygenclass:: Nutshell
   :project: nutshell
   :members:

It produces this output:

class Nutshell

With a little bit of a elaboration, should you feel it necessary.

Public Types

enum Tool

Our tool set.

The various tools we can opt to use to crack this particular nut

Values:

kHammer = 0

What? It does the job.

kNutCrackers

Boring.

kNinjaThrowingStars

Stealthy.

Public Functions

Nutshell()

Nutshell constructor.

~Nutshell()

Nutshell destructor.

void crack(Tool tool)

Crack that shell with specified tool

Parameters
  • tool: the tool with which to crack the nut

bool isCracked()

Return
Whether or not the nut is cracked

Specific Members Example

This displays the class documentation with only the members listed in the :members: option:

.. doxygenclass:: Nutshell
   :project: nutshell
   :members: crack, isCracked

It produces this output:

class Nutshell

With a little bit of a elaboration, should you feel it necessary.

Public Functions

void crack(Tool tool)

Crack that shell with specified tool

Parameters
  • tool: the tool with which to crack the nut

bool isCracked()

Return
Whether or not the nut is cracked

Protected Members

This displays only the protected members of the class. Normally this is combined with the :members: option to show the public members as well.

.. doxygenclass:: GroupedClassTest
   :project: group
   :protected-members:

It produces this output:

class GroupedClassTest

first class inside of namespace

Protected Functions

void protectedFunction()

A protected function.

class ProtectedClass

A protected class.

Private Members

This displays only the private members of the class. Normally this is combined with the :members: option to show the public members as well.

.. doxygenclass:: Nutshell
   :project: nutshell
   :private-members:

It produces this output:

class Nutshell

With a little bit of a elaboration, should you feel it necessary.

Private Members

bool m_isCracked

Our cracked state.

Undocumented Members

This displays the undocumented members of the class which are suppressed by default. Undocumented public members are only shown if the :members: option is also used. The same goes for the undocumented private members and the private-members option.

.. doxygenclass:: ClassTest
   :project: class
   :members:
   :private-members:
   :undoc-members:

It produces this output:

class ClassTest

class outside of namespace

Public Functions

void function(int myParameter)

non-namespaced class function

More details in the header file.

More documentation in the impl file

void anotherFunction()

non-namespaced class other function

More documentation in the impl file

virtual void publicFunction() const = 0

namespaced class function

virtual void undocumentedPublicFunction() const = 0

Private Functions

void privateFunction() const = 0

This is a private function.

void undocumentedPrivateFunction() const = 0
class PrivateClass

A private class.

struct PrivateStruct

A private struct.

class PublicClass

A public class.

struct PublicStruct

A public struct.

Note

Undocumented classes are still not shown in the output due to an implementation issue. Please post an issue on github if you would like this resolved.

Outline Example

This displays only the names of the class members and not their documentation. The :members: and :private-members: options determine which members are displayed.

.. doxygenclass:: Nutshell
   :project: nutshell
   :members:
   :outline:

It produces this output:

class Nutshell

Public Types

enum Tool

Values:

kHammer = 0
kNutCrackers
kNinjaThrowingStars

Public Functions

Nutshell()
~Nutshell()
void crack(Tool tool)
bool isCracked()

Qt Slots Example

Doxygen is aware of Qt Slots and so Breathe can pick them up and display them in the output. They are displayed in appropriate Public Slots, Protected Slots and Private Slots sections.

.. doxygenclass:: QtSlotExample
   :project: qtslots
   :members:

Produces the following output:

class QtSlotExample

Inherits from QObject

Public Functions

void workingFunction(int iShownParameter)

Parameters
  • iShownParameter: This is shown in declaration

Public Slots

void workingSlot(int iShown)

Parameters
  • iShown: This is in function declaration

Failing Example

This intentionally fails:

.. doxygenclass:: made_up_class
   :project: class
   :members:

It produces the following warning message:

Warning

doxygenclass: Cannot find class “made_up_class” in doxygen xml output for project “class” from directory: ../../examples/doxygen/class/xml/