-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathVCalendar.m
107 lines (78 loc) · 2.28 KB
/
VCalendar.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//
// VCalendar.m
// QSCalendarSupport
//
// Created by Brian Donovan on 31/03/05.
// Copyright 2005 __MyCompanyName__. All rights reserved.
//
#import "VCalendar.h"
#import "VFileGlobals.h"
@implementation VCalendar
+ (id)calendarWithScanner:(NSScanner *)scanner {
return [[[VCalendar alloc] initWithScanner:scanner] autorelease];
}
+ (id)calendarWithString:(NSString *)string {
return [[[VCalendar alloc] initWithString:string] autorelease];
}
+ (id)calendarWithData:(NSData *)data {
return [[[VCalendar alloc] initWithData:data] autorelease];
}
+ (id)calendarWithFileObject:(VFileObject *)object {
return [[[VCalendar alloc] initWithFileObject:object] autorelease];
}
- (id)initWithScanner:(NSScanner *)scanner {
if (!(self = [super init]))
return nil;
return [self initWithFileObject:[VFileObject objectWithScanner:scanner]];
}
- (id)initWithString:(NSString *)string {
if (!(self = [super init]))
return nil;
return [self initWithFileObject:[VFileObject objectWithString:string]];
}
- (id)initWithData:(NSData *)data {
if (!(self = [super init]))
return nil;
return [self initWithFileObject:[VFileObject objectWithData:data]];
}
- (id)initWithFileObject:(VFileObject *)object {
if (!(self = [super init]))
return nil;
if (!eqci([object type], VCALENDARType)) {
NSLog(@"Error: Parsed object is type %@, expecting %@", [object type], VCALENDARType);
[self autorelease];
return nil;
}
[self setType:VCALENDARType];
[self setContents:[object contents]];
return self;
}
- (NSString *)calendarName {
return [self parsedValueForProperty:VCALENDARName];
}
- (NSString *)productIdentifier {
return [self parsedValueForProperty:VCALENDARProductIdentifier];
}
- (NSString *)version {
return [self parsedValueForProperty:VCALENDARVersion];
}
- (NSString *)scale {
return [self parsedValueForProperty:VCALENDARScale];
}
- (NSString *)method {
return [self parsedValueForProperty:VCALENDARMethod];
}
- (NSString *)identifier {
return [self parsedValueForProperty:VCALENDARIdentifier];
}
- (NSString *)timezone {
return [self parsedValueForProperty:VCALENDARTimezoneProperty];
}
- (NSArray *)events {
return [self objectsForType:VCALENDAREventType];
}
- (NSArray *)todoEntries {
return [self objectForType:VCALENDARTodoType];
}
- (NSArray *)journalEntries;
@end