1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3 
4   This file is part of SOPE.
5 
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10 
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15 
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 
22 #ifndef _EOGrouping_h__
23 #define _EOGrouping_h__
24 
25 #import <Foundation/NSObject.h>
26 
27 @class NSString, NSArray, NSMutableArray;
28 @class EOQualifier;
29 
30 @interface EOGrouping : NSObject
31 {
32   NSString *defaultName;
33   NSArray  *sortOrderings;
34 }
35 
36 - (id)initWithDefaultName:(NSString *)_defaultName;
37 
38 - (NSString *)defaultName;
39 - (void)setDefaultName:(NSString *)_defaultName;
40 
41 - (NSArray *)sortOrderings;
42 - (void)setSortOrderings:(NSArray *)_sortOrderings;
43 
44 - (NSString *)groupNameForObject:(id)object;
45 - (NSArray *)orderedGroupNames;
46 
47 @end
48 
49 @interface EOGroupingSet : EOGrouping
50 {
51   NSArray *groupings;
52 }
53 
54 - (NSArray *)groupings;
55 - (void)setGroupings:(NSArray *)_groupings;
56 
57 @end
58 
59 @interface EOKeyGrouping : EOGrouping
60 {
61   NSString       *key;
62   NSMutableArray *groupNames; /* ??? to be fixed */
63 }
64 
65 - (id)initWithKey:(NSString *)_key;
66 
67 - (NSString *)key;
68 - (void)setKey:(NSString *)_key;
69 
70 @end
71 
72 @interface EOQualifierGrouping : EOGrouping
73 {
74   EOQualifier *qualifier;
75   NSString    *name;
76 }
77 
78 - (id)initWithQualifier:(EOQualifier *)_qualifier name:(NSString *)_name;
79 
80 - (void)setName:(NSString *)_name;
81 - (NSString *)name;
82 
83 - (void)setQualifier:(EOQualifier *)_qualifier;
84 - (EOQualifier *)qualifier;
85 
86 @end
87 
88 #import <Foundation/NSArray.h>
89 
90 @class NSDictionary;
91 
92 @interface NSArray(EOGrouping)
93 - (NSDictionary *)arrayGroupedBy:(EOGrouping *)_grouping;
94 @end
95 
96 #import <EOControl/EOFetchSpecification.h>
97 
98 extern NSString *EOGroupingHint;
99 
100 @interface EOFetchSpecification(Groupings)
101 - (void)setGroupings:(NSArray *)_groupings;
102 - (NSArray *)groupings;
103 @end
104 
105 #endif /* _EOGrouping_h__ */
106