How to Exclude A Method Inside A Class With Doxygen?

3 minutes read

To exclude a method inside a class with Doxygen, you can use the \cond and \endcond commands. These commands are used to toggle the inclusion of specific parts of the code in the generated documentation. Simply wrap the method you want to exclude between these commands, and it will not be documented when you generate the output. This can be useful if you have certain methods that are private or internal and do not need to be included in the documentation.


What is the syntax for excluding a method in doxygen?

To exclude a specific method from being documented in Doxygen, you can use the \cond and \endcond commands to surround the method that you want to exclude. The syntax is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
/**
 * This method will not be documented by Doxygen.
 * \cond
 */
void excludedMethod() {
    // Code for excluded method
}
/**
 * \endcond
 */


By wrapping the method with \cond and \endcond, Doxygen will ignore the method and not include it in the generated documentation.


How to exclude a constructor or destructor method in a class with doxygen?

To exclude a constructor or destructor method in a class with Doxygen, you can use the \cond and \endcond commands to surround the code that you want to exclude.


For example, if you have a constructor or destructor method in your class that you want to exclude from the Doxygen documentation, you can do the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
class MyClass {
public:
    /// \cond HIDE_CONSTRUCTOR
    MyClass();          ///< Constructor
    /// \endcond
    
    /// \cond HIDE_DESTRUCTOR
    ~MyClass();         ///< Destructor
    /// \endcond

    void someMethod();  ///< A public method
};


By using the \cond and \endcond commands, you are essentially telling Doxygen to ignore the constructor and destructor methods when generating the documentation. This way, the constructor and destructor methods will not appear in the generated documentation.


You can also use these commands to exclude other specific parts of your code from the Doxygen documentation, such as private methods or helper functions that are not meant to be documented.


How to exclude a virtual method in a class with doxygen?

To exclude a virtual method in a class from the Doxygen documentation, you can use the ignore command in the comments of the method that you want to exclude. Here's an example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class MyClass {
public:
    /**
     * This is a normal method that will be documented
     */
    void normalMethod();

    /**
     * \ignore
     * This is a virtual method that will be excluded from documentation
     */
    virtual void virtualMethod();
};


By adding the \ignore command in the comments of the virtual method, Doxygen will skip documenting that particular method. This way, the virtual method will be excluded from the generated documentation.


How to exclude a method from being cross-referenced in doxygen?

To exclude a specific method from being cross-referenced in Doxygen, you can use the \cond and \endcond commands to define a conditional section that will be excluded from the generated documentation. Here's how you can do it:

1
2
3
4
5
/// \cond SKIP_METHOD
void excludedMethod() {
    // This method will be excluded from cross-referencing
}
/// \endcond


By using \cond SKIP_METHOD and \endcond, you are telling Doxygen to ignore the content inside this conditional section when generating the documentation. This way, the excludedMethod will not be cross-referenced in the generated output.

Facebook Twitter LinkedIn Telegram Whatsapp

Related Posts:

To check if Doxygen is locked, you can look for a file named &#34;doxygenlock&#34; in the root directory of your project. This file is created by Doxygen when it is running, to ensure that only one instance of Doxygen is running at a time. If this file is pres...
To generate a changelog using Doxygen, you need to utilize Doxygen&#39;s support for changelog generation. This can be done by enabling the GENERATE_CHANGELOG option in the Doxygen configuration file. By setting this option to YES, Doxygen will include a chang...
To specify a markdown file as another tab in Doxygen, you can include the markdown file in the Doxygen configuration file by using the INPUT tag. This tag allows you to specify additional files or directories to be processed by Doxygen.Once you have added the ...
To put a blank line between two images in Doxygen, you can use HTML code to add a line break. Simply add or between the image tags of the two images in your Doxygen documentation. This will create a blank line separating the two images and improve the reada...
To include plain text files in Doxygen documentation, you can use the \verbatim command followed by the path to the text file you want to include. For example: \verbatim path/to/your/textfile.txt \endverbatim This will display the contents of the text file in ...