mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 11:41:05 +00:00
Add outlet if it is a property
This commit is contained in:
parent
e778644329
commit
b43f7542cb
6 changed files with 55 additions and 37 deletions
|
@ -1885,12 +1885,15 @@
|
|||
{
|
||||
NSArray *methods = [cls methods];
|
||||
NSArray *ivars = [cls ivars];
|
||||
NSArray *properties = [cls properties];
|
||||
NSString *superClass = [cls superClassName];
|
||||
NSString *className = [cls className];
|
||||
NSEnumerator *ien = [ivars objectEnumerator];
|
||||
NSEnumerator *men = [methods objectEnumerator];
|
||||
NSEnumerator *pen = [properties objectEnumerator];
|
||||
OCMethod *method = nil;
|
||||
OCIVar *ivar = nil;
|
||||
OCProperty *property = nil;
|
||||
NSMutableArray *actions = [NSMutableArray array];
|
||||
NSMutableArray *outlets = [NSMutableArray array];
|
||||
|
||||
|
@ -1911,6 +1914,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
while((property = (OCProperty *)[pen nextObject]) != nil)
|
||||
{
|
||||
if([property isOutlet])
|
||||
{
|
||||
[outlets addObject: [property name]];
|
||||
}
|
||||
}
|
||||
|
||||
NSLog(@"outlets = %@", outlets);
|
||||
|
||||
if(([self isKnownClass: superClass] || superClass == nil) &&
|
||||
[cls isCategory] == NO)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ OCHeaderParser.h \
|
|||
OCIVar.h \
|
||||
OCIVarDecl.h \
|
||||
OCMethod.h \
|
||||
OCProperty.h \
|
||||
ParserFunctions.h
|
||||
|
||||
#
|
||||
|
@ -47,6 +48,7 @@ OCHeaderParser.m \
|
|||
OCIVar.m \
|
||||
OCIVarDecl.m \
|
||||
OCMethod.m \
|
||||
OCProperty.m \
|
||||
ParserFunctions.m
|
||||
|
||||
#
|
||||
|
|
|
@ -41,6 +41,7 @@ FOUNDATION_EXPORT const unsigned char GormObjCHeaderParserVersionString[];
|
|||
#include <GormObjCHeaderParser/OCIVar.h>
|
||||
#include <GormObjCHeaderParser/OCIVarDecl.h>
|
||||
#include <GormObjCHeaderParser/OCMethod.h>
|
||||
#include <GormObjCHeaderParser/OCProperty.h>
|
||||
#include <GormObjCHeaderParser/ParserFunctions.h>
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,15 +31,16 @@
|
|||
|
||||
@interface OCClass : NSObject
|
||||
{
|
||||
NSMutableArray *ivars;
|
||||
NSMutableArray *methods;
|
||||
NSMutableArray *protocols;
|
||||
NSMutableArray *properties;
|
||||
NSString *className;
|
||||
NSString *superClassName;
|
||||
NSString *classString;
|
||||
BOOL isCategory;
|
||||
NSMutableArray *_ivars;
|
||||
NSMutableArray *_methods;
|
||||
NSMutableArray *_protocols;
|
||||
NSMutableArray *_properties;
|
||||
NSString *_className;
|
||||
NSString *_superClassName;
|
||||
NSString *_classString;
|
||||
BOOL _isCategory;
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString *)string;
|
||||
- (NSArray *) methods;
|
||||
- (void) addMethod: (NSString *)name isAction: (BOOL)flag;
|
||||
|
@ -52,9 +53,9 @@
|
|||
- (BOOL) isCategory;
|
||||
- (void) setIsCategory: (BOOL)flag;
|
||||
- (NSArray *) properties;
|
||||
- (void) addProperty: (NSString *)name isOutlet: (BOOL)flag;
|
||||
|
||||
- (void) parse;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include <GormObjCHeaderParser/OCClass.h>
|
||||
#include <GormObjCHeaderParser/OCMethod.h>
|
||||
#include <GormObjCHeaderParser/OCIVar.h>
|
||||
#include <GormObjCHeaderParser/OCIVarDecl.h>
|
||||
#include <GormObjCHeaderParser/NSScanner+OCHeaderParser.h>
|
||||
#include <GormObjCHeaderParser/ParserFunctions.h>
|
||||
#include "GormObjCHeaderParser/OCClass.h"
|
||||
#include "GormObjCHeaderParser/OCMethod.h"
|
||||
#include "GormObjCHeaderParser/OCProperty.h"
|
||||
#include "GormObjCHeaderParser/OCIVar.h"
|
||||
#include "GormObjCHeaderParser/OCIVarDecl.h"
|
||||
#include "GormObjCHeaderParser/NSScanner+OCHeaderParser.h"
|
||||
#include "GormObjCHeaderParser/ParserFunctions.h"
|
||||
|
||||
@implementation OCClass
|
||||
- (id) initWithString: (NSString *)string
|
||||
|
@ -105,12 +106,12 @@
|
|||
|
||||
- (BOOL) isCategory
|
||||
{
|
||||
return isCategory;
|
||||
return _isCategory;
|
||||
}
|
||||
|
||||
- (void) setIsCategory: (BOOL)flag
|
||||
{
|
||||
isCategory = flag;
|
||||
_isCategory = flag;
|
||||
}
|
||||
|
||||
- (NSArray *) properties
|
||||
|
@ -118,16 +119,6 @@
|
|||
return _properties;
|
||||
}
|
||||
|
||||
- (void) addProperty: (NSString *)name isOutlet: (BOOL)flag
|
||||
{
|
||||
}
|
||||
|
||||
// Properties can be declared anywhere within the file, so it's necessary
|
||||
// to parse them out separately.
|
||||
- (void) _propertiesScan
|
||||
{
|
||||
}
|
||||
|
||||
- (void) _strip
|
||||
{
|
||||
NSScanner *stripScanner = [NSScanner scannerWithString: _classString];
|
||||
|
@ -155,7 +146,6 @@
|
|||
NSString *interfaceLine = nil;
|
||||
NSString *methodsString = nil;
|
||||
NSString *ivarsString = nil;
|
||||
NSString *propertyString = nil;
|
||||
NSCharacterSet *wsnl = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
NSCharacterSet *pmcs = [NSCharacterSet characterSetWithCharactersInString: @"+-"];
|
||||
|
||||
|
@ -201,14 +191,13 @@
|
|||
// check to see if it's a category on an existing interface...
|
||||
if (lookAhead(interfaceLine,@"("))
|
||||
{
|
||||
isCategory = YES;
|
||||
_isCategory = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (isCategory == NO)
|
||||
if (_isCategory == NO)
|
||||
{
|
||||
NSScanner *ivarScan = nil;
|
||||
NSScanner *propertyScan = nil;
|
||||
|
||||
// put the ivars into a a string...
|
||||
[scanner scanUpToAndIncludingString: @"{" intoString: NULL];
|
||||
|
@ -232,9 +221,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
else // yes, it's a category, but properties can be in categories...
|
||||
{
|
||||
}
|
||||
|
||||
// put the methods into a string...
|
||||
if (ivarsString != nil)
|
||||
|
@ -248,11 +234,27 @@
|
|||
[scanner scanUpToString: @"@end" intoString: &methodsString];
|
||||
}
|
||||
|
||||
if (_classString != nil)
|
||||
{
|
||||
NSScanner *propertiesScan = [NSScanner scannerWithString: _classString];
|
||||
while ([propertiesScan isAtEnd] == NO)
|
||||
{
|
||||
NSString *propertiesLine = nil;
|
||||
OCProperty *property = nil;
|
||||
|
||||
[propertiesScan scanUpToString: @";" intoString: &propertiesLine];
|
||||
[propertiesScan scanString: @";" intoString: NULL];
|
||||
property = AUTORELEASE([[OCProperty alloc] initWithString: propertiesLine]);
|
||||
[property parse];
|
||||
[_properties addObject: property];
|
||||
}
|
||||
}
|
||||
|
||||
// scan each method...
|
||||
if (methodsString != nil)
|
||||
{
|
||||
NSScanner *methodScan = [NSScanner scannerWithString: methodsString];
|
||||
while(![methodScan isAtEnd])
|
||||
while ([methodScan isAtEnd] == NO)
|
||||
{
|
||||
NSString *methodLine = nil;
|
||||
OCMethod *method = nil;
|
||||
|
|
|
@ -159,6 +159,5 @@
|
|||
[ivar parse];
|
||||
[ivars addObject: ivar];
|
||||
}
|
||||
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue