-
-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(src): add examples alias and general cleanup
- Loading branch information
1 parent
5b3de5f
commit 366f503
Showing
47 changed files
with
3,638 additions
and
806 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,76 @@ | ||
Source Code | ||
=========== | ||
We are in process of improving the source code documentation. Code should be documented using Doxygen syntax. | ||
Some examples exist in `main.h` and `main.cpp`. In order for documentation within the code to appear in the | ||
rendered docs, the definition of the object must be in a header file, although the documentation itself can (and | ||
should) be in the source file. | ||
Many examples exist throughout the codebase. | ||
|
||
Example Documentation Blocks | ||
---------------------------- | ||
Source | ||
------ | ||
For generated docs, refer to the `Doxygen Documentation <../doxyhtml/index.html>`_. | ||
|
||
**file.h** | ||
Guidelines | ||
---------- | ||
|
||
.. code-block:: c | ||
Doxygen Comments | ||
^^^^^^^^^^^^^^^^ | ||
|
||
// functions | ||
int main(int argc, char *argv[]); | ||
- Use Doxygen comments to document all functions, classes, and variables. | ||
- `Inline documentation block <Inline Documentation Blocks>`_ should use the following format: | ||
|
||
**file.cpp** (with markdown) | ||
.. code-block:: cpp | ||
.. code-block:: cpp | ||
///< A brief description of the member. | ||
- Multi-line comments, such as for a `documentation block <Documentation Blocks>`_, should use the following format: | ||
|
||
.. code-block:: cpp | ||
/** | ||
* @brief A brief description of the member. | ||
* More detailed description of the member. | ||
*/ | ||
/** | ||
* @brief Main application entry point. | ||
* @param argc The number of arguments. | ||
* @param argv The arguments. | ||
* | ||
* EXAMPLES: | ||
* ```cpp | ||
* main(1, const char* args[] = {"hello", "markdown", nullptr}); | ||
* ``` | ||
*/ | ||
int main(int argc, char *argv[]) { | ||
// do stuff | ||
} | ||
**file.cpp** (with ReStructuredText) | ||
Documentation Blocks | ||
^^^^^^^^^^^^^^^^^^^^ | ||
Documentation blocks should be placed above the declaration of the function, class, or variable. Below is an example | ||
of a documentation block for the main function. | ||
|
||
.. code-block:: cpp | ||
/** | ||
* @brief Main application entry point. | ||
* @param argc The number of arguments. | ||
* @param argv The arguments. | ||
* @rst | ||
* EXAMPLES: | ||
* | ||
* .. code-block:: cpp | ||
* main(1, const char* args[] = {"hello", "rst", nullptr}); | ||
* @endrst | ||
*/ | ||
int main(int argc, char *argv[]) { | ||
// do stuff | ||
} | ||
/** | ||
* @brief Main application entry point. | ||
* @param argc The number of arguments. | ||
* @param argv The arguments. | ||
* @return The exit code. | ||
* @examples | ||
* main(1, const char* args[] = {"hello", "markdown", nullptr}); | ||
* @end_examples | ||
*/ | ||
int main(int argc, char *argv[]); | ||
Source | ||
------ | ||
.. attention:: The `@examples` and `@end_examples` tags are not standard Doxygen tags. They are custom aliases | ||
we have specified to simplify documenting examples. Do not confuse this with the standard `@example` tag. | ||
|
||
Inline Documentation Blocks | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Inline comments can be used to describe enum values, variables, and other code constructs. | ||
To document the members of a file, struct, union, class, or enum, it is sometimes desired to place the documentation | ||
block after the member instead of before. For this purpose you have to put an additional `<` marker in the comment | ||
block. Below is an example of an inline comment for an enum value. | ||
|
||
Please refer to the `Doxygen Documentation <../doxyhtml/index.html>`_ for more details. | ||
.. code-block:: cpp | ||
.. todo:: Sphinx and Breathe do not support the Objective-C Domain. | ||
See https://github.com/breathe-doc/breathe/issues/129 | ||
enum class MyEnum | ||
{ | ||
FIRST_VALUE, ///< A brief description of the FIRST_VALUE | ||
SECOND_VALUE ///< A brief description of the SECOND_VALUE | ||
}; | ||
.. .. doxygenindex:: | ||
.. :allow-dot-graphs: | ||
Custom Aliases | ||
^^^^^^^^^^^^^^ | ||
We have defined some custom aliases to simplify documenting examples. | ||
|
||
.. Ideally, we would use `doxygenfile` with `:allow-dot-graphs:`, but sphinx complains about duplicated namespaces... | ||
- ``@examples`` - Start of an example block. This will format the following text as ``cpp``. | ||
- ``@examples_end`` - End of an example block. | ||
- ``@rst`` - Start of a reStructuredText block. This will format the following text as reStructuredText. | ||
- ``@rst_end`` - End of a reStructuredText block. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.