]> err.no Git - sope/commitdiff
added KV archiving to rule engine
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 4 Aug 2005 00:57:48 +0000 (00:57 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 4 Aug 2005 00:57:48 +0000 (00:57 +0000)
some code cleanups

git-svn-id: http://svn.opengroupware.org/SOPE/trunk@964 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-core/NGExtensions/ChangeLog
sope-core/NGExtensions/EOExt.subproj/EOCompoundDataSource.m
sope-core/NGExtensions/EOExt.subproj/EOFilterDataSource.m
sope-core/NGExtensions/GNUmakefile.preamble
sope-core/NGExtensions/NGExtensions/NGRule.h
sope-core/NGExtensions/NGExtensions/NGRuleAssignment.h
sope-core/NGExtensions/NGRuleEngine.subproj/NGRule.m
sope-core/NGExtensions/NGRuleEngine.subproj/NGRuleAssignment.m
sope-core/NGExtensions/Version

index c811b78293ba42a17cb93aee63953a8a131fda5e..5fd5e6c8bebde7e16f664d917d52d9e41ee13413 100644 (file)
@@ -1,3 +1,12 @@
+2005-08-04  Helge Hess  <helge.hess@opengroupware.org>
+
+       * EOFilterDataSource.m, EOCompoundDataSource.m: code cleanups
+         (v4.5.168)
+
+2005-08-03  Helge Hess  <helge.hess@opengroupware.org>
+
+       * added EOKeyValueArchiving support to NGRuleEngine objects (v4.5.167)
+
 2005-07-22  Helge Hess  <helge.hess@opengroupware.org>
 
        * FdExt.subproj/NSException+misc.m: added -isException and
index 9f685f25b2654467cd3e390103c90c79536f2f0b..1a1fd9cef68ea0aad73e3816795e10f6a7b03f01 100644 (file)
     return [[[self sources] objectAtIndex:0] classDescriptionForObjects];
     
   e = [[self sources] objectEnumerator];
-  while ((ds = [e nextObject])) {
+  while ((ds = [e nextObject]) != nil) {
     EOClassDescription *cd;
 
-    if ((cd = [ds classDescriptionForObjects]))
+    if ((cd = [ds classDescriptionForObjects]) != nil)
       return cd;
   }
   /* all datasources failed to create .. */
index 154244dbe067e8d9167c1b7a5ee0d67b0aba8927..cac5719b6b7baac0103092465a2a46f6c73fb73d 100644 (file)
   ms = [NSMutableString stringWithCapacity:64];
   [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
 
-  if (self->source) [ms appendFormat:@" source=%@", self->source];
-  if (self->auxiliaryQualifier) 
+  if (self->source != nil)
+    [ms appendFormat:@" source=%@", self->source];
+  if (self->auxiliaryQualifier != nil) 
     [ms appendFormat:@" qualifier=%@", self->auxiliaryQualifier];
-  if (self->sortOrderings)
+  if (self->sortOrderings != nil)
     [ms appendFormat:@" orderings=%@", self->sortOrderings];
-  if (self->groupings)
-    [ms appendFormat:@" groupings=%@", self->sortOrderings];
+  if (self->groupings != nil)
+    [ms appendFormat:@" groupings=%@", self->groupings];
   
   [ms appendString:@">"];
   return ms;
 
 @end /* EOFilterDataSource */
 
+
 @implementation NSDictionary(EOFilterDataSource)
 
 - (NSArray *)flattenedArrayWithHint:(unsigned int)_hint
index 19c8a805c0b298ff19bbf03885ec0f52cc9eda51..377cca8bc71b580833c8a4eb0c57bbc134809e5b 100644 (file)
@@ -1,4 +1,4 @@
-# $Id$
+# compilation settings
 
 ADDITIONAL_CPP_FLAGS     += -Wall -Wno-import -Wno-protocol -O2
 libNGExtensions_INCLUDE_DIRS += -I..
index 03f630640518c2f2a480605525fded12fe7a95c0..6ab33b7a81c0804c43e940e0376c22d761de70c6 100644 (file)
@@ -23,6 +23,7 @@
 #define __NGRuleEngine_NGRule_H__
 
 #import <Foundation/NSObject.h>
+#include <EOControl/EOKeyValueArchiver.h>
 
 /*
   NGRule
@@ -43,7 +44,7 @@
 
 @class EOQualifier;
 
-@interface NGRule : NSObject
+@interface NGRule : NSObject < EOKeyValueArchiving >
 {
   EOQualifier *qualifier;
   id          action;
index b2fdc8031035cb45a2994df252310872c6265dff..b3c2d712a9f72e53810bec8b311c00a5923f015e 100644 (file)
@@ -23,6 +23,7 @@
 #define __NGRuleEngine_NGRuleAssignment_H__
 
 #import <Foundation/NSObject.h>
+#include <EOControl/EOKeyValueArchiver.h>
 
 /*
   NGRuleAssignment
@@ -39,7 +40,7 @@
 
 @class NSString;
 
-@interface NGRuleAssignment : NSObject
+@interface NGRuleAssignment : NSObject < EOKeyValueArchiving >
 {
   NSString *keyPath;
   id value;
index b5bf458e55f3fc248bf2411b55bc748320a8d159..be742032ce9a0d63b3b273694ff603bce6c511c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2004 SKYRIX Software AG
+  Copyright (C) 2003-2005 SKYRIX Software AG
 
   This file is part of SOPE.
 
   return [self->action fireInContext:_ctx];
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  return [self initWithQualifier:[_unarchiver decodeObjectForKey:@"lhs"]
+              action:[_unarchiver decodeObjectForKey:@"rhs"]
+              priority:[_unarchiver decodeIntForKey:@"author"]];
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  [_archiver encodeInt:[self priority]     forKey:@"author"];
+  [_archiver encodeObject:[self qualifier] forKey:@"lhs"];
+  [_archiver encodeObject:[self action]    forKey:@"rhs"];
+}
+
 /* representations */
 
 - (NSString *)stringValue {
index 6d98431e16055955ad7c6ef382ea5acbd63ae196..13e545360479f5e9a21c6d1799829a9d54e2fc37 100644 (file)
   return self->value;
 }
 
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+  return [self initWithKeyPath:[_unarchiver decodeObjectForKey:@"keyPath"]
+              value:[_unarchiver decodeObjectForKey:@"value"]];
+}
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+  [_archiver encodeObject:[self keyPath] forKey:@"keyPath"];
+  [_archiver encodeObject:[self value]   forKey:@"value"];
+}
+
 /* description */
 
 - (NSString *)valueStringValue {
index b4066c65c21d4dd58bb68483f5dbbf753f699742..406c7817e89dd8131a056985ac31a9d9544966ca 100644 (file)
@@ -1,6 +1,6 @@
 # version
 
-SUBMINOR_VERSION:=166
+SUBMINOR_VERSION:=168
 
 # v4.3.115 requires libFoundation v1.0.59
 # v4.2.72  requires libEOControl  v4.2.39