PageRenderTime 49ms CodeModel.GetById 27ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 115 lines | 66 code | 32 blank | 17 comment | 2 complexity | 1cd25e1b8b558892b359447cbbe43c35 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, GPL-2.0
  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. // GDataEntryYouTubeChannel.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
  19. #import "GDataEntryYouTubeChannel.h"
  20. #import "GDataYouTubeConstants.h"
  21. #import "GDataYouTubeElements.h"
  22. @implementation GDataEntryYouTubeChannel
  23. + (GDataEntryYouTubeChannel *)channelEntry {
  24. GDataEntryYouTubeChannel *entry = [self object];
  25. [entry setNamespaces:[GDataYouTubeConstants youTubeNamespaces]];
  26. return entry;
  27. }
  28. #pragma mark -
  29. + (NSString *)standardEntryKind {
  30. return kGDataCategoryYouTubeChannel;
  31. }
  32. + (void)load {
  33. [self registerEntryClass];
  34. }
  35. - (void)addExtensionDeclarations {
  36. [super addExtensionDeclarations];
  37. Class entryClass = [self class];
  38. [self addExtensionDeclarationForParentClass:entryClass
  39. childClass:[GDataFeedLink class]];
  40. }
  41. #if !GDATA_SIMPLE_DESCRIPTIONS
  42. - (NSMutableArray *)itemsForDescription {
  43. static struct GDataDescriptionRecord descRecs[] = {
  44. { @"feedLinks", @"feedLinks", kGDataDescArrayCount },
  45. { nil, nil, (GDataDescRecTypes)0 }
  46. };
  47. NSMutableArray *items = [super itemsForDescription];
  48. [self addDescriptionRecords:descRecs toItems:items];
  49. return items;
  50. }
  51. #endif
  52. + (NSString *)defaultServiceVersion {
  53. return kGDataYouTubeDefaultServiceVersion;
  54. }
  55. #pragma mark -
  56. - (NSString *)channelType {
  57. NSArray *subs;
  58. subs = [self categoriesWithScheme:kGDataSchemeYouTubeChannelType];
  59. if ([subs count] > 0) {
  60. GDataCategory *channel = [subs objectAtIndex:0];
  61. NSString *term = [channel term];
  62. return term;
  63. }
  64. return nil;
  65. }
  66. #pragma mark -
  67. - (NSArray *)feedLinks {
  68. return [self objectsForExtensionClass:[GDataFeedLink class]];
  69. }
  70. #pragma mark Convenience accessors
  71. - (GDataFeedLink *)feedLinkForRel:(NSString *)rel {
  72. return [GDataUtilities firstObjectFromArray:[self feedLinks]
  73. withValue:rel
  74. forKeyPath:@"rel"];
  75. }
  76. - (GDataFeedLink *)uploadsFeedLink {
  77. return [self feedLinkForRel:kGDataLinkYouTubeUploads];
  78. }
  79. - (GDataFeedLink *)featuredFeedLink {
  80. return [self feedLinkForRel:kGDataLinkYouTubeFeatured];
  81. }
  82. @end
  83. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE