9

I would like to create a custom command in Doxygen similar to \fn \param or \var.

For example I would like to be able to create a \option command which I would use as follows:

/**
  \option option_1 This is the first option.
  \option option_2 This is the second option.
*/

With an output like:

     Options:
          option_1 This is the first option.
          option_2 This is the second option.




A simple substitution alias does not work. For example with this alias:

ALIASES = option="\par Options:\n" 

I get the following output:

     Options:
          option_1 This is the first option.

     Options:
          option_2 This is the second option.

Which is not what I am looking for.


BOUNTY:

If any further clarification is needed, see my question: Doxygen - Create custom command

Community
  • 1
  • 1
amicitas
  • 13,053
  • 5
  • 38
  • 50

2 Answers2

3

While it is not as clean as @param, you can emulate similar behavior with the following aliases:

ALIASES += options="<dl class="params"><dt>Options</dt><dd><table class="params">"
ALIASES += option{2}="<tr><td class="paramname">\1</td><td>\2</td></tr>"
ALIASES += endoptions="</table></dd></dl>"

The aliases can be used as follows to produce the output you're looking for:

/**
 * @options
 * @option{ option_1, This is the first option. }
 * @option{ option_2, This is the second option. }
 * @endoptions
 */

Note: This is HTML-centric and likely will not produce reasonable output for other formats.

Max
  • 364
  • 1
  • 2
  • 10
DRH
  • 7,868
  • 35
  • 42
0

It looks like xrefitem might do what you want as answered in this previous question: Custom tags with Doxygen

Community
  • 1
  • 1
Eric Rahm
  • 688
  • 3
  • 5
  • 1
    What that command does is to create a separate page for the given command and create links to that page. The output for the method documentation is about the same as in my simple alias. Definitely not what I am looking for. – amicitas Mar 08 '11 at 02:21