2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
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
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.
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
22 #include "EOQualifier.h"
25 @implementation EOQualifierVariable
27 + (id)variableWithKey:(NSString *)_key {
28 return [[[self alloc] initWithKey:_key] autorelease];
31 - (id)initWithKey:(NSString *)_key {
32 self->varKey = [_key copyWithZone:[self zone]];
36 return [self initWithKey:nil];
40 [self->varKey release];
52 - (void)encodeWithCoder:(NSCoder *)_coder {
53 [_coder encodeObject:self->varKey];
55 - (id)initWithCoder:(NSCoder *)_coder {
56 self->varKey = [[_coder decodeObject] copyWithZone:[self zone]];
62 - (BOOL)isEqual:(id)_obj {
63 if ([_obj isKindOfClass:[self class]])
64 return [self isEqualToQualifierVariable:(EOQualifierVariable *)_obj];
69 - (BOOL)isEqualToQualifierVariable:(EOQualifierVariable *)_obj {
70 return [self->varKey isEqual:[_obj key]];
73 /* key/value archiving */
75 - (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
76 if ((self = [super init]) != nil) {
77 self->varKey = [[_unarchiver decodeObjectForKey:@"key"] copy];
81 - (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
82 [_archiver encodeObject:[self key] forKey:@"key"];
87 - (NSString *)qualifierDescription {
88 return [@"$" stringByAppendingString:[self key]];
91 - (NSString *)description {
92 return [NSString stringWithFormat:@"<%@[0x%08X]: variable=%@>",
93 NSStringFromClass([self class]), self,
97 @end /* EOQualifierVariable */