PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 89 lines | 44 code | 22 blank | 23 comment | 3 complexity | 8a7368f2c1f10565cd702df07106b72f MD5 | raw file
 1/* Copyright (c) 2007-2008 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//  GDataComment.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_BOOKS_SERVICE \
21  || GDATA_INCLUDE_CALENDAR_SERVICE || GDATA_INCLUDE_YOUTUBE_SERVICE
22
23#import "GDataComment.h"
24
25static NSString* const kRelAttr = @"rel";
26
27@implementation GDataComment
28// a commments entry, as in
29// <gd:comments>
30//    <gd:feedLink href="http://www.google.com/calendar/feeds/t..."/>
31// </gd:comments>
32//
33// http://code.google.com/apis/gdata/common-elements.html#gdComments
34
35+ (NSString *)extensionElementURI       { return kGDataNamespaceGData; }
36+ (NSString *)extensionElementPrefix    { return kGDataNamespaceGDataPrefix; }
37+ (NSString *)extensionElementLocalName { return @"comments"; }
38
39+ (GDataComment *)commentWithFeedLink:(GDataFeedLink *)feedLink {
40  GDataComment *obj = [self object];
41  [obj setFeedLink:feedLink];
42  return obj;
43}
44
45- (void)addExtensionDeclarations {
46
47  [super addExtensionDeclarations];
48
49  [self addExtensionDeclarationForParentClass:[self class]
50                                   childClass:[GDataFeedLink class]];
51}
52
53- (void)addParseDeclarations {
54  NSArray *attrs = [NSArray arrayWithObject:kRelAttr];
55
56  [self addLocalAttributeDeclarations:attrs];
57}
58
59#if !GDATA_SIMPLE_DESCRIPTIONS
60- (NSMutableArray *)itemsForDescription {
61  NSMutableArray *items = [super itemsForDescription];
62
63  [self addToArray:items objectDescriptionIfNonNil:[self feedLink] withName:@"feedLink"];
64
65  return items;
66}
67#endif
68
69#pragma mark -
70
71- (NSString *)rel {
72  return [self stringValueForAttribute:kRelAttr];
73}
74
75- (void)setRel:(NSString *)str {
76  [self setStringValue:str forAttribute:kRelAttr];
77}
78
79- (GDataFeedLink *)feedLink {
80  return [self objectForExtensionClass:[GDataFeedLink class]];
81}
82
83- (void)setFeedLink:(GDataFeedLink *)feedLink {
84  [self setObject:feedLink forExtensionClass:[GDataFeedLink class]];
85}
86
87@end
88
89#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_*_SERVICE