2

I know that a signal is just a function so the issue is not with documenting the signal itself. Imagine the following body of the function bar():

void MyFooBar::bar(int x) {
  if(x < 0) emit fooLess();
  else if(x > 0) emit fooGreater();
  else emit fooZero();
}

I would like to know if there is a common way of document signal emission. Currently I'm thinking about using a list:

/**
  * @brief Does something and emits the following signals
  * @param x Depending on its value following signals can be emitted:
  *           * fooLess - if x is less than 0
  *           * fooGreater - if x is greater than 0
  *           * fooZero - if x is equal to 0
  */
void bar(int x);

Obviously this is just an example. I'm looking for something like

/**
  * @brief Does something and emits the following signals
  * @param x A value of some sort
  * @emit fooLess If x < 0
  * @emit fooGreater If x > 0
  * @emit fooZero If x = 0
  */

but obviously this isn't present as a tag in doxygen since it's too language-specific.

rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
  • I always look how the official Qt classes are documented. But I don't know if any of them emits different signals depending on the state, they rather use one signal with a state enum as parameter. – xander Feb 15 '17 at 09:40
  • Maybe try to define your own command "emit " as an ALIAS (I didn't try it in this case). – albert Feb 15 '17 at 10:31
  • @xander I looked in the Qt API but didn't find anything. In my case I do also use flags as input parameter for my function and I do mention what happens when this and that flag (or combination of these) is selected but for readability I would like to have a separate listing for each function with all signals it emits (same for classes also). Actually the Qt classes documentation does something very similar (in terms of grouping the signals, slots etc. in separate sections on the page of the given class) but I have no idea whether doxygen can do that and if yes, how. – rbaleksandar Feb 15 '17 at 12:54
  • @albert Thanks, will look into it. Didn't even know that you can define custom commands in doxygen. :D – rbaleksandar Feb 15 '17 at 12:54

0 Answers0