我在使用Visual Studio 2010和C++时,使用Doxygen存在一些效率上的困难。
除了“取消/注释行”之外,是否还有其他的注释功能?例如生成注释桩,并在新行后添加///
。
此外,我想知道在VS2010的IntelliSense功能中显示这些注释所需的条件是什么?
我在使用Visual Studio 2010和C++时,使用Doxygen存在一些效率上的困难。
除了“取消/注释行”之外,是否还有其他的注释功能?例如生成注释桩,并在新行后添加///
。
此外,我想知道在VS2010的IntelliSense功能中显示这些注释所需的条件是什么?
//
或/*
分隔符的任何注释都将显示在IntelliSense成员列表中与其相关联的成员旁边。/doc
文档解释了如何在IntelliSense中使用XML文档:
AtomineerUtils是最好的用于doxygen/javadoc/DocXML文档的Visual Studio插件之一。它不是免费的,但在doxygen助手工具列表中没有针对Visual Studio 2010的工具。要在IntelliSense中使用生成的.xml文件,请将.xml文件的文件名与要支持的程序集相同,并将.xml文件放在与程序集相同的目录中。当在Visual Studio项目中引用程序集时,也会找到.xml文件。
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
欢迎编辑或重复使用此宏,我也欢迎任何批评意见。