Skip to content

Commit 21465eb

Browse files
committed
Merge pull request #136 from davidAtGVC/master
Small defect fixed for when the base class is from an external library and a model has inheritance
2 parents 6a0e67c + 782fad0 commit 21465eb

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

mogenerator.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
@end
2222

2323
@interface NSEntityDescription (customBaseClass)
24+
- (BOOL)hasSuperentity;
2425
- (BOOL)hasCustomSuperentity;
2526
- (NSString*)customSuperentity;
2627
- (NSString*)forcedCustomBaseClass;

mogenerator.m

+8
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ - (BOOL)hasCustomBaseCaseImport {
7979
- (NSString*)baseClassImport {
8080
return gCustomBaseClassImport;
8181
}
82+
- (BOOL)hasSuperentity {
83+
NSEntityDescription *superentity = [self superentity];
84+
if (superentity) {
85+
return YES;
86+
}
87+
return NO;
88+
}
89+
8290
- (BOOL)hasCustomSuperentity {
8391
NSString *forcedBaseClass = [self forcedCustomBaseClass];
8492
if (!forcedBaseClass) {

templates/machine.h.motemplate

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// Make changes to <$managedObjectClassName$>.h instead.
33

44
#import <CoreData/CoreData.h>
5-
<$if hasCustomSuperentity$>#import <$if hasCustomBaseCaseImport$><$baseClassImport$><$else$>"<$customSuperentity$>.h"<$endif$><$endif$>
5+
<$if hasCustomSuperentity$><$if hasSuperentity$>#import "<$customSuperentity$>.h"
6+
<$else$><$if hasCustomBaseCaseImport$>#import <$baseClassImport$><$else$>#import "<$customSuperentity$>.h"<$endif$><$endif$><$endif$>
67

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

0 commit comments

Comments
 (0)