Quantcast

Creating an example using snippet

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Creating an example using snippet

Mark
I want to create an example that will appear under “Examples” in the navigation that uses fragments from some of my source files to avoid duplicating that code and having to keep it the duplicates up to date.

My first try was

/** \example test.c */

and in test.c

/** \snippet mysource.c Marker */

This resulted in an empty “test.c” appearing in Examples.

So then I tried, with test.c being an empty file,

/**
\example test.c
\snippet mysource.c Marker
*/

This worked. I got a file test.c in Examples whose content is the snippet. So I got more adventurous:

/**
\example test.c
\dontinclude mysource.c
\skipline foo.h
\skip cbdata {
\until } cbdata
\snippet mysource.c Marker
*/

This worked too. I can’t shake a feeling that I’ve stumbled on a bug that happens to do what I want and so I should not rely on this behavior. Is there a proper way to do this?

If I leave out the \example then the snippet is included in the documentation for whatever is declared following this comment block.

Regards

    -Mark


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Doxygen-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/doxygen-users
Loading...