【问题标题】:Can I make doxygen resolve @ref's to C++ standard library functions?我可以让 doxygen 将 @ref 解析为 C++ 标准库函数吗?
【发布时间】:2017-08-23 07:38:13
【问题描述】:

我有时想在我的 doxygen cmets 中引用标准库结构。我可以使用 HTML <a> 元素来做到这一点——但要粘贴的文本很多。我宁愿能够简单地写{@ref std::string},并且让doxygen知道它需要链接到cppreference.org page for std::string

我在想,如果有人要为标准库生成一个 doxygen 标签文件,这可能是可能的(如果标签文件不支持任意 URL,即使这样也可能不起作用)。那么,还有其他方法吗?

【问题讨论】:

    标签: c++ doxygen code-documentation


    【解决方案1】:

    您应该有一个 Doxygen 标记文件和相应的离线或在线 html 文件。所以你可以在 Doxygen 配置文件中用这种格式声明它:

    TAGFILES = "/location/of/tagFile=http://onlineUrl Or /location/of/OfflineHtml"
    

    要下载这些文件,我找到了以下两个资源:

    Cppreference

    我推荐这种方式。因为它有完整的文档。

    在线链接

    1. 下载web tag file
    2. 在配置文件中设置如下:

      TAGFILES += "location/of/cppreference-doxygen-web.tag.xml=http://en.cppreference.com/w/"
      

    离线链接

    1. 下载html book,这是网站的离线副本。
    2. 在配置文件中设置如下:

      TAGFILES += "location/of/cppreference-doxygen-local.tag.xml=/location/of/html_book_*\reference\en"
      

    More


    GNU 项目

    在线链接

    1. 下载a tag file for the latest version
    2. 在配置文件中设置如下:

      TAGFILES = "/location/of/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen"
      

    离线链接

    1. 下载GCC 7.1 Standard C++ Library Reference Manual in HTML。找到其他版本here
    2. 在配置文件中设置如下:

      TAGFILES = "/location/of/libstdc++.tag = /location/of/libstdc++-api-html"
      

    More

    【讨论】:

    • 您能否详细说明您的确切含义是什么标签,以及我如何使用它们?
    • ...这些标签会指向我在线还是本地资源?
    • @einpoklum,这取决于您的决定Online linkOffline link。看看this link 什么是 Doxygen 中的标签文件。
    • 嗨@ahoo 这个解决方案在引用类(例如@see std::vector)时可以正常工作,但在引用函数时(例如@see std::distance)就不行。我可以在 cppreference 标记文件中看到“距离”,但 Doxygen 不会获取链接。我应该使用不同的 Doxygen 语法吗?
    猜你喜欢
    • 1970-01-01
    • 2020-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多