Doxygen private function

青春壹個敷衍的年華 提交于 2019-12-23 08:07:08

问题


Is there a way to have doxygen show the documentation for individual private functions? I want doxygen to not show the documentation for the vast majority of private functions but show it for a select few private functions. My motivation is that these C++ private functions are provided to Python as extensions and I want their documentation to show up in Doxygen. However, I don't want them to be public because they are only needed by the classes themselves; they definitely belong in the private sector.

Thanks


回答1:


The section between \cond and \endcond commands can be included by adding its section label to the ENABLED_SECTIONS configuration option. If the section label is omitted, the section will be excluded from processing unconditionally.

/** An interface */
class Intf
{
  public:
    /** A method */
    virtual void func() = 0;

    /// @cond COND1

    /** A method used for testing */
    virtual void test() = 0;

    /// @endcond
};

See cond help

Not to see COND1 sections: just do not add it to ENABLED_SECTIONS configuration option.




回答2:


There are a couple of ways to achieve this.

You could simply not document those functions that you don't want visible. By default, Doxygen will not show any members that you did not document. Thus, you can just tell it to show privates and any undocumented private members will not be shown.




回答3:


I set the following in the config file:

EXTRACT_PRIVATE = YES

HIDE_UNDOC_MEMBERS = YES

This has the desired effect but will still show the documentation for all documented private members.

I then use @internal as the first line for the documentation of private members that I do not want to show.

Also, I can still document private members with a normal C++ comment. ie. dont use /** ... */ use /* ... */. Usually I use a normal comment for member variables.

Finally, if I really want to show all that private documentation I can set:

INTERNAL_DOCS = YES

to create a more expansive version of the documentation.



来源:https://stackoverflow.com/questions/12147668/doxygen-private-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!