2011-10-28 30 views
7

我在我的C++代码中有typedef结构。截至目前,它们被列为\var typedef。有一个更好的方法吗?下面是我的例子:我应该如何用Doxygen分类typedef?

/*! \var typedef etc 
* \brief A type defined structure for etc 
* 
* \param x type- Variable declaration for x 
* \param y type- Variable declaration for y 
*/ 

我知道我甚至不应该说param。还有什么可用的?

+1

为什么'typedef'?这是C++,而不是C. – Pubby

+5

@ Pubby8:''typedef's仍然用于C++来提高代码的可读性。 'typedef'的一个流行用法是创建指向函数的指针。另一个是模板。 –

+2

@ThomasMatthews我可以用这种方式使用typedef,但为什么'typedef struct'而不是'struct'? – Pubby

回答

21

如果将注释块放在typedef的前面,则不需要使用任何特殊命令。

/** This is the documentation for the following typedef */ 
typedef MyClass MyTypedef; 

如果你喜欢把它之后typedef的使用:只有

typedef MyClass MyTypedef; 
/**< This is the documentation for the preceding typedef */ 

当注释块必须在不同的位置比实际的typedef,你需要使用\类型定义。