Skip to content

Commit

Permalink
Merge pull request rentzsch#136 from davidAtGVC/master
Browse files Browse the repository at this point in the history
Small defect fixed for when the base class is from an external library and a model has inheritance
  • Loading branch information
rentzsch committed Jan 14, 2013
2 parents 4c979d4 + 838b5c0 commit f150421
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions mogenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@end

@interface NSEntityDescription (customBaseClass)
- (BOOL)hasSuperentity;
- (BOOL)hasCustomSuperentity;
- (NSString*)customSuperentity;
- (NSString*)forcedCustomBaseClass;
Expand Down
8 changes: 8 additions & 0 deletions mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion templates/machine.h.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -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$>
Expand Down

0 comments on commit f150421

Please sign in to comment.