2 Copyright (C) 2005 Helge Hess
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 "NGVCardSimpleValue.h"
25 @implementation NGVCardSimpleValue
28 return [super version] + 0 /* v0 */;
31 NSAssert2([super version] == 0,
32 @"invalid superclass (%@) version %i !",
33 NSStringFromClass([self superclass]), [super version]);
36 - (id)initWithValue:(NSString *)_value group:(NSString *)_group
37 types:(NSArray *)_types arguments:(NSDictionary *)_a
39 if ((self = [super initWithGroup:_group types:_types arguments:_a]) != nil) {
40 self->value = [_value copy];
45 - (id)initWithGroup:(NSString *)_group types:(NSArray *)_types
46 arguments:(NSDictionary *)_a
48 return [self initWithValue:nil group:_group types:_types arguments:_a];
51 return [self initWithValue:nil group:nil types:nil arguments:nil];
55 [self->value release];
61 - (NSString *)stringValue {
66 return [self stringValue];
69 /* fake being a string */
71 - (unichar)characterAtIndex:(unsigned)_idx {
72 return [self->value characterAtIndex:_idx];
75 return [self->value length];
80 - (void)encodeWithCoder:(NSCoder *)_coder {
81 [super encodeWithCoder:_coder];
82 [_coder encodeObject:self->value];
84 - (id)initWithCoder:(NSCoder *)_coder {
85 if ((self = [super initWithCoder:_coder]) != nil) {
86 self->value = [[_coder decodeObject] copy];
93 - (void)appendAttributesToDescription:(NSMutableString *)_ms {
94 if (self->value != nil) [_ms appendFormat:@" value='%@'", self->value];
95 [super appendAttributesToDescription:_ms];
98 @end /* NGVCardSimpleValue */