c++doxygen

Doxygen: How to reference a function, but with arguments values


When I generate the documentation for this class:

class MyClass
{
    /** Some description
     * \param inhibit some description
     */
    virtual void inhibitSaving( bool inhibit = true ) = 0;

    /** \return true if @ref inhibitSaving with parameter set to true has been called previously */
    virtual bool isSavinginhibited() const = 0;
};

isSavinginhibited's description has a hyperlink to inhibitSaving.

However, if I write the description as below:

/** \return true if @ref inhibitSaving(true) has been called previously */
virtual bool isSavinginhibited() const = 0;

isSavinginhibited's description does not have a hyperlink to inhibitSaving.

Considering this discussion, it's supposed to work. Why am I not getting a hyperlink. What am I doing wrong?


Solution

  • As commented by ArturKink, inhibitSaving(true) is not a valid type reference, only inhibitSaving(bool) is.

    So link should be created either like:

    \ref inhibitSaving(bool) "inhibitSaving(true)"
    

    Or like:

    \ref inhibitSaving "inhibitSaving(true)"
    

    Note that above basically customizes the text shown by the documentation, and you could put whatever you want in the quotes, but if we don't follow-up the \ref with quotes, then another usecase of \ref is when you don't want to specify each and every argument type, like:

    \ref inhibitSaving