aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPUserMO.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-07-11 21:47:07 +0000
committerstuconnolly <stuart02@gmail.com>2011-07-11 21:47:07 +0000
commitfa36e8280a3e3b02bbb39c152bd08061b302f168 (patch)
treec13dbb4dc4311a4a413de80429e40b720e5e7bca /Source/SPUserMO.m
parent79bba63e1bed358c458f49351d8c4836c0fec20b (diff)
downloadsequelpro-fa36e8280a3e3b02bbb39c152bd08061b302f168.tar.gz
sequelpro-fa36e8280a3e3b02bbb39c152bd08061b302f168.tar.bz2
sequelpro-fa36e8280a3e3b02bbb39c152bd08061b302f168.zip
Minor tidy up.
Diffstat (limited to 'Source/SPUserMO.m')
-rw-r--r--Source/SPUserMO.m34
1 files changed, 17 insertions, 17 deletions
diff --git a/Source/SPUserMO.m b/Source/SPUserMO.m
index a9e9ddbb..d952f9da 100644
--- a/Source/SPUserMO.m
+++ b/Source/SPUserMO.m
@@ -24,6 +24,11 @@
#import "SPUserMO.h"
+static NSString *SPUserMOParentKey = @"parent";
+static NSString *SPUserMOUserKey = @"user";
+static NSString *SPUserMOHostKey = @"host";
+static NSString *SPUserMOChildrenKey = @"children";
+
@implementation NSManagedObject (CoreDataGeneratedAccessors)
@dynamic user;
@@ -33,23 +38,17 @@
- (NSString *)displayName
{
- return ([self valueForKey:@"parent"] == nil) ? self.user : self.host;
+ return ([self valueForKey:SPUserMOParentKey] == nil) ? self.user : self.host;
}
- (void)setDisplayName:(NSString *)value
{
- if ([self valueForKey:@"parent"] == nil)
- [self setValue:value forKey:@"user"];
+ if ([self valueForKey:SPUserMOParentKey] == nil) {
+ [self setValue:value forKey:SPUserMOUserKey];
+ }
else
{
- if (value == nil)
- {
- [self setValue:@"%" forKey:@"host"];
- }
- else
- {
- [self setValue:value forKey:@"host"];
- }
+ [self setValue:(value == nil) ? @"%" : value forKey:SPUserMOHostKey];
}
}
@@ -57,11 +56,12 @@
{
NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
- [self willChangeValueForKey:@"children" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
- [[self primitiveValueForKey:@"children"] addObject:value];
- [self didChangeValueForKey:@"children" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
+ [self willChangeValueForKey:SPUserMOChildrenKey withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
+ [[self primitiveValueForKey:SPUserMOChildrenKey] addObject:value];
+ [self didChangeValueForKey:SPUserMOChildrenKey withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
[changedObjects release];
+
value.user = self.user;
}
@@ -69,9 +69,9 @@
{
NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
- [self willChangeValueForKey:@"children" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
- [[self primitiveValueForKey:@"children"] removeObject:value];
- [self didChangeValueForKey:@"children" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
+ [self willChangeValueForKey:SPUserMOChildrenKey withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
+ [[self primitiveValueForKey:SPUserMOChildrenKey] removeObject:value];
+ [self didChangeValueForKey:SPUserMOChildrenKey withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
[changedObjects release];
}