]> err.no Git - sope/blob - sope-ical/NGiCal/NGVCardSimpleValue.m
added some vCard model objects
[sope] / sope-ical / NGiCal / NGVCardSimpleValue.m
1 /*
2   Copyright (C) 2005 Helge Hess
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 #include "NGVCardValue.h"
23 #include "common.h"
24
25 @implementation NGVCardSimpleValue
26
27 - (void)dealloc {
28   [self->value release];
29   [super dealloc];
30 }
31
32 /* values */
33
34 - (NSString *)stringValue {
35   return self->value;
36 }
37
38 - (id)propertyList {
39   return [self stringValue];
40 }
41
42 /* fake being a string */
43
44 - (unichar)characterAtIndex:(unsigned)_idx {
45   return [self->value characterAtIndex:_idx];
46 }
47 - (unsigned)length {
48   return [self->value length];
49 }
50
51 /* NSCoding */
52
53 - (void)encodeWithCoder:(NSCoder *)_coder {
54   [super encodeWithCoder:_coder];
55   [_coder encodeObject:self->value];
56 }
57 - (id)initWithCoder:(NSCoder *)_coder {
58   if ((self = [super initWithCoder:_coder]) != nil) {
59     self->value = [[_coder decodeObject] copy];
60   }
61   return self;
62 }
63
64 @end /* NGVCardSimpleValue */