VA的快捷键注释很好用,但默认的几种注释风格有一些单调,在开发中经常需要针对建立文件,修改,合并等不同动作进行不同注释。
笔者在编辑注释模板时遇到一些展开宏的名字不甚清楚,查阅了下列官方文档后解决问题。
文档中的宏定义:
Code
| 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 | |
例子:
/****************************************************************
// FileName: $FILE_BASE$.$FILE_EXT$
// Author: freshbug
// Create: $MONTH$-$DAY$-$YEAR$
// Company: fresh-lab
// Checked: freshbug $MONTH$-$DAY$-$YEAR$
****************************************************************/
效果:
/****************************************************************
// FileName: BufferServerMsg.h
// Author: freshbug
// Create: 11-22-2008
// Company: fresh-lab
// Checked: freshbug 11-22-2008
****************************************************************/
原文连接请看这里:http://www.wholetomato.com/products/features/vasnippets.asp


分享到做啥
分享到收客
