最近在玩vim时发现了一个doxygenToolkit.vim插件,加doxygen注释挺方便的,比原来用的doxygen-support方便多了.有了文档注释的好插件不会用doxygen也是白玩,so花了一个下午时间来研究了一下,有了不小的收获,迅速记录下来!
先说两个简单的命令doxygen -g这个会在当前目录生成doxygen的配置文件默认是Doxyfile,也可以后面指定文件名.
另外一个就是doxygen -s了,这个就会搜索配置文件中指定的文件夹下的source来生成漂亮而强大的的doxygen文档了.
另外doxygen -g生成的配置文件是带有注释的,会解释每条配置文件的作用和格式,如果已经用的很熟悉了,可以用doxygen -s -g生成不带有注释的Doxyfile了.
doxygenToolkit.vim常用的只有两个命令,:DoxAuthor和:Dox,前者能生成文件头,后者则会根据光标所在行来生成注释.随便写了几个测试文件如下(文件头还用:DoxLic加了个版权声明,装装B):
1 /* Copyright (C) 2 * 2010 - Xu Wenzhang(xwz), [email protected] 3 * This program is free software; you can redistribute it and/or 4 * modify it under the terms of the GNU General Public License 5 * as published by the Free Software Foundation; either version 2 6 * of the License, or (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * 17 */ 18 /** 19 * @file class.cpp 20 * @brief doxygen test class 21 * @author Xu Wenzhang(xwz), [email protected] 22 * @version 1.0 23 * @date 2010-11-10 24 */ 25 26 /** 27 * @brief 一个类 28 */ 29 class ClassName : public ParentClass 30 { 31 public: 32 /** 33 * @brief 默认构造函数 34 */ 35 ClassName (); 36 /** 37 * @brief 拷贝构造函数 38 * 39 * @param other 拷贝值 40 */ 41 ClassName ( const ClassName &other ); 42 /** 43 * @brief 析构函数 44 */ 45 ~ClassName (); 46 47 /** 48 * @brief 等号操作符 49 * 50 * @param other 等号右值 51 * 52 * @return 返回该值 53 */ 54 ClassName& operator = ( const ClassName &other ); 55 private: 56 /** 57 * @brief 成员变量 58 */ 59 int value; 60 }; /* ----- end of class ClassName ----- */ 61
代码注释命令没必要多扯http://www.stack.nl/~dimitri/doxygen/这是doxygen的官网将的很清楚,Doxyfile才是重点.doxygen官方提供了一个叫doxywizard的具有gui界面的配置工具.果断yum之,源找不到就去官网挖吧!有了它Doxyfile中那上百个让人眼花缭乱的配置选项终于可以慢慢研究了.一个下午的时间都慢慢的泡在了这些配置选项上面,一个一个试,把其中一些比较常用的选项都略微搞清楚了.