From 94c18d20dcf88965293a75e8684c36fe9ae171a0 Mon Sep 17 00:00:00 2001 From: znek Date: Mon, 28 Jun 2004 18:46:32 +0000 Subject: [PATCH] forwarding methods to event git-svn-id: http://svn.opengroupware.org/SOGo/trunk@68 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGoLogic/SOGoAppointment.h | 35 +++++++++++++++- SOGoLogic/SOGoAppointment.m | 82 ++++++++++++++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 3 deletions(-) diff --git a/SOGoLogic/SOGoAppointment.h b/SOGoLogic/SOGoAppointment.h index a85331bc..c0a3d335 100644 --- a/SOGoLogic/SOGoAppointment.h +++ b/SOGoLogic/SOGoAppointment.h @@ -27,14 +27,47 @@ #import +@class iCalPerson; + @interface SOGoAppointment : NSObject { + id calendar; id event; } -- (id)initWithiCalString:(NSString *)_iCal; +- (id)initWithICalString:(NSString *)_iCal; + +- (void)setUid:(NSString *)_value; +- (NSString *)uid; + +- (void)setSummary:(NSString *)_value; +- (NSString *)summary; + +- (void)setLocation:(NSString *)_value; +- (NSString *)location; + +- (void)setStartDate:(NSCalendarDate *)_date; +- (NSCalendarDate *)startDate; + +- (void)setEndDate:(NSCalendarDate *)_date; +- (NSCalendarDate *)endDate; +- (BOOL)hasEndDate; + +- (BOOL)hasDuration; +- (void)setDuration:(NSTimeInterval)_duration; +- (NSTimeInterval)duration; + +- (void)setOrganizer:(iCalPerson *)_organizer; +- (iCalPerson *)organizer; + +- (void)addToAttendees:(iCalPerson *)_person; +- (NSArray *)attendees; + + +/* do we really need these? */ +- (id)calendar; - (id)event; @end diff --git a/SOGoLogic/SOGoAppointment.m b/SOGoLogic/SOGoAppointment.m index ede2088e..3fc09d9f 100644 --- a/SOGoLogic/SOGoAppointment.m +++ b/SOGoLogic/SOGoAppointment.m @@ -23,11 +23,12 @@ #include "SOGoAppointment.h" #include +#include @implementation SOGoAppointment -- (id)initWithiCalString:(NSString *)_iCal { +- (id)initWithICalString:(NSString *)_iCal { if ((self = [self init])) { id parser; SaxObjectDecoder *sax; @@ -53,7 +54,9 @@ [parser setErrorHandler:sax]; [parser parseFromSource:_iCal]; - self->event = [[sax rootObject] retain]; + self->calendar = [[sax rootObject] retain]; + self->event = [[[self->calendar events] lastObject] retain]; + [parser release]; [sax release]; } @@ -61,12 +64,87 @@ } - (void)dealloc { + [self->calendar release]; [self->event release]; [super dealloc]; } + +/* accessors */ + + +- (id)calendar { + return self->calendar; +} + - (id)event { return self->event; } + +/* forwarded methods */ + + +- (void)setUid:(NSString *)_value { + [self->event setUid:_value]; +} +- (NSString *)uid { + return [self->event uid]; +} + +- (void)setSummary:(NSString *)_value { + [self->event setSummary:_value]; +} +- (NSString *)summary { + return [self->event summary]; +} + +- (void)setLocation:(NSString *)_value { + [self->event setLocation:_value]; +} +- (NSString *)location { + return [self->event location]; +} + +- (void)setStartDate:(NSCalendarDate *)_date { + [self->event setStartDate:_date]; +} + +- (NSCalendarDate *)startDate { + return [self->event startDate]; +} + +- (void)setEndDate:(NSCalendarDate *)_date { + [self->event setEndDate:_date]; +} +- (NSCalendarDate *)endDate { + return [self->event endDate]; +} +- (BOOL)hasEndDate { + return [self->event hasEndDate]; +} + +- (BOOL)hasDuration { + return [self->event hasDuration]; +} +- (void)setDuration:(NSTimeInterval)_duration { +} +- (NSTimeInterval)duration { + return [self->event durationAsTimeInterval]; +} + +- (void)setOrganizer:(iCalPerson *)_organizer { + [self->event setOrganizer:_organizer]; +} +- (iCalPerson *)organizer { + return [self->event organizer]; +} + +- (void)addToAttendees:(iCalPerson *)_person { + [self->event addToAttendees:_person]; +} +- (NSArray *)attendees { + return [self->event attendees]; +} + @end -- 2.39.5