jeudi 23 avril 2015

How to document overloaded functions in Doxygen?

I am getting a warning message when documenting overloaded functions.

Doxygen version 1.8.7

I have an implementation class and a header class. The header class declares two virtual functions, the second of which overloads the first.

ClassA.h

    virtual void doSomething(int i); 
    virtual void doSomething(int i,int j);`

The implementation class implements each virtual function, as follows

ClassA.cpp

    void doSomething(int i) { 
    printf ("doSomething: %d", i); 
    }

    void doSomething(int i,int j) { 
    printf ("doSomething: %d", i); 
    printf ("doSomething: %d", j); 
    }

I need to document both doSomething functions in doxygen. How do I do it?

I have tried documenting the .h file as follows:

Attempt 1:

ClassA.h

    /*! 
    * \fn void doSomething(int i) 
    * do something with i 
    */ 
    virtual void doSomething(int i); `

    /*! 
    * \fn void doSomething(int i, int j) 
    * do something with i and j 
    */ 
    virtual void doSomething(int i,int j);

Attempt 2:

    /*! 
    * \fn void doSomething(int i) 
    * do something with i 
    */ 
    virtual void doSomething(int i); 

    /*! 
    * \overload void doSomething(int i, int j) 
    * do something with i and j 
    */ 
    virtual void doSomething(int i,int j);

I have also tried to document the .cpp file in the same way, with and without documenting the .h file.

However, whichever way I try, I always get the same warning message, which is:

    ClassA.cpp: warning: no uniquely matching class member found for void doSomething(int i) 
    Possible candidates: 
    virtual void doSomething(int i) at line 123 of file ClassA.h 
    virtual void doSomething(int i, int j) at line 135 of file Class.h

    ClassA.cpp: warning: no uniquely matching class member found for void doSomething(int i,int j) 
    Possible candidates: 
    virtual void doSomething(int i) at line 123 of file ClassA.h 
    virtual void doSomething(int i, int j) at line 135 of file Class.h

Note: Ideally I would prefer to document only the .cpp file and not the .h file in order to resolve this problem.

Aucun commentaire:

Enregistrer un commentaire