1. 程式人生 > >vs.net下doxygen的設定與使用

vs.net下doxygen的設定與使用

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