#import <Foundation/Foundation.h>
+@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
#include "SOGoAppointment.h"
#include <SaxObjC/SaxObjC.h>
+#include <NGiCal/NGiCal.h>
@implementation SOGoAppointment
-- (id)initWithiCalString:(NSString *)_iCal {
+- (id)initWithICalString:(NSString *)_iCal {
if ((self = [self init])) {
id<NSObject,SaxXMLReader> parser;
SaxObjectDecoder *sax;
[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];
}
}
- (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