代码注释方式:
1.基本规则
如你要为一个单元,一个类,字段,方法,变量,类型,常量,函数或过程等等做一些描述注释,你只要将注释放在这些声明的上面即可(注意:是声明,而不是实现!!即 implementation以上区域)。如:
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
| { Description of MyUnit. } unit MyUnit; interface type { Description of TMyClass. } TMyClass = class public { Description of MyField. } MyField: Integer; { Description of MyMethod. } procedure MyMethod; end; { Description of TMySimpleType. } TMySimpleType = 1..100; { Description of TMyEnumType. } TMyEnumType = ( { Description of meFirstValue. } meFirstValue, { Description of meSecondValue. } meSecondValue); const { Description of MyConstant. } MyConstant = 4; var { Description of MyVariable. } MyVariable: Integer; { Description of MyProcedure. } procedure MyProcedure; implementation ... end. |
在一个声明中的多个字段/变量,如:
01 02 03 04 05 06 07 08 09 10 11 12 13 |
| type TMyRecord = record { This comment documents Field1 and Field2 } Field1, Field2, { This comment documents Field3 and Field4 } Field3, Field4: Integer; end; var { This comment documents Variable1 } Variable1, { This comment documents Variable2 } Variable2: Integer; |
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 |
| unit MyUnit; {< Here you can place a description of MyUnit. This is convenient for people that like to always keep the "unit UnitName;" declaration as the first line of their *.pas files. } interface type TMyClass = class MyField: Integer; //< Description of MyField procedure MyProc; //< Description of MyProc property MyProp: Integer read MyField write MyField; //< Description of MyProp end; |
01 02 03 04 05 06 07 08 09 10 11 12 13 14 |
| { This is description of procedure Foo. } procedure Foo; // This is // description of // procedure Foo. procedure Foo; procedure Foo; //< This is // description of // procedure Foo. |
1 2 3 4 5 6 7 8 9 |
| type // This comment is overwritten later 这个注释待会被覆盖 TMyEnumType = ( // Description of meOne meOne, meTwo, //< Description of meTwo meThree ); //< Description of TMyEnumType, *not* of meThree |
1 2 3 4 |
| { procedure Foo; } { } procedure Bar; |
- @@: 字面上插入@字符
-
@abstract: 指定一个简短的摘要描述
-
@anchor: 在简介/结束语里面设置了一个看不见的锚
-
@author:指定作者的姓名(和电子邮件地址等)
-
@bold:使用加粗字体的格式化文本
-
@br: 强制换行
-
@cell: 创建一个表中的的单元格
-
@classname:插入类的名称
-
@code: 代码示例的格式化参数 (see alsoLongcodeTag)
-
@created:指定这个项目的创建日期
-
@cvs: 从cvs标签的 $Date 和 $Author关键字获得最后修改时间或作者姓名
-
@definitionList:创建定义列表
-
@deprecated:标记此项为已过时的
-
@exclude:从文档中排除这个项
-
@false:插入特殊格式的文本"false"
-
@html: 插入直接HTML代码到HTML输出
-
@image: 包括图像文件
-
@include:从文件中包含的描述
-
@inherited:插入祖先类或成员的名称
-
@inheritedClass:插入祖先类的名称
-
@italic:使用斜体字体的格式化文本
-
@item: 设为列表项
-
@itemLabel:定义列表内为下一个项定义标签
-
@itemSetNumber:更改有序列表里面的下一个项的数
-
@itemSpacing:控制列表中的项之间的垂直间距
-
@lastmod:指定这个项的最后修改日期
-
@latex: 插入直接LaTeX代码到LaTeX输出
-
@link: 插入到另一个项的链接
-
@member:指定这个结构描述为一个特定的成员(字段,属性,方法)
-
@name:插入这个项的名称
-
@nil:插入特殊格式的文本"nil"
-
@noAutoLink: 在这个标签里面的参数将从未使用自动链接
-
@noAutoLinkHere:从不自动链接到这个项
-
@orderedList: 创建有序列表
-
@param:描述此方法的参数(或过程/函数)
-
@preformatted:插入文本使用固定宽度字体和保留空白
-
@raises:描述通过这种方法可能引发的异常
-
@return, @returns:描述函数的返回值
-
@row: 创建一个表中的行
-
@rowHead:创建一个表中的标题行
-
@section: 在简介/结束语里面开始新的一节
-
@seealso:创建“See also”一节中给定的项目
-
@shorttitle: 简介/结束语的简称
-
@table: 创建一个表
-
@tableOfContents: 在简介/结束语里面插入表的内容
-
@title: 简介/结束语的标题
-
@true:插入特殊格式的文本"true"
-
@unorderedList: 创建无序列表
-
@value: 指定这个结构描述为一个特定的枚举值
其他一些特殊的@结构:
-
@-: 插入短破折号
-
@(: 插入左括号字符( seeTagsParametersMatching)
-
@): 插入右括号字符 (seeTagsParametersMatching)
下载地址:
1.仅可执行程序:http://dl.dbank.com/c06bvf4xux http://good.gd/1663381.htm
2.可执行程序和源码:http://download.csdn.net/detail/akof1314/3666897 http://dl.dbank.com/c0hj8iza0p