Permalink
Browse files

Adds two booleans you can use in the templates to figure out does the…

… current attribute uses custom type (setup through userInfo)
  • Loading branch information...
radianttap committed Jul 13, 2017
1 parent db41d58 commit 1930cd9e94bd070aa932e1ebc588e89711609975
Showing with 13 additions and 0 deletions.
  1. +2 −0 mogenerator.h
  2. +11 −0 mogenerator.m
View
@@ -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;
View
@@ -443,6 +443,11 @@ - (BOOL)usesScalarAttributeType {
}
}
- (BOOL)usesCustomScalarAttributeType {
NSString *attributeValueScalarType = [[self userInfo] objectForKey:kAttributeValueScalarTypeKey];
return (attributeValueScalarType != nil);
}
- (NSString*)scalarAttributeType {
BOOL isUnsigned = [self isUnsigned];
@@ -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"]) {

0 comments on commit 1930cd9

Please sign in to comment.