]> err.no Git - sope/blobdiff - sope-core/NGExtensions/EOExt.subproj/EOFilterDataSource.m
Drop apache 1 build-dependency
[sope] / sope-core / NGExtensions / EOExt.subproj / EOFilterDataSource.m
index 760e70548b3b610446dfd7c4c07f574e3ee26a66..8173849f13bca59063d7fa193e9474f6149d20fb 100644 (file)
@@ -1,20 +1,20 @@
 /*
-  Copyright (C) 2000-2004 SKYRIX Software AG
+  Copyright (C) 2000-2005 SKYRIX Software AG
 
-  This file is part of OpenGroupware.org.
+  This file is part of SOPE.
 
-  OGo is free software; you can redistribute it and/or modify it under
+  SOPE is free software; you can redistribute it and/or modify it under
   the terms of the GNU Lesser General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version.
 
-  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
   License for more details.
 
   You should have received a copy of the GNU Lesser General Public
-  License along with OGo; see the file COPYING.  If not, write to the
+  License along with SOPE; see the file COPYING.  If not, write to the
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
@@ -22,7 +22,7 @@
 #include "EOFilterDataSource.h"
 #include "EODataSource+NGExtensions.h"
 #include "EOGrouping.h"
-#include <EOControl/EOControl.h>
+#import <EOControl/EOControl.h>
 #include "common.h"
 
 @interface NSDictionary(EOFilterDataSource)
   
   objs = [[self source] fetchObjects];
   
-  if ([self auxiliaryQualifier])
+  if ([self auxiliaryQualifier] != nil)
     objs = [objs filteredArrayUsingQualifier:[self auxiliaryQualifier]];
 
   if ((groups = [self groupings]) != nil) {
 
     grouping = [groups lastObject];
     
-    if ((sos = [self sortOrderings]) != nil) {
+    if ((sos = [self sortOrderings]) != nil)
       [grouping setSortOrderings:sos];
-    }
+    
     groupDict = [objs arrayGroupedBy:grouping];
 
     allKeys = [groupDict allKeys];
     allKeys = [allKeys sortedArrayUsingSelector:@selector(compare:)];
     objs    = [groupDict flattenedArrayWithHint:cnt andKeys:allKeys];
   }
-  else if ([self sortOrderings])
+  else if ([self sortOrderings] != nil)
     objs = [objs sortedArrayUsingKeyOrderArray:[self sortOrderings]];
   
   objs = [objs copy];
   NSMutableString *ms;
 
   ms = [NSMutableString stringWithCapacity:64];
-  [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
+  [ms appendFormat:@"<0x%p[%@]:", 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
   andKeys:(NSArray *)_keys
 {
+  /*
+    This works on a dictionary of arrays. It walks over the keys in the given
+    order and flattenes the value arrays into one array.
+  */
   NSMutableArray *result = nil;
   unsigned int   i, cnt;