2011-04-12 78 views
4

如果我的文檔與我的代碼分離,如何幫助Doxygen區分重載函數(在\fn字段中使用什麼)?一個函數將被記錄如下:Doxygen:記錄重載函數

void func() { 
} 

/** 
    \fn func 
    \details Description here. 
    */ 

如果我有兩個函數func怎麼辦?

void func() { 
} 

void func(int i) { 
} 

/** 
    \fn [What goes here?] 
    \details Description here. 
    */ 

回答

4

您可以簡單地記錄每個重載,就像它是一個單獨的方法(它實際上是:-) - 只需將整個方法簽名放在\ fn命令中,而不僅僅是方法的名稱。如:

/** 
    \fn func() 
    \details Description here. 
*/ 
void func() { } 

/** 
    \fn func(int i) 
    \details Description here. 
*/ 
void func(int i) { } 

(對不起,我只是不得不搬到以上屬於他們的地方:-)

事實上這些方法的文檔註釋,你不需要\ FN命令不惜一切,如果該評論直接在它所涉及的代碼元素之前。

/** 
    \details Description here. 
*/ 
void func() { } 

/** 
    \details Description here. 
*/ 
void func(int i) { } 
15

在這種情況下有一個\ overload doxygen命令。見the doxygen command reference。使用您的常規\ fn命令作爲基本情況,並使用\ overload作爲任何重載。 :)