【问题标题】:How to document a preprocessor definition dependent typedef using Doxygen?如何使用 Doxygen 记录依赖于预处理器定义的 typedef?
【发布时间】:2021-12-03 03:22:02
【问题描述】:

是否可以使用 Doxygen 在 html 输出中显示两种选择的方式来记录取决于预处理器定义具有不同类型的 typedef?

我要记录的代码:

/**
 * \file
 */

#ifdef _WIN32
/**
 * Documentation for Windows goes here...
 */
typedef wchar_t MyChar;
#else
/**
 * Documentation for Non-Windows goes here...
 */
typedef char MyChar;
#endif

我已经测试了几个与预处理器相关的设置,但我只能更改 html 输出中显示的 typedef 或合并文档。我什至设法让一个 typedef 出现在文件的概述部分,另一个出现在详细描述中。但是,我无法让这两种选择同时出现。

我设法产生了以下 2 个替代方案:

----------------------------------------------
typedef wchar_t   | MyChar   | ....
----------------------------------------------
----------------------------------------------
typedef char      | MyChar   | ....
----------------------------------------------

但不是这样的

----------------------------------------------
typedef wchar_t   | MyChar   | ....
----------------------------------------------
typedef char      | MyChar   | ....
----------------------------------------------

注意:我不介意修改源代码只要

  • 在文档中,两种替代方案都合理地记录在 Doxygen 输出中; wchar_tchar 都需要显示在 typedef ... 部分中
  • 编译器对文件的修改版本和当前版本产生相同的结果
  • IDE 自动完成功能,尤其是 Visual Studio 2019 的 IntelliSense,仍会显示合理的工具提示(可选)

【问题讨论】:

    标签: c doxygen


    【解决方案1】:

    不是一个真正的答案,只是一个问题/建议是否可以接受以下内容:

    /** \cond */
    #ifdef _WIN32
    #define used_type wchar_t
    #else
    #define used_type char
    #endif
    /** \endcond */
    /**
     * Documentation for Windows goes here...
     *
     * Documentation for Non-Windows goes here...
     */
    typedef used_type MyChar;
    

    导致:

    【讨论】:

    • 感谢您的回答。这可能是可能的解决方案的一个步骤。我需要在宏中添加提及这两种选择的文档。但是,我可以在摘要中看到类型(不包括“简要”部分)的解决方案是可取的。
    猜你喜欢
    • 2011-01-22
    • 1970-01-01
    • 1970-01-01
    • 2016-10-04
    • 1970-01-01
    • 2014-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多