忽略doxygen注释块中的行



是否可以在doxygen注释块中包含将被doxygen忽略的内容?按照顺序,我们可以在doxygen评论块中有评论吗?

背景:

我们正在将Fortran项目的代码内注释转换为doxygen可解析格式,但是该项目要求代码内注释中的内容由水平线描绘。例如:

!> @brief Lorem ipsum dolor sit amet
!! ---------------------------------------------------------------------
!!
!! @param[in] p1  Description of p1
!! @param[in] p2  Description of p2
!! ---------------------------------------------------------------------
!!
!! More content here ....
!! ---------------------------------------------------------------------
!!
!! More content for another section
!! ---------------------------------------------------------------------
subroutine do_something(p1, p2)
  ! .... the code ...
end subroutine do_something

有没有一个命令/语法可以作为这些行的前缀,这样doxygen就会忽略它们?希望这是一个不引人注目的,不会影响评论的可读性。

我知道可以用于在预处理脚本中链接的INPUT_FILTER设置,但理想的解决方案是不依赖于其他脚本/工具的解决方案。

p.S.我很清楚,很多人会认为这些水平线是不必要的和/或分散注意力的。然而,这是出纳员规定的要求,我无权更改

Doxygen支持一些HTML命令,包括HTML注释。该解决方案的优点是不需要对Doxyfile进行任何修改,并且比@I{ ---- }稍微少一些干扰。

!> @brief Lorem ipsum dolor sit amet
!! <!----------------------------------------------------------------->
!!
!! @param[in] p1  Description of p1
!! @param[in] p2  Description of p2
!! <!----------------------------------------------------------------->
!!
!! More content here ....
!! <!----------------------------------------------------------------->
!!
!! More content for another section
!! <!----------------------------------------------------------------->
subroutine do_something(p1, p2)
  ! .... the code ...
end subroutine do_something

记录在案,这是我最终确定的解决方案。然而,我接受了DRH的回答,因为它为"在doxygen块中启用注释"提供了一个更通用的解决方案

如果您可以灵活地将哪一个字符用于水平行,则可以继续重复注释字符,而doxygen将忽略它

!> @brief Lorem ipsum dolor sit amet
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
!! @param[in] p1  Description of p1
!! @param[in] p2  Description of p2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
!! More content here ....
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
!! More content for another section
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine do_something(p1, p2)
  ! .... the code ...
end subroutine do_something

您可以利用Doxygen的别名语法来忽略该行,但这将要求该行以附加字符为前缀和后缀。例如,如果您定义了一个别名,如:

ALIASES                = I{1}=""

你可以在评论中使用别名来隐藏doxygen:的水平中断

!> @brief Lorem ipsum dolor sit amet
!! @I{-----------------------------------------------------------------}
!!
!! @param[in] p1  Description of p1
!! @param[in] p2  Description of p2
!! @I{-----------------------------------------------------------------}
!!
!! More content here ....
!! @I{-----------------------------------------------------------------}
!!
!! More content for another section
!! @I{-----------------------------------------------------------------}
subroutine do_something(p1, p2)
  ! .... the code ...
end subroutine do_something

您可以编写一个简单的过滤器来删除这些行。在perl中,它可能看起来像这样:

while (<>)
{
    if (m/^!! -{3,}/)
    {
        print "!!n";
    }
    else
    {
        print;
    }
}

然后在Doxyfile中配置INPUT_FILTER以引用此脚本:

INPUT_FILTER = path/to/my/perl/script

最新更新