Doxygen无法检测objective-c中的NS_ENUM

Ido*_*Ran 5 nsenumerator doxygen objective-c

我正在使用Doxygen来记录用Objective-C编写的API.
Doyxygen无法理解NS_ENUM typedef.

我找到了这个解决方案,但它对我不起作用.

ENABLE_PREPROCESSING   = YES 
MACRO_EXPANSION        = YES 
EXPAND_ONLY_PREDEF     = YES 
PREDEFINED             = NS_ENUM(x,y)=y 

Regards, 
  Dimitri 
Run Code Online (Sandbox Code Playgroud)

这是我的输入文件:

/**
 *  Represent the possible states.
 */
typedef NS_ENUM(NSInteger, ABEnumType)
{
    /**
     *  State A.
     */
    StateA = 0,
    /**
     *  State B.
     */
    StateB
};
Run Code Online (Sandbox Code Playgroud)

这是我得到的输出:

Preprocessing /src/ABEnumType.h...
error: /src/ABEnumType.h:17:17: error: C++ requires a type specifier for all declarations [clang]
error: /src/ABEnumType.h:17:28: error: unknown type name 'ABEnumType' [clang]
error: /src/ABEnumType.h:18:1: error: function definition is not allowed here [clang]
error: /src/ABEnumType.h:17:9: error: C++ requires a type specifier for all declarations [clang]
Parsing file /src/ABEnumType.h...
Run Code Online (Sandbox Code Playgroud)

gyu*_*isc 5

以下设置适用于我们:

 ENABLE_PREPROCESSING   = YES 
 MACRO_EXPANSION        = YES 
 EXPAND_ONLY_PREDEF     = YES 
 PREDEFINED             = NS_ENUM(x,y)=enum y 
Run Code Online (Sandbox Code Playgroud)

有了这个,我们看到所有的NS_ENUM结构都出现在我们的doxygen生成文档中

  • 我不得不对此使用略有变化:`PREDEFINED ="NS_ENUM(type,name)= enum name"`.我的声明形式如下:`typedef NS_ENUM(NSInteger,NameOfEnum)` (2认同)

Ath*_*han 2

如果 Doxygen 失败,您可以随时尝试HeaderDocs

编辑:我尝试了带有测试类的 headerdocs,我认为它确实提供了对 NS_ENUM 的良好支持。

//
//  VLTTestClass.h
//  VPNLoginTest
//

#import <Foundation/Foundation.h>

/*!
 Test class type description.
 */
typedef NS_ENUM(NSInteger, VLTestClassType) {
    /*!
     Description for type 1.
     */
    VLTestClassType1,
    /*!
     Description for type 2.
     */
    VLTestClassType2
};

/*!
 Description for test class
 */
@interface VLTTestClass : NSObject

@end
Run Code Online (Sandbox Code Playgroud)

这是 headerdoc2html: http: //pastebin.com/q6RsR0tU