20

I have a class which has may functions and i want to hide a particular function. For example

class Test
{

   /**
    * About Function1
    *
    * @param[in]  arg1  About arg1
    * @param[in]  arg2  About arg2
    */        
    public void Function1(int arg1,char arg2);

    // Presume same documentation for this function also
    public void Function2(int,char);

    // Presume same documentation for this function also
    public void Function3(int,char);

    // Presume same documentation for this function also
    public void Function4(int,char);
} 

Suppose I want to hide say Function2 how would I do that.

Now in the current scenario it is displaying all the four functions along with its documentations.

Now, I have the following attribute set in my .doxygen rule file:

EXTRACT_ALL = YES

Can you please suggest me something by which i can hide say Function2?

CinCout
  • 9,486
  • 12
  • 49
  • 67
Rana
  • 457
  • 1
  • 3
  • 9

4 Answers4

26

If you have EXTRACT_PRIVATE = NO in the config file, then you can mark any member as private to Doxygen and it will not generate documentation for that member:

/// @private
public void Function2(int, char);

Bonus question: if you wanted to use the same documentation for all four members you can do so using one of these approaches:

/// @{
/**
 * About Function1,2,3,4...
 */
public void Function1(int arg1, char arg2);
public void Function2(int arg1, char arg2);
public void Function3(int arg1, char arg2);
public void Function4(int arg1, char arg2);
/// @}

/**
 * About Function1,2,3,4...
 */
public void Function1(int arg1, char arg2);
/// @copydoc Function1
public void Function2(int arg1, char arg2);
/// @copydoc Function1
public void Function3(int arg1, char arg2);
/// @copydoc Function1
public void Function4(int arg1, char arg2);

The one using @{...@} requires the use of DISTRIBUTE_GROUP_DOC = YES in the config file.

Oktalist
  • 14,336
  • 3
  • 43
  • 63
17

Use cond or internal

/*! \cond PRIVATE */
//only documented if cond is enabled
// ...
/*! \endcond */
Totonga
  • 4,236
  • 2
  • 25
  • 31
14

Do something like this:

#ifndef DOXYGEN_SHOULD_SKIP_THIS

 /* code that must be skipped by Doxygen */
 /* in your case a method/function */

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

And in the config file, put PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS Make sure that ENABLE_PREPROCESSING is set to YES.

In short, you are just leveraging the preprocessor concept to work for you!

CinCout
  • 9,486
  • 12
  • 49
  • 67
  • i think writing this will mesh up my – Rana Apr 11 '14 at 06:42
  • and why exactly do you think so? @Rana – CinCout Apr 11 '14 at 07:30
  • thanks a lot for quick response. In my project i have around 2000 odd files and it is quite impossible to do this change though it looks very good solution. If you can suggest something by which i will put something in the documentation and then with some setting in configuration file i will be able to skip that function.Thanks – Rana Apr 11 '14 at 08:38
  • Well I can't recall any alternate solution. In our case, we document the code as soon as we write a method. So , if we're interested in preventing it from documenting, we just add this macro. But, you can club more than one methods/classes together in a single `#ifndef` to reduce some effort. – CinCout Apr 11 '14 at 09:28
  • Bad idea to write C++ valid code to document your project. – Isaac Pascual Dec 21 '18 at 12:56
1

I think I once used the EXCLUDE_SYMBOLS to achieve something like this.

The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names (namespaces, classes, functions, etc.) that should be excluded from the output. The symbol name can be a fully qualified name, a word, or if the wildcard * is used, a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test

Unfortunately I can't completely recall nor find the config entry.

EXCLUDE_SYMBOLS = Test::Function2*
George Sovetov
  • 4,942
  • 5
  • 36
  • 57
Sambuca
  • 1,224
  • 18
  • 30
  • i tried adding the following code like EXCLUDE_SYMBOLS = Agent::Label(int) const to skip this function from output but it didn't work where Lebel is a function with following signature void Label(int) const – Rana Apr 15 '14 at 07:23