我已经记录了所有的课程,现在我想集成一个使用这些课程的示例。我该怎么做?
EXAMPLE_PATH
中,并使用@example
标签插入示例。@code ... @endcode
插入它们。另一种方法是使用\snippet
命令。
在 TestClass.cpp 文件中,添加以下内容:\section ex1 Example \snippet path_to_test_class/TestClass.cpp TestClass example \section ex2 Expected output \snippet path_to_test_class/TestClass.cpp TestClass expected output
//! [OptimizeSpeedOnTrackTest example]
Class c;
const double res = c.do_something();
//! [OptimizeSpeedOnTrackTest example]
//! [OptimizeSpeedOnTrackTest expected output]
ASSERT_DOUBLE_EQ(5,res);
//! [OptimizeSpeedOnTrackTest expected output]
path_to_test_class
必须在你的EXAMPLE_PATH路径下。
这会带给你以下好处:
// [TestClass Example]
。 - mrtnlrsn/** @example examplefile.cs
* A description of the example file, causes the example file to show up in
* Examples */
/** @brief MyClass does something
* @details I have something more long winded to say about it. See example
* in examplefile.cs: @include examplefile.cs */
添加一个在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