【问题标题】:Parameter warnings and overload参数警告和过载
【发布时间】:2017-04-03 21:54:51
【问题描述】:

我想使用 @overload 特殊命令并将 WARN_NO_PARAMDOC Doxyfile 参数设置为 YES,但是当我尝试时,我收到来自所有重载函数的警告,即参数未记录在案。 @overload 标签的工作方式与生成的文档中所宣传的一样,只是带有警告。我是否误解了@overload 命令的意图?

具体来说,导致问题的代码段看起来像,

class ExampleClass {
public:
  /// Test Function
  /// @details Details on the test function API
  /// @param[out]    output Output parameter, by pointer
  /// @param[out]    optionalOutput
  ///                Output parameter, by pointer, nullptr if not there
  /// @param[in,out] mixed  Mixed use parameter, by pointer
  /// @param[in]     input  Input parameter, by reference
  /// @param[in]     defaultParam  Default input parameter
  /// @returns       Return new value
  int testFunction(ExampleClass* output, ExampleClass* optionalOutput,
                   ExampleClass* mixed, 
                   const ExampleClass& input, int defaultParam=1);

  /// @overload 
  int testFunction(ExampleClass* output, 
                   ExampleClass* mixed, 
                   const ExampleClass& input, int defaultParam=1) {
    return testFunction(output, nullptr, mixed, input, defaultParam);
  }
};

生成的警告如下所示:

example_class.h:99: warning: parameters of member ExampleClass::testFunction are not (all) documented
example_class.h:99: warning: return type of member ExampleClass::testFunction is not documented

我在 Ubuntu 16.04 下使用 Doxygen 版本 1.8.11

【问题讨论】:

    标签: doxygen


    【解决方案1】:

    我是否误解了@overload 命令的意图?

    警告是WARN_NO_PARAMDOC 的结果,只要没有记录参数和返回值,它就会发出警告。它不会忽略未记录的参数和可能记录在早期注释块中的重载函数的返回值。

    @overload 的目的是显示占位符描述,并确保重载函数的函数描述组合在一起。以下内容可以更好地证明这一点:

    class ExampleClass {
    public:
      /// Test Function
      /// @details Details on the test function API
      /// @param[out]    output Output parameter, by pointer
      /// @param[out]    optionalOutput
      ///                Output parameter, by pointer, nullptr if not there
      /// @param[in,out] mixed  Mixed use parameter, by pointer
      /// @param[in]     input  Input parameter, by reference
      /// @param[in]     defaultParam  Default input parameter
      /// @return       Return new value
      int testFunction(ExampleClass* output, ExampleClass* optionalOutput,
                       ExampleClass* mixed,
                       const ExampleClass& input, int defaultParam=1);
    
      /// Another function
      /// @details some stuff
      /// @param[out]    output Output parameter, by pointer
      void someOther(ExampleClass* output );
    
    
      /// @overload
      /// @param[out]    output Output parameter, by pointer
      /// @param[in,out] mixed  Mixed use parameter, by pointer
      /// @param[in]     input  Input parameter, by reference
      /// @param[in]     defaultParam  Default input parameter
      /// @return       Return new value
      int testFunction(ExampleClass* output,
                       ExampleClass* mixed,
                       const ExampleClass& input, int defaultParam=1);
    
      /// @overload
      /// @details some stuff
      void someOther();    
    };
    

    尽管testFunctionsomeOther 函数重载相互交织,但它们在生成的文档中被组合在一起。

    【讨论】:

    • 我确实是误会了。感谢您的澄清
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多