From 2b68088adfb581cd6a25b178d2c93a26943f6468 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 3 Oct 2005 19:17:06 +0000 Subject: [PATCH] improvs to EOKeyValueQualifier git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1147 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/EOControl/ChangeLog | 6 +++ sope-core/EOControl/EOKeyValueQualifier.m | 51 +++++++++++++++++++++-- sope-core/EOControl/Version | 2 +- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/sope-core/EOControl/ChangeLog b/sope-core/EOControl/ChangeLog index 1a1fdbc9..a64d4515 100644 --- a/sope-core/EOControl/ChangeLog +++ b/sope-core/EOControl/ChangeLog @@ -1,3 +1,9 @@ +2005-10-03 Helge Hess + + * EOKeyValueQualifier.m: improved -description in edge conditions, + added warnings if the qualifier is initialized with insufficient + values (v4.5.61) + 2005-08-23 Helge Hess * EOQualifier.m: added NSCopying (v4.5.60) diff --git a/sope-core/EOControl/EOKeyValueQualifier.m b/sope-core/EOControl/EOKeyValueQualifier.m index fd19cf62..29f67c32 100644 --- a/sope-core/EOControl/EOKeyValueQualifier.m +++ b/sope-core/EOControl/EOKeyValueQualifier.m @@ -46,9 +46,19 @@ static EONull *null = nil; self->key = [_key copyWithZone:NULL]; self->value = [_value retain]; self->operator = _selector; + + if (_selector == nil) { + NSLog(@"WARNING(%s): got no selector for kv qualifier (key=%@)", + __PRETTY_FUNCTION__, _key); + } + return self; } +- (id)init { + return [self initWithKey:nil operatorSelector:NULL value:nil]; +} + - (void)dealloc { [self->key release]; [self->value release]; @@ -201,6 +211,12 @@ static EONull *null = nil; self->key = [[_coder decodeObject] copyWithZone:[self zone]]; self->value = [[_coder decodeObject] retain]; [_coder decodeValueOfObjCType:@encode(SEL) at:&(self->operator)]; + + if (self->operator == nil) { + NSLog(@"WARNING(%s): decoded no selector for kv qualifier (key=%@)", + __PRETTY_FUNCTION__, self->key); + } + return self; } @@ -261,6 +277,18 @@ static EONull *null = nil; } else if ((s = [_unarchiver decodeObjectForKey:@"selector"]) != nil) self->operator = NSSelectorFromString(s); + else { + NSLog(@"WARNING(%s): decoded no selector/selectorName for kv qualifier " + @"(key=%@)", + __PRETTY_FUNCTION__, self->key); + self->operator = EOQualifierOperatorEqual; + } + + if (self->operator == nil) { + NSLog(@"WARNING(%s): decoded no selector for kv qualifier (key=%@)", + __PRETTY_FUNCTION__, self->key); + self->operator = EOQualifierOperatorEqual; + } } return self; } @@ -281,13 +309,30 @@ static EONull *null = nil; - (NSString *)description { NSMutableString *s; + NSString *tmp; s = [NSMutableString stringWithCapacity:64]; - [s appendString:self->key]; + + if (self->key != nil) + [s appendString:self->key]; + else + [s appendString:@"[NO KEY]"]; + [s appendString:@" "]; - [s appendString:[EOQualifier stringForOperatorSelector:self->operator]]; + + if ((tmp = [EOQualifier stringForOperatorSelector:self->operator]) != nil) + [s appendString:tmp]; + else if (self->operator != nil) + [s appendString:@"[NO STR OPERATOR]"]; + else + [s appendString:@"[NO OPERATOR]"]; + [s appendString:@" "]; - [s appendString:[self->value qualifierDescription]]; + + if ((tmp = [self->value qualifierDescription]) != nil) + [s appendString:tmp]; + else + [s appendString:@"nil"]; return s; } diff --git a/sope-core/EOControl/Version b/sope-core/EOControl/Version index 7fbe8ee1..9846aa8d 100644 --- a/sope-core/EOControl/Version +++ b/sope-core/EOControl/Version @@ -1,3 +1,3 @@ # version file -SUBMINOR_VERSION:=60 +SUBMINOR_VERSION:=61 -- 2.39.5