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 "NGVCardCategories.h"
25 @implementation NGVCardCategories
28 [self->categories release];
34 - (NSArray *)categories {
35 return self->categories;
40 - (NSString *)stringValue {
41 return [self vCardString];
44 - (NSString *)xmlString {
45 return [[self stringValue] stringByEscapingXMLString];
48 - (NSString *)vCardString {
49 return [[self categories] componentsJoinedByString:@","];
53 return [self categories];
56 - (NSArray *)asArray {
57 return self->categories;
60 /* fake being an array */
62 - (id)objectAtIndex:(unsigned)_idx {
63 return [self->categories objectAtIndex:_idx];
66 return [self->categories count];
69 /* fake being a string */
71 - (unichar)characterAtIndex:(unsigned)_idx {
72 return [[self stringValue] characterAtIndex:_idx];
75 return [[self stringValue] length];
80 - (void)encodeWithCoder:(NSCoder *)_coder {
81 [super encodeWithCoder:_coder];
82 [_coder encodeObject:self->categories];
84 - (id)initWithCoder:(NSCoder *)_coder {
85 if ((self = [super initWithCoder:_coder]) != nil) {
86 self->categories = [[_coder decodeObject] copy];
93 - (void)appendAttributesToDescription:(NSMutableString *)_ms {
94 [super appendAttributesToDescription:_ms];
95 [_ms appendFormat:@" vcard=%@", [self vCardString]];
98 @end /* NGVCardCategories */