【问题标题】:Doxygen not showing the public, non-static member functionDoxygen 没有显示公共的、非静态的成员函数
【发布时间】:2017-11-23 17:06:57
【问题描述】:

我一直在努力让以下代码摘录的文档在doxygen 中正确显示。

我已经在网上搜索过这个问题;然而,似乎没有显示的文档主要是由于成员函数/变量是私有的。尽管我似乎在记录一个公共成员函数,它也是非静态的,但我无法让 doxygen 正常工作。如果您能提供任何帮助,我将不胜感激。

/**
 * @brief Algorithm abstraction.
 *
 * @tparam float_t `float` or `double`.
 * @tparam int_t `int64_t` or similar.
 * @tparam StepPolicy Policy for selecting a step-size.
 * @tparam OraclePolicy Policy for getting first-order information.
 */
template <class float_t, class int_t, template <class, class> class StepPolicy,
          template <class, class> class OraclePolicy>
struct Algorithm : public StepPolicy<float_t, int_t>,
                   public OraclePolicy<float_t, int_t> {
  /**
   * @brief Default constructor.
   *
   */
  Algorithm() = default;
  /**
   * @brief Constructor with a step-size.
   *
   * @param[in] step Non-negative step-size value.
   */
  Algorithm(float_t step) : StepPolicy<float_t, int_t>{step} {}

  /**
   * @brief Set the initial step-size of the algorithm.
   *
   * @param[in] step Non-negative step-size value.
   */
  void set_stepsize(float_t step) { StepPolicy<float_t, int_t>::set(step); }
  /**
   * @brief Get the current step-size of the algorithm.
   *
   * This does *not* change the state of StepPolicy.
   *
   * @return float_t Current step-size.
   */
  float_t get_stepsize() const { return StepPolicy<float_t, int_t>::get(); }
  /**
   * @brief Get current step-size based on the algorithm's state.
   *
   * @param[in] k Current iteration count.
   * @param[in] N Dimension of `x` and `dx`.
   * @param[in] x Current decision vector.
   * @param[in] dx Current first-order information.
   * @return float_t Current step-size.
   */
  float_t get_stepsize(const int_t k, const int_t N, const float_t *x,
                       const float_t *dx) {
    return StepPolicy<float_t, int_t>::get(k, N, x, dx);
  }

private:
  int_t k{0};
};

我不确定doxygen 是否与有效 代码摘录有关,但上面的代码确实可以编译。它与模板和继承有关吗?我错过了什么吗?我的意思是,对于非继承模板类,doxygen 可以完成它的工作。

顺便说一句,我的目录中没有具体的StepPolicyOraclePolicy。此外,我可以看到构造函数得到正确记录。我只是卡住了。

我可以在这里分享我的Doxygen 文件,它基本上只是MathJax 相关设置中覆盖的默认值。

提前感谢您的宝贵时间。

【问题讨论】:

  • 看起来 doxygen 不喜欢:Algorithm(float_t step) : StepPolicy{step} {} “解决方案”目前正在将其移动到结构的末尾或使用#ifdef 或 \cond 构造未将其包含在文档中(或其中的一部分)。
  • 看起来你已经成功了,@albert。谢谢你。您是否介意分享这个作为答案,也许详细说明您如何发现 doxygen 不喜欢上面提到的构造函数重载以及 #ifdef/\cond 技巧?也许这对你来说是微不足道的,但对我来说有点模糊。再次感谢!
  • 你认为在同一个翻译单元中声明所有成员并记录它们,然后在下面给出类外定义更好吗?
  • 我对声明的顺序没有意见,但据我所知,从类中的构造函数和析构函数开始是很常见的。我只是通过一些受过教育的猜测以及我以前从未见过带有 {} 集的构造的事实“发现”。关于 \cond 参见文档,其中解释了部分被省略。感谢您提交错误报告(bugzilla 错误 790788)

标签: doxygen


【解决方案1】:

v1.8.14开始,不存在这样的问题。显然,问题是 bugdoxygen 的维护者已修复

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-29
    • 2020-01-17
    相关资源
    最近更新 更多