Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Annotating Methods in Delphi?

I have a piece of code that needs some serious documenting and wanted to ask whether a feature similar to C#/.NET's In-code XML-Documentation is available for Embarcadero Delphi. My aim is to display some sort of information on how to use a specific method correctly in the manner that it'd be highlighted in the Autocompletion in Delphi XE3.

Something like this (C#):

/// <summary> /// Some useful information helping other developers use this method correctly /// </summary> public static void ADocumentedMethod(); 

Does Delphi XE3 support something like this?

Thank you for reading.

like image 461
FLClover Avatar asked Mar 12 '13 12:03

FLClover


1 Answers

The feature is named XML Documentation Comments and is documented here. It appears to have been modelled closely on the equivalent .net feature so you should be right at home with it.

The documentation contains this example:

/// <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; 

which results in this help insight hint:

enter image description here

And there are various other ways to process and consume the documentation.

like image 192
David Heffernan Avatar answered Oct 04 '22 10:10

David Heffernan