Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documenting a non-existing member with Doxygen

I'm trying to document a python class using Doxygen. The class exposes a set of properties over d-bus, but these have no corresponding public getters/setters in the python class. Instead, they are implemented through a d-bus properties interface (Set/Get/GetAll/Introspect).

What I want to do is to be able to document these properties using something like this:

## @property package::Class::Name description

The whole package::Class works (the same method finds functions, so it finds the right class).

When running doxygen I get the following error:

warning: documented function ``package::Class::Name' was not declared or defined.

I can live with a warning, but unfortunately the property fails to appear in the documentation generated for the class, so it is not only a warning, but it is silenced as well.

So, my question is, how, if I can, do I make the non-existing property member appear in the generated docs?

like image 782
e8johan Avatar asked Oct 29 '12 09:10

e8johan


1 Answers

Define the attribute inside an if 0: block:

## @class X
## @brief this is useless
class X:
    if 0:
        ## @brief whatevs is a property that doesn't exist in spacetime
        ##
        ## It is designed to make bunny cry.
        whatevs = property

This will cause it to exist in the documentation (tested with doxygen 1.8.1.2-1 on debian-squeeze). The attribute will never be made to exist at runtime, and in fact it looks like the python bytecode optimizer eliminates if statement and its body altogether.

like image 153
Jeff Epler Avatar answered Oct 19 '22 18:10

Jeff Epler