VA使用技巧
Reserved String | Meaning | |
Date | $DATE$ | Year/month/day formatted as %04d/%02d/%02d |
$DAY$ | Day of month formatted as %d | |
$DAY_02$ | Day of month formatted as %02d | |
$DAYNAME$ | Three-character abbreviation of day | |
$DAYLONGNAME$ | Full name of day | |
$MONTH$ | Month formatted as %d | |
$MONTH_02$ | Month formatted as %02d | |
$MONTHNAME$ | Three-character abbreviation of month | |
$MONTHLONGNAME$ | Full name of month | |
$YEAR$ | Year formatted as %d | |
$YEAR_02$ | Year formatted as %02d | |
File | $FILE$ | Full filename with path* |
$FILE_UPPER$ | Full filename with path in uppercase* | |
$FILE_BASE$ | Filename without path or extension* | |
$FILE_BASE_UPPER$ | Filename without path or extension in upper case* | |
$FILE_EXT$ | Filename extension* | |
$FILE_EXT_UPPER$ | Filename extension in upper case* | |
$FILE_PATH$ | Path of file* | |
$FILE_PATH_UPPER$ | Path of file in upper case* | |
General | $clipboard$ | Current clipboard |
$end$ | Position of caret after expansion | |
$selected$ | Current selection** | |
$$ | $ | |
GUID | $GUID_DEFINITION$ | Generated GUID formatted for use in a definition |
$GUID_STRING$ | Generated GUID formatted for use in a string | |
$GUID_STRUCT$ | Generated GUID formatted for use in a struct | |
(Note that all instances of GUID reserved words will use a singe generated GUID.) | ||
Refactor | $GeneratedPropertyName$ | Property name generated during Encapsulate Field |
$MethodArg$ | One parameter of the method and its type | |
$MethodArgName$ | One parameter of the method | |
$MethodArgType$ | Type of one parameter of the method | |
$MethodBody$ | Body of implementation | |
$MethodQualifier$ | Optional qualifiers of method | |
$ParameterList$ | Parameters separated by commas | |
$SymbolContext$ | Context and name of method | |
$SymbolName$ | Name of method | |
$SymbolPrivileges$ | Access of method | |
$SymbolStatic$ | Keyword static or blank | |
$SymbolType$ | Return type of method | |
$SymbolVirtual$ | Keyword virtual or blank | |
Time | $HOUR$ | Hour formatted as %d |
$HOUR_02$ | Hour formatted as %02d | |
$MINUTE$ | Minute formatted as %02d | |
$SECOND$ | Second formatted as %02d |
http://www.cnblogs.com/hujianhua/archive/2013/08/18/3266020.html
http://www.cnblogs.com/greenerycn/archive/2011/05/31/2065221.html
在VC6.0里边,C++函数头注释是使用一个宏完成的,VS系列中C#在函数头输入三个反斜杠也会自动生成XML格式的函数头注释。
又懒得在VS2008中写类似于添加函数头的注释,只能依靠一些工具了,今天给大家介绍VAssistX。
大家可以下载VAssistX插件,安装的时候一定要把VS2008关掉。VAssistX在这就不多做介绍了,大家可以百度或者google之。
以下为大家介绍一下怎么添加函数头注释
随便打开一个C++的工程,找到一个方法,右击函数名,然后依次点击“Refacto”–>“Document Method”,这个时候函数头注释是不是已经出来了,很方便吧。
但是这个注释格式是默认的,可能不适合你的项目。可以在VAssistX的选项中更改显示样式,在VS2008中点击 “VAssistX”–>”Visual VAssistX Options”然后选择Suggestions,再点击”Edit VA Snippets”
在打开的窗口中选择Refactor Document Method,在这就可以更改你的显示样式了。
- //************************************
- // 函数名称: $SymbolName$
- // 函数说明:
- // 作 成 者:Mr.M
- // 作成日期:$DATE$
- // 返 回 值: $SymbolType$
- // 参 数: $MethodArg$
- //************************************
这是我设置的,大家赶快试试吧。这个插件会大大的提高你的工作效率。
我的设置
Refactor Create Header File中设置 //************************************************* // Copyright (c) 2011,杭州**. All rights reserved. // File name: $FILE_BASE$.$FILE_EXT$ // Author: ** // Version: 1.0 // Date: $DATE$ // Description: // Others: // History: //************************************************* #ifndef __$FILE_BASE_UPPER$_H__ #define __$FILE_BASE_UPPER$_H__ $selected$ #endif //__$FILE_BASE_UPPER$_H__
Refactor Document Method
//************************************************************************* //Description: nothing //Access: $SymbolVirtual$$SymbolPrivileges$$SymbolStatic$ //@param $MethodArgName$ //@return $SymbolType$ //Example: //Other: //*************************************************************************