doxygen上手

2017-12-03  本文已影响79人  东东威武

what

doxygen是一个自动根据注释生成文档的工具。支持html、chm、pdf等格式。

安装

生成文档的步骤

实验1:生成doxygen的文档。

这样就会生成一份doxygen自己的文档。

doxygen配置主要参数:

注释规范

/*!
xx@#$%~
xx^&*(
*/
  SomeClass sc("hello");
  string result;
  int ret = sc.Func("world",3,result);
  \endcode
//! @name operator
    //@{
        bool operator==(const SomeClass& other) const { return true;} 
        bool operator!=(const SomeClass& other) const { return true;} 
        bool operator<(const SomeClass& other) const { return true;} 
        bool operator>(const SomeClass& other) const { return true;} 
    //@}

完整的示例:

#pragma once

/*! \file document.h */

#include <string>
#include <vector>

using namespace std;

//!概要
/*!
    具体注释:

    \tparam 模板参数的注释
    \see SomeClass::SomeClass

    这就是一个测试类。

    \b "\b"表示加粗
    \code 
    SomeClass sc("hello");
    string result;
    int ret = sc.Func("world",3,result);
    \endcode
*/
template<typename Type>
class SomeClass
{
public:
    /*!
        构造函数

        \param str 输入字符串

        \note 说明
    */
    SomeClass(string const& str){}

    //! 函数注释概要
    /*!
        具体解释
        \li 解释1
        \li 解释2
        \li 解释3

        \param outStr 输出字符串

        \return int 错误码,0表示成功

        \todo 对各种错误进行整理
    */
    int Func(string const& str,int len, string& outStr)
    {
        return 0;
    }

    //! \deprecated
    int Func()
    {
        return 0;
    }

    //! @name operator
    //@{
        bool operator==(const SomeClass& other) const { return true;} 
        bool operator!=(const SomeClass& other) const { return true;} 
        bool operator<(const SomeClass& other) const { return true;} 
        bool operator>(const SomeClass& other) const { return true;} 
    //@}
public:
    string value_;

private:
    int len_;
    Type type_;
}
上一篇 下一篇

猜你喜欢

热点阅读