/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/YouTube/GDataFeedYouTubePlaylist.m

http://macfuse.googlecode.com/ · Objective C · 116 lines · 68 code · 30 blank · 18 comment · 5 complexity · 68d95f49175ac6bb505ec67a49aa47c0 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. // GDataFeedYouTubePlaylist.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
  19. #import "GDataFeedYouTubePlaylist.h"
  20. #import "GDataYouTubeConstants.h"
  21. @implementation GDataFeedYouTubePlaylist
  22. + (GDataFeedYouTubePlaylist *)playlistFeed {
  23. GDataFeedYouTubePlaylist *feed = [self object];
  24. [feed setNamespaces:[GDataYouTubeConstants youTubeNamespaces]];
  25. return feed;
  26. }
  27. + (NSString *)standardFeedKind {
  28. return kGDataCategoryYouTubePlaylist;
  29. }
  30. + (void)load {
  31. [self registerFeedClass];
  32. }
  33. - (void)addExtensionDeclarations {
  34. [super addExtensionDeclarations];
  35. Class feedClass = [self class];
  36. [self addExtensionDeclarationForParentClass:feedClass
  37. childClasses:
  38. [GDataYouTubePrivate class],
  39. [GDataYouTubePlaylistID class],
  40. // YouTubeMediaGroup encapsulates YouTubeMediaContent
  41. [GDataYouTubeMediaGroup class],
  42. nil];
  43. }
  44. #if !GDATA_SIMPLE_DESCRIPTIONS
  45. - (NSMutableArray *)itemsForDescription {
  46. NSMutableArray *items = [super itemsForDescription];
  47. if ([self isPrivate]) [items addObject:@"private"];
  48. [self addToArray:items objectDescriptionIfNonNil:[self mediaGroup] withName:@"mediaGroup"];
  49. return items;
  50. }
  51. #endif
  52. - (Class)classForEntries {
  53. return kUseRegisteredEntryClass;
  54. }
  55. #pragma mark -
  56. - (BOOL)isPrivate {
  57. GDataYouTubePrivate *obj = [self objectForExtensionClass:[GDataYouTubePrivate class]];
  58. return (obj != nil);
  59. }
  60. - (void)setIsPrivate:(BOOL)flag {
  61. if (flag) {
  62. GDataYouTubePrivate *private = [GDataYouTubePrivate implicitValue];
  63. [self setObject:private forExtensionClass:[GDataYouTubePrivate class]];
  64. } else {
  65. [self setObject:nil forExtensionClass:[GDataYouTubePrivate class]];
  66. }
  67. }
  68. - (GDataYouTubeMediaGroup *)mediaGroup {
  69. return [self objectForExtensionClass:[GDataYouTubeMediaGroup class]];
  70. }
  71. - (void)setMediaGroup:(GDataYouTubeMediaGroup *)obj {
  72. [self setObject:obj forExtensionClass:[GDataYouTubeMediaGroup class]];
  73. }
  74. - (NSString *)playlistID {
  75. GDataYouTubePlaylistID *obj = [self objectForExtensionClass:[GDataYouTubePlaylistID class]];
  76. return [obj stringValue];
  77. }
  78. - (void)setPlaylistID:(NSString *)str {
  79. GDataYouTubePlaylistID *obj = [GDataYouTubePlaylistID valueWithString:str];
  80. [self setObject:obj forExtensionClass:[GDataYouTubePlaylistID class]];
  81. }
  82. + (NSString *)defaultServiceVersion {
  83. return kGDataYouTubeDefaultServiceVersion;
  84. }
  85. @end
  86. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE