Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:entwickler:sourcecode-dokumentation [2015/11/30 10:05] – [A complete documented function] ximex | en:entwickler:sourcecode-dokumentation [2016/12/03 14:53] (current) – ximex | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Sourcecode-Documentation ====== | ====== Sourcecode-Documentation ====== | ||
==== Doxygen ==== | ==== Doxygen ==== | ||
- | The documentation of our classes and functions should be done with[[http:// | + | The documentation of our classes and functions should be done with[[http:// |
==== Generate HTML view ==== | ==== Generate HTML view ==== | ||
Line 9: | Line 9: | ||
==== Format Comments for Doxygen ==== | ==== Format Comments for Doxygen ==== | ||
- | Comments must be specially marked so that they are recognized and processed by Doxygen as relevant. This is useful, but really only in class, method and function descriptions. This requires the comment normally is to be supplemented front of the class, method or function with special characters. <code php> // Description for subsequent function, as it was previously available in the source code. | + | Comments must be specially marked so that they are recognized and processed by Doxygen as relevant. This is useful, but really only in class, method and function descriptions. This requires the comment normally is to be supplemented front of the class, method or function with special characters. |
- | function foo($param)</ | + | <code php> |
- | function foo($param)</ | + | // Description for subsequent function, as it was previously available in the source code. |
- | * And more than one line | + | function foo($param) |
- | * / | + | </ |
- | function foo($param)</ | + | From this line of code should be the following syntax: |
+ | <code php> | ||
+ | /// Description for subsequent function, as it is optimized for Doxygen | ||
+ | function foo($param) | ||
+ | </ | ||
+ | Once there, however, more than one line, following Doxygen comment optimized code should be used: | ||
+ | <code php> | ||
+ | /** | ||
+ | * Description for subsequent function, as it is optimized for Doxygen | ||
+ | * And more than one line | ||
+ | */ | ||
+ | function foo($param) | ||
+ | </ | ||
+ | In a one-line comment a 3. Slash is appended, multiline comment at the beginning a 2nd asterisk.Now the comment will be considered in Doxygen. | ||
==== Documenting Parameters ==== | ==== Documenting Parameters ==== | ||
- | Parameters of functions or methods can be documented through a simple tag. For this purpose, the method only the tag **@ param** must be deposited in the comment section, followed by the parameter name and the description. <code php> ///param $ user_id The user ID of the current user </ code> Nestled in a method or function description that looks like <code php> / ** Description for subsequent function, as it is optimized for Doxygen | + | Parameters of functions or methods can be documented through a simple tag. For this purpose, the method only the tag **@ param** must be deposited in the comment section, followed by the parameter name and the description. |
- | | + | <code php> |
- | | + | ///param $ user_id The user ID of the current user |
+ | </ | ||
+ | Nestled in a method or function description that looks like | ||
+ | <code php> | ||
+ | /** | ||
+ | * Description for subsequent function, as it is optimized for Doxygen | ||
+ | * @param $user_id The user id of the current user | ||
+ | */ | ||
+ | </ | ||
==== Documenting Function return ==== | ==== Documenting Function return ==== | ||
- | Also, the return value of a function or method can be specially marked and appear as highlighted in the documentation. For this purpose, the method must have deposited only the tag **@ return** in the comment section, followed by the description of the return value. <code php> ///return Returns the value of the element or the error message if a test failed </ code> Nestled in a method or function description looks like this from <code php> / ** Description for subsequent function, as it is optimized for Doxygen | + | Also, the return value of a function or method can be specially marked and appear as highlighted in the documentation. For this purpose, the method must have deposited only the tag **@ return** in the comment section, followed by the description of the return value. |
- | | + | <code php> |
- | | + | ///return Returns the value of the element or the error message if a test failed |
+ | </ | ||
+ | Nestled in a method or function description looks like this from | ||
+ | <code php> | ||
+ | /** | ||
+ | * Description for subsequent function, as it is optimized for Doxygen | ||
+ | * @return Returns the value of the element or the error message if a test failed | ||
+ | */ | ||
+ | </ | ||
==== Documenting Example Code ==== | ==== Documenting Example Code ==== | ||
- | With Doxygen also sample code can be specifically shown, so that it is highlighted in the document and shows the syntax of the programming in color. This should first be defined with a kind of headline **@par** and then with **@ code** and **@encode ** the actual sample code embeded. | + | With Doxygen also sample code can be specifically shown, so that it is highlighted in the document and shows the syntax of the programming in color. This should first be defined with a kind of headline **@par** and then with **@ code** and **@encode ** the actual sample code embedded. |
<code php> | <code php> | ||
/ ** | / ** | ||
Line 69: | Line 98: | ||
} | } | ||
</ | </ | ||
- | Doxygen creates then [[http:// | + | Doxygen creates then [[https://www.admidio.org/ |