vs.net下doxygen的设置与使用

类别:VC语言 点击:0 评论:0 推荐:
doxygen的windows平台下的安装文件有大约5M左右,可到以下地址下载。
下载地址: http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc
下载后安装完毕即可使用命令行方式或wizard产生注释文档
---------------------------------------------------------------------------------------------------------------
vs.net的集合:(可参考codeproject文章10 Minutes to document your code)
在vs.net“工具”菜单下添加外部工具“生成文档“,参数如下:
命令:   c:\program files\doxygen\bin\doxygen.exe (即doxygen的安装目录)
命令参数: $(ProjectDir)\default.doxygen
初始目录: $(ProjectDir)
选中"使用输出窗口",使doxygen的输出在vs.net 的输出窗中显示。
同时拷贝default.doxygen到工作的工程目录下($(projectdir))。
根据需要可以打开修改。
使用前面的“生成文档”工具可以给工程产生html类型的文档注释,同时产生.hhp类型的html help文档的项目文件.
同时安装HTML help workshop,可以在外部工具添加一个新项目,直接调用html help workshop的主执行文件,参数
传入生成的*.hhp文件,即可直接调用编译出chm的注释文件了。
添加外部工具,用windows目录下的 hh.exe命令可以启动浏览chm文件,这样就可以不离开vs.net开发环境来完成文档的
生成与查看了。
另外:
1.doxygen不支持vs.net中的solution概念,需要拷贝default.doxygen到具体的工程目录下。
2.vs.net中的宏定义$(projectdir)有问题,直接传给html help workshop 的参数多个引号,可手工删除。
3.我编辑的一些符合doxygen注释风格的常用宏:
    Sub 函数注释()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//!"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "/*!"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Indent()
        DTE.ActiveDocument.Selection.Text = "\param"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "\param"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "\return"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "\sa "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "*/"
        DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
        DTE.ActiveDocument.Selection.DeleteLeft()
    End Sub
    Sub 变量注释()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//!"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
        DTE.ActiveDocument.Selection.DeleteLeft()
    End Sub
    Sub 文件注释()
        DTE.ActiveDocument.Selection.Text = "/** \file " + DTE.ActiveDocument.Name + " 版权所有 (c) 2000-2004 , 我的公司"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Indent()
        DTE.ActiveDocument.Selection.Text = "\n 文件名称 :   " + DTE.ActiveDocument.Name
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "\n 功能描述 :   "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "\author         我的大名   "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "\n 历史信息 :   第一版  " + Date.Now
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.DeleteLeft()
        DTE.ActiveDocument.Selection.Text = "*/"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
    End Sub
    Sub 变量详细注释()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//!"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "/*!"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Indent()
        DTE.ActiveDocument.Selection.Text = "*/"
        DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
        DTE.ActiveDocument.Selection.DeleteLeft()
    End Sub

本文地址:http://com.8s8s.com/it/it601.htm