Skip to content

Commit

Permalink
Adds two booleans you can use in the templates to figure out does the…
Browse files Browse the repository at this point in the history
… current attribute uses custom type (setup through userInfo)
  • Loading branch information
radianttap committed Jul 13, 2017
1 parent db41d58 commit 1930cd9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mogenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
@interface NSAttributeDescription (typing)
- (BOOL)hasScalarAttributeType;
- (BOOL)usesScalarAttributeType;
- (BOOL)usesCustomScalarAttributeType;
- (NSString*)scalarAttributeType;
- (NSString*)scalarAccessorMethodName;
- (NSString*)scalarFactoryMethodName;
- (BOOL)hasDefinedAttributeType;
- (NSArray*)objectAttributeTransformableProtocols;
- (BOOL)hasAttributeTransformableProtocols;
- (BOOL)usesCustomObjectAttributeType;
- (NSString*)objectAttributeClassName;
- (NSString*)objectAttributeType;
- (BOOL)hasTransformableAttributeType;
Expand Down
11 changes: 11 additions & 0 deletions mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ - (BOOL)usesScalarAttributeType {
}
}

- (BOOL)usesCustomScalarAttributeType {
NSString *attributeValueScalarType = [[self userInfo] objectForKey:kAttributeValueScalarTypeKey];
return (attributeValueScalarType != nil);
}

- (NSString*)scalarAttributeType {
BOOL isUnsigned = [self isUnsigned];

Expand Down Expand Up @@ -584,6 +589,12 @@ - (NSArray*)objectAttributeTransformableProtocols {
- (BOOL)hasAttributeTransformableProtocols {
return [self hasTransformableAttributeType] && [[self userInfo] objectForKey:@"attributeTransformableProtocols"];
}

- (BOOL)usesCustomObjectAttributeType {
NSString *attributeValueClassName = [[self userInfo] objectForKey:@"attributeValueClassName"];
return (attributeValueClassName != nil);
}

- (NSString*)objectAttributeType {
NSString *result = [self objectAttributeClassName];
if ([result isEqualToString:@"Class"]) {
Expand Down

0 comments on commit 1930cd9

Please sign in to comment.