【问题标题】:How to create a list of switch case statements in doxygen?如何在 doxygen 中创建 switch case 语句列表?
【发布时间】:2020-11-23 14:56:07
【问题描述】:

我需要评论/记录一些现有代码。为此,我使用 Doxygen,它工作得很好。但现在我有一个问题: 我有一个代码,它对通过用户界面接收的命令作出反应。这些命令不在单独的函数中处理,而是在 ONE 函数中,使用 switch case 语句。所以基本上代码是这样的:

switch (command[0])
{
    case 'a': do_something(command[1]);
    case 'b': do_something(command[2]);
    case 'c': do_something_else(command[3]);
    case 'd': do_something_else(command[4]);
}

我想创建某种列表,它提供所有案例的概览,单击案例会导致详细描述。 你会推荐什么 Doxygen 工具来完成这项任务????

谢谢.... 塞巴斯蒂安

【问题讨论】:

  • 哪个 doxygen 版本?使用了哪些设置?

标签: doxygen


【解决方案1】:

在记录此 switch 语句的代码时,我会选择以下内容:

/// \file

/// the fie
void fie(void)
{
  switch (command[0])
  {
    /// case a work
    case 'a': do_something(command[1]);
    /// case b work
    case 'b': do_something(command[2]);
    /// case c work
    case 'c': do_something_else(command[3]);
    /// case d work
    case 'd': do_something_else(command[4]);
  }
}

以下也可以正常工作

/// \file

/// the fie
///
/// depending on the value of `command[0]` the following actions are performed:
/// case a work
/// case b work
/// case c work
/// case d work
void fie(void)
{
  switch (command[0])
  {
    case 'a': do_something(command[1]);
    case 'b': do_something(command[2]);
    case 'c': do_something_else(command[3]);
    case 'd': do_something_else(command[4]);
  }
}

由于缺少我仅使用 doxygen 1.8.20 测试的信息,请注意。

【讨论】:

  • 感谢您的回答,阿尔伯特。我正在考虑 \defgroup 或 \xrefitem 但我没有让它们正常工作。它应该看起来像这里的链表:doxygen.nl/manual/commands.html
  • 我也在使用 Doxygen 1.8.20
  • 您所指的列表是所谓的\secreflist 列表,其中项目为:\refitem
  • 哦,我明白了。我以错误的方式使用它。我是否必须手动创建(和排序)该列表?我希望 \refitem 命令会为我这样做......
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-08-16
  • 2022-01-22
  • 2013-09-24
  • 1970-01-01
  • 2011-03-28
  • 2018-06-26
相关资源
最近更新 更多