PageRenderTime 31ms CodeModel.GetById 20ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Elements/GDataWhen.m

http://macfuse.googlecode.com/
Objective C | 81 lines | 43 code | 17 blank | 21 comment | 2 complexity | 734488f28d4c9e3e9d53904f32525a38 MD5 | raw file
 1/* Copyright (c) 2007 Google Inc.
 2*
 3* Licensed under the Apache License, Version 2.0 (the "License");
 4* you may not use this file except in compliance with the License.
 5* You may obtain a copy of the License at
 6*
 7*     http://www.apache.org/licenses/LICENSE-2.0
 8*
 9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15
16//
17//  GDataWhen.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CALENDAR_SERVICE \
21  || GDATA_INCLUDE_CONTACTS_SERVICE
22
23#import "GDataWhen.h"
24
25static NSString* const kValueAttr = @"valueString";
26static NSString* const kStartTimeAttr = @"startTime";
27static NSString* const kEndTimeAttr = @"endTime";
28
29@implementation GDataWhen
30// when element, as in
31// <gd:when startTime="2005-06-06" endTime="2005-06-07" valueString="This weekend"/>
32//
33// http://code.google.com/apis/gdata/common-elements.html#gdWhen
34
35+ (NSString *)extensionElementURI       { return kGDataNamespaceGData; }
36+ (NSString *)extensionElementPrefix    { return kGDataNamespaceGDataPrefix; }
37+ (NSString *)extensionElementLocalName { return @"when"; }
38
39+ (GDataWhen *)whenWithStartTime:(GDataDateTime *)startTime
40                         endTime:(GDataDateTime *)endTime {
41  GDataWhen *obj = [self object];
42  [obj setStartTime:startTime];
43  [obj setEndTime:endTime];
44  return obj;
45}
46
47- (void)addParseDeclarations {
48  NSArray *attrs = [NSArray arrayWithObjects:
49                    kValueAttr, kStartTimeAttr, kEndTimeAttr, nil];
50  [self addLocalAttributeDeclarations:attrs];
51}
52
53#pragma mark -
54
55- (GDataDateTime *)startTime {
56  return [self dateTimeForAttribute:kStartTimeAttr];
57}
58
59- (void)setStartTime:(GDataDateTime *)cdate {
60  [self setDateTimeValue:cdate forAttribute:kStartTimeAttr];
61}
62
63- (GDataDateTime *)endTime {
64  return [self dateTimeForAttribute:kEndTimeAttr];
65}
66
67- (void)setEndTime:(GDataDateTime *)cdate {
68  [self setDateTimeValue:cdate forAttribute:kEndTimeAttr];
69}
70
71- (NSString *)value {
72  return [self stringValueForAttribute:kValueAttr];
73}
74
75- (void)setValue:(NSString *)str {
76  [self setStringValue:str forAttribute:kValueAttr];
77}
78
79@end
80
81#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CALENDAR_SERVICE