Skip to content

Commit

Permalink
Fixed bugs 8, 10, and 11; added machine-generated primitive accessors…
Browse files Browse the repository at this point in the history
… credit to my colleague paugus. Project was using 10.4 SDK, now uses Base SDK. Fixed some warnings. Removed some 10.4 support.
  • Loading branch information
seanm authored and rentzsch committed Jul 26, 2010
1 parent daa2a75 commit f711fc5
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 21 deletions.
2 changes: 1 addition & 1 deletion MiscMerge/MiscMergeEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ - (MiscMergeCommandExitType)executeCommandBlock:(MiscMergeCommandBlock *)block
}

[commandStack removeLastObject];
[localPool release];
[localPool drain];
return exitCode;
}

Expand Down
2 changes: 1 addition & 1 deletion MiscMerge/MiscMergeTemplate.m
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ - (void)parseString:(NSString *)string
[self _addBetweenString:[[accumString copy] autorelease]];
}

[localPool release];
[localPool drain];
}

@end
1 change: 0 additions & 1 deletion MiscMerge/NSString+MiscAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ enum
@interface NSCharacterSet (MiscAdditions)

+ (NSCharacterSet *)allWhitespaceCharacterSet;
+ (NSCharacterSet *)newlineCharacterSet;

@end

Expand Down
10 changes: 0 additions & 10 deletions MiscMerge/NSString+MiscAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ + (NSCharacterSet *)allWhitespaceCharacterSet
return whiteSet;
}

+ (NSCharacterSet *)newlineCharacterSet
{
static NSCharacterSet *newlineSet = nil;

if (newlineSet == nil)
newlineSet = [[NSCharacterSet characterSetWithCharactersInString:@"\n\r"] retain];

return newlineSet;
}

@end


Expand Down
2 changes: 1 addition & 1 deletion ddcli/DDCliApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ int DDCliAppRunWithClass(Class delegateClass)
// Initialize singleton/global
DDCliApplication * app = [DDCliApplication sharedApplication];
int result = [app runWithClass: delegateClass];
[pool release];
[pool drain];
return result;
}
1 change: 1 addition & 0 deletions mogenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- (NSString*)scalarAttributeType;
- (BOOL)hasDefinedAttributeType;
- (NSString*)objectAttributeType;
- (BOOL)hasTransformableAttributeType;
@end

@interface NSString (camelCaseString)
Expand Down
10 changes: 6 additions & 4 deletions mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,18 @@ - (BOOL)hasDefinedAttributeType {
return [self attributeType] != NSUndefinedAttributeType;
}
- (NSString*)objectAttributeType {
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
#define NSTransformableAttributeType 1800
#endif
if ([self attributeType] == NSTransformableAttributeType) {
if ([self hasTransformableAttributeType]) {
NSString *result = [[self userInfo] objectForKey:@"attributeValueClassName"];
return result ? result : @"NSObject";
} else {
return [self attributeValueClassName];
}
}

- (BOOL)hasTransformableAttributeType {
return ([self attributeType] == NSTransformableAttributeType);
}

@end

@implementation NSString (camelCaseString)
Expand Down
4 changes: 2 additions & 2 deletions mogenerator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT = "";
};
name = Debug;
};
Expand All @@ -473,7 +473,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT = "";
};
name = Release;
};
Expand Down
22 changes: 22 additions & 0 deletions templates/machine.h.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

<$foreach Relationship noninheritedRelationships do$>@class <$Relationship.destinationEntity.managedObjectClassName$>;
<$endforeach do$>
<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasTransformableAttributeType$>@class <$Attribute.objectAttributeType$>;<$endif$>
<$endforeach do$>
@interface <$managedObjectClassName$>ID : NSManagedObjectID {}
@end

Expand Down Expand Up @@ -54,3 +56,23 @@
- (void)remove<$Relationship.name.initialCapitalString$>Object:(<$Relationship.destinationEntity.managedObjectClassName$>*)value_;
<$endif$><$endforeach do$>
@end

@interface _<$managedObjectClassName$> (CoreDataGeneratedPrimitiveAccessors)
<$foreach Attribute noninheritedAttributes do$>
- (<$Attribute.objectAttributeType$>*)primitive<$Attribute.name.initialCapitalString$>;
- (void)setPrimitive<$Attribute.name.initialCapitalString$>:(<$Attribute.objectAttributeType$>*)value;
<$if Attribute.hasScalarAttributeType$>
- (<$Attribute.scalarAttributeType$>)primitive<$Attribute.name.initialCapitalString$>Value;
- (void)setPrimitive<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_;
<$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (NSMutableSet*)primitive<$Relationship.name.initialCapitalString$>;
- (void)setPrimitive<$Relationship.name.initialCapitalString$>:(NSMutableSet*)value;
<$else$>
- (<$Relationship.destinationEntity.managedObjectClassName$>*)primitive<$Relationship.name.initialCapitalString$>;
- (void)setPrimitive<$Relationship.name.initialCapitalString$>:(<$Relationship.destinationEntity.managedObjectClassName$>*)value;
<$endif$>
<$endforeach do$>
@end
10 changes: 9 additions & 1 deletion templates/machine.m.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@

- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value {
NSNumber *result = [self <$Attribute.name$>];
return result ? [result <$Attribute.scalarAttributeType.camelCaseString$>Value] : 0;
return [result <$Attribute.scalarAttributeType.camelCaseString$>Value];
}

- (void)set<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_ {
[self set<$Attribute.name.initialCapitalString$>:[NSNumber numberWith<$Attribute.scalarAttributeType.camelCaseString.initialCapitalString$>:value_]];
}

- (<$Attribute.scalarAttributeType$>)primitive<$Attribute.name.initialCapitalString$>Value {
NSNumber *result = [self primitive<$Attribute.name.initialCapitalString$>];
return [result <$Attribute.scalarAttributeType.camelCaseString$>Value];
}

- (void)setPrimitive<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_ {
[self setPrimitive<$Attribute.name.initialCapitalString$>:[NSNumber numberWith<$Attribute.scalarAttributeType.camelCaseString.initialCapitalString$>:value_]];
}
<$endif$>
<$endif$>
<$endforeach do$>
Expand Down

0 comments on commit f711fc5

Please sign in to comment.