2016-07-26 84 views
1

我有这片文档:如何正确格式化类的实例引用

/** 
* This method creates an import job for the given @arg item 
* 
* The default implementation should be suitable for most needs, 
* it'll create an instance of @class ImportProjectJob 
* 
* @return a job that imports the project 
*/ 
virtual KJob* createImportJob(ProjectFolderItem* item); 

但是@class并不意味着这样来使用并没有什么像doxygen的@instanceof。 我应该如何格式化?

+0

'@ arg','@ class','@ fn'和相似不意味着语义标注而是告诉Doxygen的开始一个特殊的部分。 –

回答

2

在Doxygen的automatic link generation rules下,如果某些文档文本与已记录类的名称相匹配,且该文本使用了interCaps命名样式,则Doxygen会自动将该文本转换为该文档页面的链接。所以,如果你只是使用“ImportProjectJob”,Doxygen会找到那个类(如果它已经被记录)并且将该文本转换成它的链接。

但是,如果你的类/功能不使用interCaps命名,你可以明确地通过@ref链接到一个文档实体:

* The default implementation should be suitable for most needs, 
* it'll create an instance of @ref ImportProjectJob 

FYI:@arg是为启动功能的参数列表定义。喜欢的东西:

@arg @c AlignLeft left alignment. 
@arg @c AlignCenter center alignment. 
@arg @c AlignRight right alignment 

你在找什么是@p,这是引用参数名称等内嵌格式。

2

只需使用@ref而不是@class并记录它声明的类。

通常(默认情况下,即当AUTOLINK_SUPPORTYES时),甚至没有必要明确引用它。 Doxygen会在检测到名称时自动连接它。

顺便说一句,您使用@arg不是预期的。用于内联参考的@p和用于记录方法参数的@param


/** 
    * @brief This method creates an import job for the given @p item 
    * 
    * @details The default implementation should be suitable for most needs, 
    * it'll create an instance of ImportProjectJob 
    * 
    * @param item this is a folder item 
    * 
    * @return a job that imports the project 
    */ 
virtual KJob* createImportJob(ProjectFolderItem* item); 

而这正是ImportProjectJob声明:

/** 
    * @brief short desc of the class 
    * 
    * @details A long description 
    */ 
class ImportProjectJob : public KJob 
{};