1

I have a situation in C++ where there are factory methods with different names and return values, but many common parameters. For example:

SomeType1 *getSomeType1 (const std::string &name, int id);
SomeType2 *getSomeType2 (const std::string &name, int id, int specific_to_type2);
SomeType3 *getSomeType3 (const std::string &name, int id, int specific_to_type3);

Except in my real case, there are several dozen methods and six to seven common parameters. Is there a way to tell Doxygen to define common parameters for a block of related methods like this? Otherwise, I'm stuck with repeating all of the information for each method, and not only is it tiresome and bulky, it's harder to maintain and ultimately hard to read.

I've searched for "Doxygon" and "repetitive" or "repeated" methods and/or parameters but without any luck.

arghol
  • 745
  • 9
  • 21
goug
  • 2,294
  • 1
  • 11
  • 15
  • 1
    Have a look at `\copy..` and also at `\snippet...`, otherwise a more complete example would be useful. Maybe also the `\name` or `\*group` commands might help. – albert Jan 06 '20 at 21:27
  • 1
    Does this answer your question? [Doxygen -- Single Comment Block for Multiple Functions](https://stackoverflow.com/questions/37284399/doxygen-single-comment-block-for-multiple-functions) – Scheff's Cat Jan 07 '20 at 06:25
  • I’d consider grouping the common parameters into a (perhaps trivial) struct to make the signatures less redundant. – Davis Herring Jan 08 '20 at 05:10
  • I looked into the grouping, and although it was close to what I was looking for, I just bit the bullet and documented each separately. With regard to grouping the parameters, the goal was to document, not change a lot of code--and it would've been a lot. Also, it would've made the calling locations more complex than they needed to be with the only gain being a small one in the documentation, so I didn't feel like it was the right choice. – goug Jan 13 '20 at 20:42

0 Answers0