1

我使用的是 Delphi 10.3,是否可以直接从 IDE 生成 XML 文档?像 Java 一样使用 /** + [Enter] 生成带有参数的 Java 文档?

4

2 回答 2

5

我不了解Java系统,但是使用Delphi(不知道它是在哪个版本中引入的),您必须在项目选项(Building / Delphi Compiler / Compiling / Other options)中设置“生成XML文档”。还有“XML 文档输出目录”。

编译器生成的 XML 文档是根据编译器用于类、方法、变量等的内部表示创建的。

您可以在源代码中引入 XML 文档注释:

/// <summary> Removes the specified item from the collection
/// </summary>
/// <param name="Item">The item to remove
/// </param>
/// <param name="Collection">The group containing the item
/// </param>
/// <remarks>
/// If parameter "Item" is null, an exception is raised.
/// <see cref="EArgumentNilException"/>
/// </remarks>
/// <returns>True if the specified item is successfully removed;
/// otherwise False is returned.
/// </returns>
function RemoveItem(Item: Pointer; Collection: Pointer): Boolean;
begin
  // Non-XML DOC comment
  // ...
end;
于 2020-09-21T15:24:09.580 回答
4

Delphi 已经为 XMLDOC 提供了一些 Live Templates。Fi 当您在编辑器中键入单词summary并按 TAB 时,它将扩展为摘要 XMLDOC 注释。还有其他名为paraparamcomments的模板。

于 2020-09-21T15:21:52.410 回答