[英]Using Doxygen with Visual Studio 2010
我在使用Doxygen和Visual Studio 2010和C ++時遇到了困難。
除了“un / comment lines”之外,沒有其他評論功能嗎? 例如,生成注釋存根,並在新行之后添加///
。
另外,我想知道在VS2010的IntelliSense功能中顯示這些注釋需要什么?
根據MSDN文檔 ,使用//
或/*
分隔符的任何注釋都將顯示在IntelliSense成員列表中的關聯成員旁邊。
您可以使用doxygen的XML輸出或Visual Studio生成的XML文檔作為IntelliSense輸入。
/doc
文檔說明了如何在IntelliSense中使用XML文檔:
要將生成的.xml文件與IntelliSense一起使用,請使.xml文件的文件名與要支持的程序集相同,並將.xml文件與程序集放在同一目錄中。 在Visual Studio項目中引用程序集時,也會找到.xml文件。
AtomineerUtils是doxygen / javadoc / DocXML文檔的最佳Visual Studio加載項之一。 它不是免費的,但doxygen助手工具列表中沒有任何內容針對Visual Studio 2010。
我能夠自己想出的最好的東西是一系列宏。 我一直在尋找可能將一些有用的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
隨意編輯或重用此宏,我歡迎任何批評。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.