You can put example source code in a special path defined in the doxygen config under EXAMPLE_PATH, and then insert examples with the @example tag.
Doxygen will then generate an extra page containing the source of the example. It will also set a link to it from the class documentation containing the example tag.
Alternatively if you want to use small code snippets you can insert them with @code ... @endcode
/** @example examplefile.cs
* A description of the example file, causes the example file to show up in
* Examples */
这会导致该文件显示在示例中的示例下Doxygen 菜单,但不会在项目中显示为类/文件。
然后记录你的类/函数:
/** @brief MyClass does something
* @details I have something more long winded to say about it. See example
* in examplefile.cs: @include examplefile.cs */
这会导致示例文件在 MyClass 的文档中完整打印出来。
I had some errors using @example to include the example file in the documentation. This is the workaround I used.
Place examplefile.cs in a folder/project specifically for example code. Place that folder in the Doxygen EXCLUDE list (Expert->Input->EXCLUDEin Doxygen GUI frontend) and in the EXAMPLE_PATH (Expert->Input->EXAMPLE_PATH in Doxygen GUI frontend)
Place this code block somewhere in a documented file (I put it in the file the example is for.)
/** @example examplefile.cs
* A description of the example file, causes the example file to show up in
* Examples */
This causes the file to show up under Examples in the Doxygen menu, but not show up as a class/file in your project.
Then document your class/function:
/** @brief MyClass does something
* @details I have something more long winded to say about it. See example
* in examplefile.cs: @include examplefile.cs */
This causes the example file to print out in it's entirety in the documentation of MyClass.
发布评论
评论(4)
您可以将示例源代码放在 doxygen 配置中定义的特殊路径中的
EXAMPLE_PATH
下,然后使用@example
标记插入示例。然后,Doxygen 将生成一个包含示例源代码的额外页面。它还会从包含示例标签的类文档中设置指向它的链接。
或者,如果您想使用小代码片段,可以使用
@code ... @endcode
插入它们。相关文档位于此处:
doxygen 文档?
You can put example source code in a special path defined in the doxygen config under
EXAMPLE_PATH
, and then insert examples with the@example
tag.Doxygen will then generate an extra page containing the source of the example. It will also set a link to it from the class documentation containing the example tag.
Alternatively if you want to use small code snippets you can insert them with
@code ... @endcode
The documentation for this is here:
doxygen documentation?
另一种方法是使用
\snippet
命令。path_to_test_class
必须位于您的 EXAMPLE_PATH 中。这为您提供了以下内容:
Another way of doing it is to use the
\snippet
command.path_to_test_class
must be in your EXAMPLE_PATH.This gives you the following:
我在使用 @example 将示例文件包含在文档中时遇到了一些错误。这是我使用的解决方法。
将
examplefile.cs
放置在专门用于示例代码的文件夹/项目中。将该文件夹放置在 Doxygen
EXCLUDE
列表中(Expert->Input->EXCLUDE,在 Doxygen GUI 前端)和EXAMPLE_PATH
中(Expert->Input->EXAMPLE_PATH在 Doxygen GUI 前端中)将此代码块放置在文档文件中的某个位置(我将其放在示例所在的文件中。)
这会导致该文件显示在示例中的示例下Doxygen 菜单,但不会在项目中显示为类/文件。
然后记录你的类/函数:
这会导致示例文件在 MyClass 的文档中完整打印出来。
I had some errors using @example to include the example file in the documentation. This is the workaround I used.
Place
examplefile.cs
in a folder/project specifically for example code.Place that folder in the Doxygen
EXCLUDE
list (Expert->Input->EXCLUDEin Doxygen GUI frontend) and in theEXAMPLE_PATH
(Expert->Input->EXAMPLE_PATH in Doxygen GUI frontend)Place this code block somewhere in a documented file (I put it in the file the example is for.)
This causes the file to show up under Examples in the Doxygen menu, but not show up as a class/file in your project.
Then document your class/function:
This causes the example file to print out in it's entirety in the documentation of MyClass.
为doxyfile添加一个方法
EXAMPLE_PATH = dir_example\
可以连接同一个文件中的所有示例,例如 example_list.h
并将其包含在 doxyfile 中
INPUT = example_list.h \
(语言 - 俄语)
http://www.scale-tech.ru/SimBookmaker/doc/html /examples__list_8h_source.html
和
http://www.scale-tech.ru/SimBookmaker/doc/html /examples.html
add a way to doxyfile
EXAMPLE_PATH = dir_example \
can connect all of the examples in the same file such example_list.h
and include it in doxyfile
INPUT = example_list.h \
(language - Russian)
http://www.scale-tech.ru/SimBookmaker/doc/html/examples__list_8h_source.html
and
http://www.scale-tech.ru/SimBookmaker/doc/html/examples.html