1

I want Doxygen to force extraction of only specific private class members. I know about the EXTRACT_PRIVATE option, but it extracts all private members. I want to be able to pick and choose which private members I want to be extracted.

For example something like the following:

class Foo {
private:
  /** @forceextract
    * @brief Something about this function.
    */
  void foo1();

  /** @brief Something about this other function.
    */
  void foo2();
};

foo1()'s documentation should be extracted though it is private, but foo2() should be left alone.

Is it possible to do this?

albert
  • 8,285
  • 3
  • 19
  • 32
Masked Man
  • 1
  • 7
  • 40
  • 80

2 Answers2

0

As taken from here, you can use a labeled conditional section, then not include the section under ENABLED_SECTIONS:

class Foo {
private:
  /** @brief Blah blah blah */
  void foo1();

  /// @cond COND1

  /** @brief This will be hidden! */
  void foo2();
  /** @brief So will this */
  void foo3();
  /** @brief This should be hidden too */
  int fooInt;

  /// @endcond
};

Instead of having to add a condition to all the fields you want included AND adding all those conditions to the enabled sections list, you can just add conditions to fields which you do not want included. In this example, if you do not add COND1 to the ENABLED_SECTIONS, it should honor the fact that COND1 is not set, and thus will not include "foo2()" in the documentation. Make sure you still set EXTRACT_PRIVATE.

Edit: Sorry, my original answer said "include" instead of "not include" in regards to the section.

Community
  • 1
  • 1
Carlos Sanchez
  • 986
  • 1
  • 10
  • 17
  • I have literally thousands of private members in my application of which I want to extract only a handful ones. I am afraid it isn't practical to add conditions to the ones I do not want included. – Masked Man Nov 08 '13 at 06:45
  • You can group as many private members as you want under a single condition variable. If they're not in any particular order (like documented first), then yes, this won't really be practical. Another way to do it would be to simply not include the doxygen style documentation on members which you do not want documented (you can use regular comments) and specify HIDE_UNDOC_MEMBERS = YES (unless that's also not an option). – Carlos Sanchez Nov 08 '13 at 06:47
0

I figured out a somewhat roundabout alternative for this.

class Foo {
#ifdef DOXYGEN_EXTRACT
public:
#else
private:
#endif
  /** @forceextract
    * @brief Something about this function.
    */
  void foo1();

private:
  /** @brief Something about this other function.
    */
  void foo2();
};

Then define DOXYGEN_EXTRACT (or whatever tag you prefer) under PREDEFINED in the Doxyfile.

A couple of limitations/problems:

  • The members are shown as public in the output, not private.
  • You should remember to explicitly specify the access specifier for the next member.
Masked Man
  • 1
  • 7
  • 40
  • 80