/Source/externals/GData/Source/Elements/GDataComment.m

http://google-email-uploader-mac.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. // GDataComment.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_BOOKS_SERVICE \
  19. || GDATA_INCLUDE_CALENDAR_SERVICE || GDATA_INCLUDE_YOUTUBE_SERVICE
  20. #import "GDataComment.h"
  21. static NSString* const kRelAttr = @"rel";
  22. @implementation GDataComment
  23. // a commments entry, as in
  24. // <gd:comments>
  25. // <gd:feedLink href="http://www.google.com/calendar/feeds/t..."/>
  26. // </gd:comments>
  27. //
  28. // http://code.google.com/apis/gdata/common-elements.html#gdComments
  29. + (NSString *)extensionElementURI { return kGDataNamespaceGData; }
  30. + (NSString *)extensionElementPrefix { return kGDataNamespaceGDataPrefix; }
  31. + (NSString *)extensionElementLocalName { return @"comments"; }
  32. + (GDataComment *)commentWithFeedLink:(GDataFeedLink *)feedLink {
  33. GDataComment *obj = [self object];
  34. [obj setFeedLink:feedLink];
  35. return obj;
  36. }
  37. - (void)addExtensionDeclarations {
  38. [super addExtensionDeclarations];
  39. [self addExtensionDeclarationForParentClass:[self class]
  40. childClass:[GDataFeedLink class]];
  41. }
  42. - (void)addParseDeclarations {
  43. NSArray *attrs = [NSArray arrayWithObject:kRelAttr];
  44. [self addLocalAttributeDeclarations:attrs];
  45. }
  46. #if !GDATA_SIMPLE_DESCRIPTIONS
  47. - (NSMutableArray *)itemsForDescription {
  48. NSMutableArray *items = [super itemsForDescription];
  49. [self addToArray:items objectDescriptionIfNonNil:[self feedLink] withName:@"feedLink"];
  50. return items;
  51. }
  52. #endif
  53. #pragma mark -
  54. - (NSString *)rel {
  55. return [self stringValueForAttribute:kRelAttr];
  56. }
  57. - (void)setRel:(NSString *)str {
  58. [self setStringValue:str forAttribute:kRelAttr];
  59. }
  60. - (GDataFeedLink *)feedLink {
  61. return [self objectForExtensionClass:[GDataFeedLink class]];
  62. }
  63. - (void)setFeedLink:(GDataFeedLink *)feedLink {
  64. [self setObject:feedLink forExtensionClass:[GDataFeedLink class]];
  65. }
  66. @end
  67. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_*_SERVICE