Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small defect fixed for when the base class is from an external library and a model has inheritance #136

Merged
merged 1 commit into from Jan 14, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Small fix for when you have inheritance and a custom superclass that …
…is not local to the project.
David Aspinall committed Nov 15, 2012
commit 782fad0bb53899b09be52fb454999c826dda2bd3
1 change: 1 addition & 0 deletions mogenerator.h
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
@end

@interface NSEntityDescription (customBaseClass)
- (BOOL)hasSuperentity;
- (BOOL)hasCustomSuperentity;
- (NSString*)customSuperentity;
- (NSString*)forcedCustomBaseClass;
8 changes: 8 additions & 0 deletions mogenerator.m
Original file line number Diff line number Diff line change
@@ -79,6 +79,14 @@ - (BOOL)hasCustomBaseCaseImport {
- (NSString*)baseClassImport {
return gCustomBaseClassImport;
}
- (BOOL)hasSuperentity {
NSEntityDescription *superentity = [self superentity];
if (superentity) {
return YES;
}
return NO;
}

- (BOOL)hasCustomSuperentity {
NSString *forcedBaseClass = [self forcedCustomBaseClass];
if (!forcedBaseClass) {
3 changes: 2 additions & 1 deletion templates/machine.h.motemplate
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@
// Make changes to <$managedObjectClassName$>.h instead.

#import <CoreData/CoreData.h>
<$if hasCustomSuperentity$>#import <$if hasCustomBaseCaseImport$><$baseClassImport$><$else$>"<$customSuperentity$>.h"<$endif$><$endif$>
<$if hasCustomSuperentity$><$if hasSuperentity$>#import "<$customSuperentity$>.h"
<$else$><$if hasCustomBaseCaseImport$>#import <$baseClassImport$><$else$>#import "<$customSuperentity$>.h"<$endif$><$endif$><$endif$>

extern const struct <$managedObjectClassName$>Attributes {<$foreach Attribute noninheritedAttributes do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$Attribute.name$>;<$endforeach do$>