Doxygen: attaching abstracts to examples



Today's piece follows yesterday's and describes how to tack on abstracts to examples using Doxygen.

1. Prepare a text file that contains only abstracts and associates each abstract to the example code it describes. Let's call it examples_doc. The example shows two abstracts for two examples:

/*! \example register.cc

There are two possible scenarios when registering command line arguments.
Both are useful but are intended for different work flows:

  • The first is simpler and faster. It is suitable in cases where
    users define, parse, and use command line arguments in the same source file
    (typically, in the main() function).
  • The second method allows users to define the command line arguments in
    a library and to use it in any source by including the .h file where command line arguments
    are defined.

*/

/*! \example ScopesDef.cc

This example demonstrates:
- How to define \c IdAbsDA subclasses corresponding to different scopes.
- How to register IDs
*/

Ensure that the name of the example following the \example tag is exactly the name of the example stored. Referencing ScopesDef.cpp when the name is ScopesDef.cc will not produce the results you need.

2. In the list of inputs referenced by the INPUT configuration parameter, add examples_doc.
3. Make sure the EXAMPLE_PATH parameter points to the folder(s) that contain the examples.

Now run Doxygen and voila.