8

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?

4
  • Which version of doxygen ae you using?
    – albert
    Oct 14, 2017 at 12:49
  • \detail should read \details in your file unless you defined \detail as an ALIAS, but in that case mention this in your question or better adjust your question so it uses standard doxygen commands.
    – albert
    Oct 14, 2017 at 12:52
  • @albert I am using Doxygen version 1.8.13.
    – AcId
    Oct 14, 2017 at 12:52
  • I'm not aware of a possibility. I think best is to file a bug report and requesting that line continuations are treated as white space. I don't know what the effect will be on the parser so I don't know if it will be honored.
    – albert
    Oct 14, 2017 at 12:58

1 Answer 1

8

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.

2
  • Please add your example to the bug report as it shines a bit a different light on the problem.
    – albert
    Oct 14, 2017 at 13:42
  • @albert I see you've added the example to the bug report. Thank you, much appreciated :)
    – AcId
    Oct 15, 2017 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.