如何使用 doxygen 排除 class 中的方法

How can I exclude a method inside a class with doxygen

我正在使用 Objective-C 语言。我有 3 classes:鸡、鸽子、狗。 class 中的每一个都有 运行 方法。

Chicken.h
 -(void)run;

Dove.h
 -(void)run;

Dog.h
 -(void)run;

我想在 Dove class 中排除 运行 方法。我发现 EXCLUDE_SYMBOLS 可以做到这一点。但是,如果我设置配置:EXCLUDE_SYMBOLS = save,则排除 3 classes 中的所有保存方法。

我只能排除 Dove class 的保存方法吗?

我不知道 objective-c,但对于 C++,我知道的唯一方法是对其进行预处理。为此,请设置配置值:

ENABLE_PREPROCESSING   = YES
PREDEFINED             = DOXYGEN_SHOULD_SKIP_THIS

然后将要排除的方法包装在 ifndef 块中。这是一个 C++ 示例:

/// doc comment for class Dove
class Dove {
public:
    /// doc comment for foo
    void foo();

#ifndef DOXYGEN_SHOULD_SKIP_THIS
    // the bar method will not be seen by doxygen, so you should not
    // see it in any documentation
    void bar();
#endif
}; 

这是您可以使用的一般策略。 #ifndef 块内的任何内容都将被预处理掉,并且对 doxygen 不可见。