/Source/externals/GData/Source/Clients/YouTube/GDataEntryYouTubeFeedLinkBase.m

http://google-email-uploader-mac.googlecode.com/ · Objective C · 107 lines · 59 code · 26 blank · 22 comment · 1 complexity · 136bf605b6f7e546a22b9e6098c18256 MD5 · raw file

  1. /* Copyright (c) 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. // GDataEntryYouTubeFeedLinkBase.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
  19. #import "GDataEntryYouTubeFeedLinkBase.h"
  20. #import "GDataYouTubeConstants.h"
  21. // this is the superclass for GDataEntryYouTubeSubscription and
  22. // GDataEntryYouTubePlaylistLink
  23. @implementation GDataEntryYouTubeFeedLinkBase
  24. - (void)addExtensionDeclarations {
  25. [super addExtensionDeclarations];
  26. Class entryClass = [self class];
  27. // YouTube element extensions
  28. [self addExtensionDeclarationForParentClass:entryClass
  29. childClasses:
  30. [GDataYouTubePrivate class],
  31. [GDataYouTubeCountHint class],
  32. [GDataYouTubePlaylistID class],
  33. // elements present in GData v1 only
  34. [GDataFeedLink class],
  35. // media extensions
  36. [GDataMediaGroup class],
  37. nil];
  38. }
  39. #if !GDATA_SIMPLE_DESCRIPTIONS
  40. - (NSMutableArray *)itemsForDescription {
  41. static struct GDataDescriptionRecord descRecs[] = {
  42. { @"mediaGroup", @"mediaGroup", kGDataDescValueLabeled },
  43. { @"countHint", @"countHint", kGDataDescValueLabeled },
  44. { nil, nil, (GDataDescRecTypes)0 }
  45. };
  46. NSMutableArray *items = [super itemsForDescription];
  47. [self addDescriptionRecords:descRecs toItems:items];
  48. return items;
  49. }
  50. #endif
  51. + (NSString *)defaultServiceVersion {
  52. return kGDataYouTubeDefaultServiceVersion;
  53. }
  54. #pragma mark -
  55. - (GDataMediaGroup *)mediaGroup {
  56. GDataMediaGroup *obj = [self objectForExtensionClass:[GDataMediaGroup class]];
  57. return obj;
  58. }
  59. - (void)setMediaGroup:(GDataMediaGroup *)obj {
  60. [self setObject:obj forExtensionClass:[GDataMediaGroup class]];
  61. }
  62. - (NSString *)countHint {
  63. GDATA_DEBUG_ASSERT_MIN_SERVICE_V2();
  64. GDataYouTubeCountHint *obj = [self objectForExtensionClass:[GDataYouTubeCountHint class]];
  65. return [obj stringValue];
  66. }
  67. - (void)setCountHint:(NSString *)str {
  68. GDATA_DEBUG_ASSERT_MIN_SERVICE_V2();
  69. GDataYouTubeCountHint *obj = [GDataYouTubeCountHint valueWithString:str];
  70. [self setObject:obj forExtensionClass:[GDataYouTubeCountHint class]];
  71. }
  72. - (NSString *)playlistID {
  73. GDataYouTubePlaylistID *obj = [self objectForExtensionClass:[GDataYouTubePlaylistID class]];
  74. return [obj stringValue];
  75. }
  76. - (void)setPlaylistID:(NSString *)str {
  77. GDataYouTubePlaylistID *obj = [GDataYouTubePlaylistID valueWithString:str];
  78. [self setObject:obj forExtensionClass:[GDataYouTubePlaylistID class]];
  79. }
  80. @end
  81. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE