Visual Studio 2012 IntelliSense与Visual Assist X和Doxygen

时间:2013-04-03 11:52:01

标签: c++ visual-studio-2012 intellisense doxygen visual-assist

我曾经以

的方式在我的头文件中写简单的注释
// Returns a new string in which all occurrences of a specified string in the
// current instance are replaced with another specified string.
// - strSubject: The string to perform the replacement on.
// - strOldValue: The string to be replaced.
// - strNewValue: The string to replace all occurrences of strOldValue.
static RUNTIME_API String::type Replace
    (_In_       String::type  strSubject,
     _In_ const String::type& strOldValue,
     _In_ const String::type& strNewValue);

这样Visual Appist就会向我显示这条评论:

IntelliSense

目前我正在考虑使用Doxygen为项目创建文档,但是我正在努力寻找在工具提示中正确显示的文档样式,并且可以使用Doxygen进行解析。首先,我考虑在* .cpp文件中包含Doxygen样式注释,这样我只会显示标题注释。因此,在我的源文件中,我有一个评论,如

/*!
 * Returns a new string in which all occurrences of a specified string in the
 * current instance are replaced with another specified string.
 *
 * \param   strSubject  The string to perform the replacement on.
 * \param   strOldValue The string to be replaced.
 * \param   strNewValue The string to replace all occurrences of strOldValue.
 * 
 * \return  A string that is equivalent to the current string except that all
 *          instances of strOldValue are replaced with strNewValue. If
 *          strOldValue is not found in the current instance, the method returns
 *          the current instance unchanged.
 */
String::type String::Replace
    (_In_       String::type  strSubject,
     _In_ const String::type& strOldValue,
     _In_ const String::type& strNewValue) { /* ... */ }

令人惊讶的是,当悬停此功能或获取Visual Assists“IntelliSense”时,我会得到两个不同的输出。将Replace收益率悬停

Hover ToolTip

虽然提到的IntelliSense产生

enter image description here

然而,将Doxygen样式注释移动到标题中会产生奇怪的结果

enter image description here

我想知道您是否有建议我如何使用Qt样式的doxygen注释但是IntelliSense会显示相应的工具提示(无论哪个),而不是根据我调用的方式显示不同的工具提示? 必须有一种方法来统一这个。(或者我必须一如既往地工作并创建单独的纪录片标题,只包含doxygen评论 - 这样我就不会有问题但会有冗余数据)

1 个答案:

答案 0 :(得分:0)

我看到的唯一简单(但丑陋的方式)是添加一些预处理器指令以使Visual Studio忽略它

#if 0
/*! your comment
*/
#endif

您可能希望在#endif之后添加一些内容,以便您可以轻松地将其删除并进行研究并替换,而无需删除您需要的内容。至少在VS2013中它忽略了#if 0块。 有了这个,您应该能够将它们留在同一个文件中,这样可以减少痛苦。