Skip to content

Commit

Permalink
Merge pull request #103 from tonyarnold/mogenerator
Browse files Browse the repository at this point in the history
---

The pointer stars were aligned inconsistently throughout the default templates. They have been aligned hard against the variable name or closing bracket, with a preceding space.

Happy to change this to whatever style you prefer @rentzsch, but my OCD side wont let this slide in templates I use everywhere.
  • Loading branch information
rentzsch committed May 10, 2012
2 parents 0c3d233 + 8d4c609 commit 3d3e344
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions templates/machine.h.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ extern const struct <$managedObjectClassName$>FetchedProperties {<$foreach Fetch
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
<$if TemplateVar.arc$>
@property (nonatomic, strong) <$Relationship.immutableCollectionClassName$>* <$Relationship.name$>;
@property (nonatomic, strong) <$Relationship.immutableCollectionClassName$> *<$Relationship.name$>;
<$else$>
@property (nonatomic, retain) <$Relationship.immutableCollectionClassName$>* <$Relationship.name$>;
@property (nonatomic, retain) <$Relationship.immutableCollectionClassName$> *<$Relationship.name$>;
<$endif$>
- (<$Relationship.mutableCollectionClassName$>*)<$Relationship.name$>Set;
<$else$>
<$if TemplateVar.arc$>
@property (nonatomic, strong) <$Relationship.destinationEntity.managedObjectClassName$>* <$Relationship.name$>;
@property (nonatomic, strong) <$Relationship.destinationEntity.managedObjectClassName$> *<$Relationship.name$>;
<$else$>
@property (nonatomic, retain) <$Relationship.destinationEntity.managedObjectClassName$>* <$Relationship.name$>;
@property (nonatomic, retain) <$Relationship.destinationEntity.managedObjectClassName$> *<$Relationship.name$>;
<$endif$>
//- (BOOL)validate<$Relationship.name.initialCapitalString$>:(id*)value_ error:(NSError**)error_;
<$endif$>
Expand All @@ -77,7 +77,7 @@ extern const struct <$managedObjectClassName$>FetchedProperties {<$foreach Fetch
#if TARGET_OS_IPHONE
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (NSFetchedResultsController *)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray *)sortDescriptors;
- (NSFetchedResultsController*)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray*)sortDescriptors;
<$endif$>
<$endforeach do$>
#endif
Expand Down
18 changes: 9 additions & 9 deletions templates/machine.m.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassNam
return (<$managedObjectClassName$>ID*)[super objectID];
}

+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
+ (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)key {
NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasDefinedAttributeType$><$if Attribute.hasScalarAttributeType$>
if ([key isEqualToString:@"<$Attribute.name$>Value"]) {
Expand Down Expand Up @@ -116,7 +116,7 @@ const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassNam
+ (id)fetch<$FetchRequest.name.initialCapitalString$>:(NSManagedObjectContext*)moc_ <$foreach Binding FetchRequest.bindings do2$><$Binding.name$>:(<$Binding.type$>)<$Binding.name$>_ <$endforeach do2$>error:(NSError**)error_ {
NSParameterAssert(moc_);
NSError *error = nil;

NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel];
<$if FetchRequest.hasBindings$>
NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys:
Expand All @@ -130,10 +130,10 @@ const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassNam
NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"<$FetchRequest.name$>"
substitutionVariables:substitutionVariables];
NSAssert(fetchRequest, @"Can't find fetch request named \"<$FetchRequest.name$>\".");

id result = nil;
NSArray *results = [moc_ executeFetchRequest:fetchRequest error:&error];

if (!error) {
switch ([results count]) {
case 0:
Expand All @@ -149,7 +149,7 @@ const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassNam
results);
}
}

if (error_) *error_ = error;
return result;
}
Expand All @@ -169,7 +169,7 @@ const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassNam
+ (NSArray*)fetch<$FetchRequest.name.initialCapitalString$>:(NSManagedObjectContext*)moc_ <$foreach Binding FetchRequest.bindings do2$><$Binding.name$>:(<$Binding.type$>)<$Binding.name$>_ <$endforeach do2$>error:(NSError**)error_ {
NSParameterAssert(moc_);
NSError *error = nil;

NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel];
<$if FetchRequest.hasBindings$>
NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys:
Expand All @@ -179,11 +179,11 @@ const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassNam
nil];
<$else$>
NSDictionary *substitutionVariables = [NSDictionary dictionary];
<$endif$>
<$endif$>
NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"<$FetchRequest.name$>"
substitutionVariables:substitutionVariables];
NSAssert(fetchRequest, @"Can't find fetch request named \"<$FetchRequest.name$>\".");

NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error];
if (error_) *error_ = error;
return result;
Expand All @@ -194,7 +194,7 @@ const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassNam
#if TARGET_OS_IPHONE
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (NSFetchedResultsController *)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray *)sortDescriptors {
- (NSFetchedResultsController*)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray*)sortDescriptors {
NSFetchRequest *fetchRequest = [NSFetchRequest new];
<$if !TemplateVar.arc$>[fetchRequest autorelease];<$endif$>
fetchRequest.entity = [NSEntityDescription entityForName:@"<$Relationship.destinationEntity.name$>" inManagedObjectContext:self.managedObjectContext];
Expand Down

0 comments on commit 3d3e344

Please sign in to comment.