]> err.no Git - sope/blob - sope-ical/NGiCal/iCalFreeBusy.m
4305a8646f6243ae51d038595d03bb14b2979a98
[sope] / sope-ical / NGiCal / iCalFreeBusy.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 "iCalFreeBusy.h"
23 #include "iCalPerson.h"
24 #include "common.h"
25
26 @implementation iCalFreeBusy
27
28 - (void)dealloc {
29   [self->entries   release];
30   [self->organizer release];
31   [self->startDate release];
32   [self->endDate   release];
33   [self->url       release];
34   [super dealloc];
35 }
36
37 /* NSCopying */
38
39 - (id)copyWithZone:(NSZone *)_zone {
40   iCalFreeBusy *new;
41   
42   new = [super copyWithZone:_zone];
43   
44   ASSIGNCOPY(new->entries,   self->entries);
45   ASSIGNCOPY(new->organizer, self->organizer);
46   ASSIGNCOPY(new->startDate, self->startDate);
47   ASSIGNCOPY(new->endDate,   self->endDate);
48   ASSIGNCOPY(new->url,       self->url);
49   
50   return new;
51 }
52
53 /* accessors */
54
55 - (void)setUrl:(NSString *)_url {
56   ASSIGN(self->url, _url);
57 }
58 - (NSString *)url {
59   return self->url;
60 }
61
62 - (void)setStartDate:(NSCalendarDate *)_date {
63   ASSIGN(self->startDate, _date);
64 }
65 - (NSCalendarDate *)startDate {
66   return self->startDate;
67 }
68
69 - (void)setEndDate:(NSCalendarDate *)_date {
70   ASSIGN(self->endDate, _date);
71 }
72 - (NSCalendarDate *)endDate {
73   return self->endDate;
74 }
75
76 - (void)setOrganizer:(iCalPerson *)_organizer {
77   ASSIGN(self->organizer, _organizer);
78 }
79 - (iCalPerson *)organizer {
80   return self->organizer;
81 }
82
83 - (void)addToEntries:(id)_obj {
84   if (_obj == nil) return;
85   if (self->entries == nil)
86     self->entries = [[NSMutableArray alloc] initWithCapacity:1];
87   [self->entries addObject:_obj];
88 }
89
90 /* ical typing */
91
92 - (NSString *)entityName {
93   return @"vfreebusy";
94 }
95
96 /* descriptions */
97
98 - (NSString *)description {
99   NSMutableString *ms;
100
101   ms = [NSMutableString stringWithCapacity:128];
102   [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
103
104   if (self->startDate) [ms appendFormat:@" from=%@", self->startDate];
105   if (self->endDate)   [ms appendFormat:@" to=%@", self->endDate];
106   
107   if (self->organizer)
108     [ms appendFormat:@" organizer=%@", self->organizer];
109   
110   if ([self->entries count] > 0)
111     [ms appendFormat:@" %@", self->entries];
112   
113   [ms appendString:@">"];
114   return ms;
115 }
116
117 @end /* iCalFreeBusy */