Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented crude parsing of typedef enum definitions with comments
- Loading branch information
robvdveer
committed
Jul 25, 2013
1 parent
7e05a41
commit 3df677f
Showing
11 changed files
with
266 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// GBEnumConstantData.h | ||
// appledoc | ||
// | ||
// Created by Rob van der Veer on 25/7/13. | ||
// Copyright (c) 2013 Gentle Bytes. All rights reserved. | ||
// | ||
|
||
#import "GBModelBase.h" | ||
|
||
@interface GBEnumConstantData : GBModelBase | ||
{ | ||
@private | ||
NSString *_name; | ||
} | ||
+(id)constantWithName:(NSString *)name; | ||
|
||
@property (readonly) NSString *name; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// GBEnumConstantData.m | ||
// appledoc | ||
// | ||
// Created by Rob van der Veer on 25/7/13. | ||
// Copyright (c) 2013 Gentle Bytes. All rights reserved. | ||
// | ||
|
||
#import "GBEnumConstantData.h" | ||
|
||
@implementation GBEnumConstantData | ||
+(id)constantWithName:(NSString *)name | ||
{ | ||
return [[[GBEnumConstantData alloc] initWithName:name] retain]; | ||
} | ||
|
||
-(id)initWithName:(NSString *)name | ||
{ | ||
self = [super init]; | ||
if(self) | ||
{ | ||
_name = name; | ||
} | ||
return self; | ||
} | ||
|
||
@synthesize name = _name; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// GBEnumConstantProvider.h | ||
// appledoc | ||
// | ||
// Created by Rob van der Veer on 25/7/13. | ||
// Copyright (c) 2013 Gentle Bytes. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "GBEnumConstantData.h" | ||
|
||
@interface GBEnumConstantProvider : NSObject | ||
{ | ||
@private | ||
NSMutableArray *_constants; | ||
id _parent; | ||
BOOL _useAlphabeticalOrder; | ||
} | ||
|
||
- (id)initWithParentObject:(id)parent; | ||
- (void)registerConstant:(GBEnumConstantData *)constant; | ||
|
||
@property (readonly) NSArray *constants; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// GBEnumConstantProvider.m | ||
// appledoc | ||
// | ||
// Created by Rob van der Veer on 25/7/13. | ||
// Copyright (c) 2013 Gentle Bytes. All rights reserved. | ||
// | ||
|
||
#import "GBEnumConstantProvider.h" | ||
|
||
@implementation GBEnumConstantProvider | ||
|
||
- (id)initWithParentObject:(id)parent { | ||
NSParameterAssert(parent != nil); | ||
GBLogDebug(@"Initializing enumConstant provider for %@...", parent); | ||
self = [super init]; | ||
if (self) { | ||
_parent = [parent retain]; | ||
_constants = [[NSMutableArray alloc] init]; | ||
_useAlphabeticalOrder = YES; | ||
} | ||
return self; | ||
} | ||
|
||
-(void)registerConstant:(GBEnumConstantData *)constant { | ||
|
||
} | ||
|
||
@synthesize constants = _constants; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// GBTypedefEnumData.h | ||
// appledoc | ||
// | ||
// Created by Rob van der Veer on 25/7/13. | ||
// Copyright (c) 2013 Gentle Bytes. All rights reserved. | ||
// | ||
|
||
#import "GBModelBase.h" | ||
#import "GBObjectDataProviding.h" | ||
#import "GBEnumConstantProvider.h" | ||
|
||
@interface GBTypedefEnumData : GBModelBase | ||
{ | ||
@private | ||
NSString *_typedefName; | ||
GBEnumConstantProvider *_constants; | ||
} | ||
|
||
+(id)typedefEnumWithName:(NSString *)name; | ||
|
||
@property (readonly) NSString *nameOfEnum; | ||
@property (readonly) GBEnumConstantProvider *constants; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// GBTypedefEnumData.m | ||
// appledoc | ||
// | ||
// Created by Rob van der Veer on 25/7/13. | ||
// Copyright (c) 2013 Gentle Bytes. All rights reserved. | ||
// | ||
|
||
#import "GBTypedefEnumData.h" | ||
|
||
@implementation GBTypedefEnumData | ||
+(id)typedefEnumWithName:(NSString *)name | ||
{ | ||
return [[[self alloc] initWithName:name] autorelease]; | ||
} | ||
|
||
-(id)initWithName:(NSString *)name | ||
{ | ||
self = [super init]; | ||
if(self) | ||
{ | ||
_typedefName = name; | ||
_constants = [[GBEnumConstantProvider alloc] initWithParentObject:self]; | ||
} | ||
return self; | ||
} | ||
|
||
- (NSString *)description { | ||
return self.nameOfEnum; | ||
} | ||
|
||
- (NSString *)debugDescription { | ||
return [NSString stringWithFormat:@"enum %@\n%@", self.nameOfEnum, self.constants.debugDescription]; | ||
} | ||
|
||
- (BOOL)isTopLevelObject { | ||
return YES; | ||
} | ||
|
||
@synthesize nameOfEnum = _typedefName; | ||
@synthesize constants = _constants; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters