AcId
AcId

Reputation: 458

Does Doxygen have a line-continuation feature?

I would like to limit the length of lines in my source files to 80 characters. This is a problem when making Doxygen function links to functions that have long prototypes, e.g. because of long type names for the parameters.

Is it possible to have Doxygen ignore a linebreak in the comments (i.e. line-continuation) when generating the documentation?

Here is a MWE:

I have the following file named mwe.cpp

/**
 * \file mwe.cpp
 * 
 * \details
 * MWE::MWE(int a, int b, int c)
 * MWE::MWE(int a,
 *           int b, int c)
 */


class MWE
{
    public:
        /** 
         * \brief constructor with one parameter
         */
        MWE(int a);

        /** 
         * \brief constructor with three parameters
         **/
        MWE(int a, int b, int c);
}

When generating the documentation, the first link (MWE::func(int a, int b, int c)) correctly points to the constructor taking three integer parameters. However, the second link, where there is a line-break, points to the constructor taking only a single integer parameter (also the parameter list does not become part of the link, only the function name).

Is there a way to have Doxygen ignore the line-break?

Upvotes: 8

Views: 2441

Answers (1)

AcId
AcId

Reputation: 458

Thanks to albert's comment, I started searching the Doxygen bug reports and found this related bug report. The bug report has now been migrated to Github here.

Apparently the trick is to put the line-break inside an HTML comment.

The resulting code from the MWE is:

/**
 * \file mwe.cpp
 * 
 * \details
 * MWE::MWE(int a, int b, int c)
 * MWE::MWE(int a, <!--
 * -->         int b, int c)
 */


class MWE
{
    public:
        /** 
         * \brief constructor with one parameter
         */
        MWE(int a);

        /** 
         * \brief constructor with three parameters
         **/
        MWE(int a, int b, int c);
}

Not exactly a line-continuation feature, but it solves the problem. Now both links are identical and correctly points to the constructor taking three integer parameters.

Upvotes: 8

Related Questions