]> err.no Git - sope/commitdiff
added EOKeyValueArchiving to fetch-spec and qualifier classes
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 4 Aug 2005 13:21:22 +0000 (13:21 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 4 Aug 2005 13:21:22 +0000 (13:21 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@968 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

14 files changed:
sope-core/EOControl/ChangeLog
sope-core/EOControl/EOAndQualifier.m
sope-core/EOControl/EOFetchSpecification.m
sope-core/EOControl/EOKeyComparisonQualifier.m
sope-core/EOControl/EOKeyValueQualifier.m
sope-core/EOControl/EONotQualifier.m
sope-core/EOControl/EOOrQualifier.m
sope-core/EOControl/EOQualifier.h
sope-core/EOControl/EOQualifier.m
sope-core/EOControl/EOQualifierVariable.m
sope-core/EOControl/EOSortOrdering.h
sope-core/EOControl/EOSortOrdering.m
sope-core/EOControl/NSObject+EOQualifierOps.m
sope-core/EOControl/Version

index dcfcc871f99a0f3d47f43e8c4d3d20578eff4a13..8b94d3a03311bfc0300840bde4d5e9402282aeee 100644 (file)
@@ -1,3 +1,13 @@
+2005-08-04  Helge Hess  <helge.hess@skyrix.com>
+
+       * v4.5.55
+       
+       * EOSortOrdering.m, EOFetchSpecification.m: added EOKeyValueArchiving
+       
+       * EO*Qualifier.m: added EOKeyValueArchiving to EOQualifier classes
+
+       * NSObject+EOQualifierOps.m: fixed gcc 4.0 warnings
+
 2005-08-04  Helge Hess  <helge.hess@opengroupware.org>
 
        * EOKeyValueArchiver.m: process class names containing a dot by
index f56b1af445f744c92be889aa5ff58d0d67b62066..558b5cf0e5cda483260906a4e90e43c2b51c5796 100644 (file)
@@ -264,6 +264,20 @@ static BOOL debugTransform = NO;
   return [aq autorelease];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  if ((self = [super initWithKeyValueUnarchiver:_unarchiver]) != nil) {
+    self->qualifiers = [[_unarchiver decodeObjectForKey:@"qualifiers"] copy];
+    self->count      = [self->qualifiers count];
+  }
+  return self;
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  [super encodeWithKeyValueArchiver:_archiver];
+  [_archiver encodeObject:[self qualifiers] forKey:@"qualifiers"];
+}
+
 /* description */
 
 - (NSString *)description {
index b4e3fcc693410aa078098a584c3fbc320acf0df2..78614c1f62806037d0b1729a90ebb4050affff0b 100644 (file)
   return [fs autorelease];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  if ((self = [super init]) != nil) {
+    self->entityName = [[_unarchiver decodeObjectForKey:@"entityName"] copy];
+    self->qualifier  = [[_unarchiver decodeObjectForKey:@"qualifier"]  retain];
+    self->hints      = [[_unarchiver decodeObjectForKey:@"hints"] copy];
+    self->sortOrderings = 
+      [[_unarchiver decodeObjectForKey:@"sortOrderings"] retain];
+    
+    self->fetchLimit = [_unarchiver decodeIntForKey:@"fetchLimit"];
+    
+    self->fsFlags.usesDistinct = 
+      [_unarchiver decodeBoolForKey:@"usesDistinct"] ? 1 : 0;
+    self->fsFlags.locksObjects = 
+      [_unarchiver decodeBoolForKey:@"locksObjects"] ? 1 : 0;
+    self->fsFlags.deep = 
+      [_unarchiver decodeBoolForKey:@"deep"] ? 1 : 0;
+  }
+  return self;
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  [_archiver encodeObject:[self entityName]    forKey:@"entityName"];
+  [_archiver encodeObject:[self qualifier]     forKey:@"qualifier"];
+  [_archiver encodeObject:[self hints]         forKey:@"hints"];
+  [_archiver encodeObject:[self sortOrderings] forKey:@"sortOrderings"];
+
+  [_archiver encodeInt:[self fetchLimit] forKey:@"fetchLimit"];
+  
+  [_archiver encodeBool:self->fsFlags.usesDistinct forKey:@"usesDistinct"];
+  [_archiver encodeBool:self->fsFlags.locksObjects forKey:@"locksObjects"];
+  [_archiver encodeBool:self->fsFlags.deep         forKey:@"deep"];
+}
+
 /* description */
 
 - (NSString *)description {
index 1c6ba9e8e56ff46837c0f33f4b7cd1524a6154f9..91e5af885e4ec590f0b9087b924461e1d41b27d8 100644 (file)
@@ -232,6 +232,37 @@ static EONull *null = nil;
   return [kcq autorelease];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  if ((self = [super initWithKeyValueUnarchiver:_unarchiver]) != nil) {
+    NSString *s;
+    
+    self->leftKey  = [[_unarchiver decodeObjectForKey:@"leftKey"]  retain];
+    self->rightKey = [[_unarchiver decodeObjectForKey:@"rightKey"] retain];
+
+    if ((s = [_unarchiver decodeObjectForKey:@"selectorName"]) != nil) {
+      if (![s hasSuffix:@":"]) s = [s stringByAppendingString:@":"];
+      self->operator = NSSelectorFromString(s);
+    }
+    else if ((s = [_unarchiver decodeObjectForKey:@"selector"]) != nil)
+      self->operator = NSSelectorFromString(s);
+  }
+  return self;
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  NSString *s;
+  
+  [super encodeWithKeyValueArchiver:_archiver];
+  
+  [_archiver encodeObject:[self leftKey]  forKey:@"leftKey"];
+  [_archiver encodeObject:[self rightKey] forKey:@"rightKey"];
+
+  s = NSStringFromSelector([self selector]);
+  if ([s hasSuffix:@":"]) s = [s substringToIndex:[s length] - 1];
+  [_archiver encodeObject:s forKey:@"selectorName"];
+}
+
 /* description */
 
 - (NSString *)description {
index 93d3aac803ec475f7b515cb7421efffc06ac23c4..fd19cf622a956f0d2d5437cd7c0327ce65162a90 100644 (file)
@@ -246,6 +246,37 @@ static EONull *null = nil;
   return [kvq autorelease];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  if ((self = [super initWithKeyValueUnarchiver:_unarchiver]) != nil) {
+    NSString *s;
+    
+    self->key   = [[_unarchiver decodeObjectForKey:@"key"]   copy];
+    self->value = [[_unarchiver decodeObjectForKey:@"value"] retain];
+    
+    if ((s = [_unarchiver decodeObjectForKey:@"selectorName"]) != nil) {
+      if (![s hasSuffix:@":"]) s = [s stringByAppendingString:@":"];
+      self->operator = NSSelectorFromString(s);
+    }
+    else if ((s = [_unarchiver decodeObjectForKey:@"selector"]) != nil)
+      self->operator = NSSelectorFromString(s);
+  }
+  return self;
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  NSString *s;
+  
+  [super encodeWithKeyValueArchiver:_archiver];
+  
+  [_archiver encodeObject:[self key]   forKey:@"key"];
+  [_archiver encodeObject:[self value] forKey:@"value"];
+  
+  s = NSStringFromSelector([self selector]);
+  if ([s hasSuffix:@":"]) s = [s substringToIndex:[s length] - 1];
+  [_archiver encodeObject:s forKey:@"selectorName"];
+}
+
 /* description */
 
 - (NSString *)description {
index a33d8d6a4c5257acf60b3abb9d11fb289cbbf6b7..b56b54b00f2095431266a80932d99f0fc3e7baa8 100644 (file)
   return [nq autorelease];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  if ((self = [super initWithKeyValueUnarchiver:_unarchiver]) != nil) {
+    self->qualifier = [[_unarchiver decodeObjectForKey:@"qualifier"] copy];
+  }
+  return self;
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  [super encodeWithKeyValueArchiver:_archiver];
+  [_archiver encodeObject:[self qualifier] forKey:@"qualifier"];
+}
+
 /* description */
 
 - (NSString *)description {
index d8e96a3b199e8d03298d774613c940333eaf70ea..8cb1b70cbea0af44ae866d6791ecaed0b90a90e9 100644 (file)
@@ -251,6 +251,20 @@ static BOOL debugTransform = NO;
   return [aq autorelease];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  if ((self = [super initWithKeyValueUnarchiver:_unarchiver]) != nil) {
+    self->qualifiers = [[_unarchiver decodeObjectForKey:@"qualifiers"] copy];
+    self->count      = [self->qualifiers count];
+  }
+  return self;
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  [super encodeWithKeyValueArchiver:_archiver];
+  [_archiver encodeObject:[self qualifiers] forKey:@"qualifiers"];
+}
+
 /* description */
 
 - (NSString *)description {
index 6581999d0a11acd53e98fbe93e429fb7e5114ee1..de5f12a3edb30d59462c5e49fea2f2221a5c1e4d 100644 (file)
@@ -22,7 +22,8 @@
 #ifndef __EOQualifier_h__
 #define __EOQualifier_h__
 
-#import <Foundation/NSObject.h> 
+#import <Foundation/NSObject.h>
+#include <EOControl/EOKeyValueArchiver.h>
 
 /*
   EOQualifier
@@ -53,7 +54,7 @@
 - (BOOL)evaluateWithObject:(id)_object;
 @end
 
-@interface EOQualifier : NSObject
+@interface EOQualifier : NSObject < EOKeyValueArchiving >
 
 + (EOQualifier *)qualifierToMatchAnyValue:(NSDictionary *)_values;
 + (EOQualifier *)qualifierToMatchAllValues:(NSDictionary *)_values;
@@ -199,7 +200,7 @@ extern SEL EOQualifierOperatorCaseInsensitiveLike;
 
 /* variable qualifier content */
 
-@interface EOQualifierVariable : NSObject < NSCoding >
+@interface EOQualifierVariable : NSObject < NSCoding, EOKeyValueArchiving >
 {
   NSString *varKey;
 }
index 7f35205312a3135afb7fb8cfa0d539807a656209..23c96daf20955e84b914aa8ab1a4e6bb4779216c 100644 (file)
@@ -244,12 +244,18 @@ static EONull     *null = nil;
   return evalDebug ? YES : NO;
 }
 
-@end /* EOQualifier */
-
-@implementation EOQualifier(QuickEval)
+/* QuickEval */
 
 - (BOOL)evaluateWithObject:(id)_object inEvalContext:(id)_ctx {
   return [(id<EOQualifierEvaluation>)self evaluateWithObject:_object];
 }
 
-@end /* EOQualifier(QuickEval) */
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  return [super init];
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+}
+
+@end /* EOQualifier */
index 71d1dd593b849802a48b771bf4f99e42e6f70b03..fe5a69d57e58a620f9657baad0882729b35e442b 100644 (file)
   return [self->varKey isEqual:[_obj key]];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  if ((self = [super init]) != nil) {
+    self->varKey = [[_unarchiver decodeObjectForKey:@"key"] copy];
+  }
+  return self;
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  [_archiver encodeObject:[self key] forKey:@"key"];
+}
+
 /* description */
 
 - (NSString *)qualifierDescription {
index 97eeb0f6d008ec93a487be60a4417445d74e9b48..a2ba4f71e0a22d79e522b0db3efa450cebfb4790 100644 (file)
@@ -24,6 +24,7 @@
 
 #import <Foundation/NSObject.h>
 #include <EOControl/EOControlDecls.h>
+#include <EOControl/EOKeyValueArchiver.h>
 
 @class NSDictionary, NSString;
 
@@ -42,7 +43,7 @@ EOControl_EXPORT SEL EOCompareCaseInsensitiveAscending;
 EOControl_EXPORT SEL EOCompareCaseInsensitiveDescending;
 #endif
 
-@interface EOSortOrdering : NSObject
+@interface EOSortOrdering : NSObject < EOKeyValueArchiving >
 {
   NSString *key;
   SEL      selector;
index 909d188e9b09786104b5f374ba3a4280885a6082..93d2c01dab8bfc8a70955256f19674b98691d517 100644 (file)
@@ -117,6 +117,22 @@ EOControl_DECLARE SEL EOCompareCaseInsensitiveDescending =
                         selector:self->selector];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  if ((self = [super init]) != nil) {
+    self->key = [[_unarchiver decodeObjectForKey:@"key"] copy];
+    self->selector = 
+      NSSelectorFromString([_unarchiver decodeObjectForKey:@"selector"]);
+  }
+  return self;
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  [_archiver encodeObject:[self key] forKey:@"key"];
+  [_archiver encodeObject:NSStringFromSelector([self selector])
+             forKey:@"selector"];
+}
+
 /* description */
 
 - (NSString *)description {
index 378fa10f0b5eebf167440881acf0d24f30fc6969..827024666c7e4a50f7a2ce3e1a28a57f663f8fbe 100644 (file)
@@ -76,7 +76,7 @@ static EONull *null = nil;
 
 @implementation NSString(ImplementedQualifierComparisons)
 
-- (BOOL)isLike:(id)_pattern {
+- (BOOL)isLike:(NSString *)_pattern {
   NSArray  *cs;
   unsigned count;
 #if 0  
@@ -154,7 +154,7 @@ static EONull *null = nil;
   return NO;
 }
 
-- (BOOL)isCaseInsensitiveLike:(id)_pattern {
+- (BOOL)isCaseInsensitiveLike:(NSString *)_pattern {
   return [[self lowercaseString] isLike:[_pattern lowercaseString]];
 }
 
index 5a9103fbcfe3a90091d3e23c80df915537dcc5fd..1e1b1b4fc4a61239d7b40fff10fac21af915cc33 100644 (file)
@@ -1,3 +1,3 @@
 # version file
 
-SUBMINOR_VERSION:=54
+SUBMINOR_VERSION:=55