Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I include a subset of a .cpp file in a Doxygen comment?
    primarykey
    data
    text
    <p>I'm trying to write some Doxygen comment blocks, and I'd like to include example snippets of code. Of course, I'd like the examples to actually compile so they don't get stale.</p> <p>My example.cpp (that I \include in the .h file) looks like this:</p> <pre><code>#include "stdafx.h" #include "../types_lib/Time_Limiter.h" #include &lt;vector&gt; void tl_demo () { // scarce will be a gate to control some resource that shouldn't get called // more than 10 times a second Time_Limiter scarce (10); // here's a bunch of requests std::vector&lt;int&gt; req (500); for (size_t i=0;i&lt;req.size ();i++) { scarce.tick (); // once we get here, we know that we haven't ticked // more than 10 times in the last second. // do something interesting with req[i] } } // endcode </code></pre> <p>and my header file (that I'm running Doxygen) looks like this:</p> <pre><code>/** * \ingroup types_lib * * \class Time_Limiter * * \brief Thread safe gate used to control a resource (such as an internet quote service) that has a limit on how often you can call it. * * \dontinclude Time_Limiter_example.cpp * \skipline void * \until endcode * **/ </code></pre> <p>And I'd like to get doxygen to just include stuff starting at "void demo" to the end of the file (but without the // endcode).</p> <p>I've tried experimenting with \dontinclude and \skip, \skipline, and \until, and I can't quite figure out the right incantations.</p> <p>EDIT: included my .h file, and now I've almost got the right incantation. This does <em>almost</em> exactly what I want, is there some way to use \until without a tag, and get rid of that last // endcode line from example.cpp?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload