]> err.no Git - sope/blob - sope-ical/NGiCal/iCalToDo.m
use %p for pointer formats
[sope] / sope-ical / NGiCal / iCalToDo.m
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
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 "iCalToDo.h"
23 #include "iCalRecurrenceRule.h"
24 #include "common.h"
25
26 @implementation iCalToDo
27
28 + (int)version {
29   return [super version] + 0 /* v1 */;
30 }
31 + (void)initialize {
32   NSAssert2([super version] == 1,
33             @"invalid superclass (%@) version %i !",
34             NSStringFromClass([self superclass]), [super version]);
35 }
36
37 - (void)dealloc {
38   [self->due             release];
39   [self->percentComplete release];
40   [self->completed       release];
41   [super dealloc];
42 }
43
44 /* NSCopying */
45
46 - (id)copyWithZone:(NSZone *)_zone {
47   iCalToDo *new;
48   
49   new = [super copyWithZone:_zone];
50   
51   new->due             = [self->due             copyWithZone:_zone];
52   new->percentComplete = [self->percentComplete copyWithZone:_zone];
53   new->completed       = [self->completed       copyWithZone:_zone];
54
55   return new;
56 }
57
58 /* accessors */
59
60 - (void)setPercentComplete:(NSString *)_value {
61   ASSIGN(self->percentComplete, _value);
62 }
63 - (NSString *)percentComplete {
64   return self->percentComplete;
65 }
66
67 - (void)setDue:(NSCalendarDate *)_date {
68   ASSIGN(self->due, _date);
69 }
70 - (NSCalendarDate *)due {
71   return self->due;
72 }
73
74 - (void)setCompleted:(NSCalendarDate *)_date {
75   ASSIGN(self->completed, _date);
76 }
77 - (NSCalendarDate *)completed {
78   return self->completed;
79 }
80
81 /* ical typing */
82
83 - (NSString *)entityName {
84   return @"vtodo";
85 }
86
87 /* descriptions */
88
89 - (NSString *)description {
90   NSMutableString *ms;
91
92   ms = [NSMutableString stringWithCapacity:128];
93   [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])];
94
95   if (self->uid)       [ms appendFormat:@" uid=%@", self->uid];
96   if (self->startDate) [ms appendFormat:@" start=%@", self->startDate];
97   if (self->due)       [ms appendFormat:@" due=%@", self->due];
98   if (self->priority)  [ms appendFormat:@" pri=%@", self->priority];
99
100   if (self->completed) 
101     [ms appendFormat:@" completed=%@", self->completed];
102   if (self->percentComplete) 
103     [ms appendFormat:@" complete=%@", self->percentComplete];
104   if (self->accessClass) 
105     [ms appendFormat:@" class=%@", self->accessClass];
106   
107   if (self->summary)
108     [ms appendFormat:@" summary=%@", self->summary];
109
110   [ms appendString:@">"];
111   return ms;
112 }
113
114 @end /* iCalToDo */