2010-10-05 64 views
12

在Visual Studio 2010和C++中使用Doxygen有困難。在Visual Studio 2010中使用Doxygen

除了「un/comment lines」之外,沒有其他的評論功能嗎?例如生成註釋存根,並在新行後添加///

此外,我想知道在VS2010中的IntelliSense功能中顯示這些註釋需要什麼?

回答

12

根據MSDN Documentation,使用///*分隔符的任何註釋將顯示在IntelliSense成員列表中關聯成員旁邊。

可以使用doxygen的XML輸出或由Visual Studio生成的XML documentation作爲智能感知輸入。

/doc documentation介紹瞭如何使用XML文檔與智能感知:

使用具有智能感知生成的.xml文件,使.XML文件名文件一樣,你想要支持的組件並將.xml文件放在與程序集相同的目錄中。在Visual Studio項目中引用程序集時,也會找到.xml文件。

AtomineerUtils是用於doxygen/javadoc/DocXML文檔的最佳Visual Studio加載項之一。這不是免費的,但doxygen helper tools列表中沒有任何內容是針對Visual Studio 2010的。

4

我已經能夠自己想出的最好的一個宏是一個集合。我已經瀏覽過可能聚集了一些有用的Visual Studio doxygen宏的網站,但到目前爲止已經空了。但是,使用Visual Studio的代碼模型自動填充文檔可能非常方便。這裏是我做出該插入符當前是否在函數來創建文檔的宏:

Sub FunctionDoc() 
    DTE.UndoContext.Open("Function Doc") 
    Try 
     Dim caretPosition As TextPoint = DTE.ActiveDocument.Selection.ActivePoint 
     Dim element As CodeElement = _ 
      caretPosition.CodeElement(vsCMElement.vsCMElementFunction) 
     If element.Kind <> vsCMElement.vsCMElementFunction Then 
      MsgBox("That is not a function") 
      Exit Sub 
     End If 
     Dim func As CodeFunction = element 
     If func Is Nothing Then 
      MsgBox("That is not a function") 
      Exit Sub 
     End If 

     Dim ts As TextSelection = DTE.ActiveDocument.Selection 
     ts.StartOfLine() 
     ts.NewLine() 
     ts.LineUp() 
     Dim functionName As String = func.Name 
     ts.Text = "//-----------------------------------------------------------------------------" 
     ts.NewLine() 
     ts.Text = "// FUNCTION " 
     ts.Text = func.FullName 
     ts.NewLine() 
     ts.Text = "/// \brief " 
     Dim endline As Integer = ts.BottomPoint.Line 
     Dim endoffset As Integer = ts.BottomPoint.LineCharOffset 
     ts.NewLine() 
     ts.Text = "///   " 
     ts.NewLine() 
     For Each param As CodeParameter In func.Parameters 
      ts.Text = "/// \param " 
      ts.Text = param.Name 
      ts.Text = ". " 
      ts.NewLine() 
     Next 
     If func.Type.TypeKind <> vsCMTypeRef.vsCMTypeRefVoid Then 
      ts.Text = "/// \return " 
      ts.Text = func.Type.AsFullName 
      ts.Text = " " 
      ts.NewLine() 
     End If 
     ts.Text = "//-----------------------------------------------------------------------------" 
     ts.MoveToLineAndOffset(endline, endoffset) 

    Finally 
     DTE.UndoContext.Close() 
    End Try 
End Sub 

隨意修改或再使用這個宏,我歡迎任何批評。