JoGr
JoGr

Reputation: 1557

Extract Doxygen doc for Python methods with one leading underscore but not methods with two leading underscores

In the Python code I'm working on there's a convention used that methods with one leading underscore are 'protected' and methods with two leading underscores are 'private'. Now I want to have Doxygen extract documentation for the all methods without underscore as well as all methods with one leading underscore, but not methods with two leading underscores.

The various settings and commands I've found either give me documentation for methods with no underscore only, or all methods (including methods with both one and two leading underscores).

Upvotes: 1

Views: 602

Answers (1)

doxygen
doxygen

Reputation: 14869

Doxygen currently has hardcoded behaviour that a method starting with _ is treated as private.

If you want to change this have a look at doxygen source code, in particular the newFunction() function in src/pyscanner.l should be changed into something like this:

static void newFunction()
{
  if (current->name.left(2)=="__" && current->name.right(2)=="__")
  {
    // special method name, see
    // http://docs.python.org/ref/specialnames.html
    current->protection=Public;
  }
  else if (current->name.left(2)=="__")
  {
    current->protection=Private;
  }
  else if (current->name.at(0)=='_')
  {
    current->protection=Protected;
  }
}

Upvotes: 2

Related Questions