Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doxygen fail to detect NS_ENUM in objective-c

I'm using Doxygen to document API written in Objective-C.
Doyxygen fail to understand NS_ENUM typedef.

I've found this solution but it did not work for me.

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

Regards, 
  Dimitri 

This is my input file:

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

This is the output I get:

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...
like image 687
Ido Ran Avatar asked Apr 16 '14 06:04

Ido Ran


2 Answers

The following settings worked for us:

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

With this we see all the NS_ENUM structures showing up in our doxygen generated documentation

like image 155
gyurisc Avatar answered Sep 27 '22 21:09

gyurisc


If Doxygen fails, you can always try HeaderDocs.

EDIT: I tried headerdocs with a test class and I think it does provide good support of 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

Here is the headerdoc2html:http://pastebin.com/q6RsR0tU

like image 27
Athan Avatar answered Sep 27 '22 21:09

Athan