2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo 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
11 OGo 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.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include "EOGrouping.h"
24 #include <EOControl/EOQualifier.h>
27 @implementation EOQualifierGrouping
29 - (id)initWithQualifier:(EOQualifier *)_qualifier name:(NSString *)_name {
30 if ((self = [super initWithDefaultName:nil])) {
31 self->name = [_name copy];
32 self->qualifier = [_qualifier retain];
38 [self->qualifier release];
45 - (void)setName:(NSString *)_name {
46 NSAssert1(_name != nil, @"%s: name is nil", __PRETTY_FUNCTION__);
47 ASSIGNCOPY(self->name, _name);
53 - (void)setQualifier:(EOQualifier *)_qualifier {
54 ASSIGN(self->qualifier, _qualifier);
56 - (EOQualifier *)qualifier {
57 return self->qualifier;
62 - (NSString *)groupNameForObject:(id)_object {
63 if (self->qualifier == nil)
66 if ([(id<EOQualifierEvaluation>)self->qualifier evaluateWithObject:_object])
69 return self->defaultName;
72 - (NSArray *)orderedGroupNames {
73 return [NSArray arrayWithObjects:[self name], [self defaultName], nil];
76 @end /* EOQualifierGrouping */