Documenting a non-existing member with Doxygen

前端 未结 2 1796
醉酒成梦
醉酒成梦 2021-02-20 11:29

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 clas

2条回答
  •  心在旅途
    2021-02-20 12:05

    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.

提交回复
热议问题