PageRenderTime 45ms CodeModel.GetById 1ms app.highlight 40ms RepoModel.GetById 1ms 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
  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//
 17//  GDataEntryYouTubeChannel.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
 21
 22#import "GDataEntryYouTubeChannel.h"
 23#import "GDataYouTubeConstants.h"
 24#import "GDataYouTubeElements.h"
 25
 26@implementation GDataEntryYouTubeChannel
 27
 28+ (GDataEntryYouTubeChannel *)channelEntry {
 29
 30  GDataEntryYouTubeChannel *entry = [self object];
 31
 32  [entry setNamespaces:[GDataYouTubeConstants youTubeNamespaces]];
 33
 34  return entry;
 35}
 36
 37#pragma mark -
 38
 39+ (NSString *)standardEntryKind {
 40  return kGDataCategoryYouTubeChannel;
 41}
 42
 43+ (void)load {
 44  [self registerEntryClass];
 45}
 46
 47- (void)addExtensionDeclarations {
 48
 49  [super addExtensionDeclarations];
 50
 51  Class entryClass = [self class];
 52
 53  [self addExtensionDeclarationForParentClass:entryClass
 54                                   childClass:[GDataFeedLink class]];
 55}
 56
 57#if !GDATA_SIMPLE_DESCRIPTIONS
 58- (NSMutableArray *)itemsForDescription {
 59  
 60  static struct GDataDescriptionRecord descRecs[] = {
 61    { @"feedLinks", @"feedLinks", kGDataDescArrayCount },
 62    { nil, nil, (GDataDescRecTypes)0 }
 63  };
 64  
 65  NSMutableArray *items = [super itemsForDescription];
 66  [self addDescriptionRecords:descRecs toItems:items];
 67  return items;
 68}
 69#endif
 70
 71+ (NSString *)defaultServiceVersion {
 72  return kGDataYouTubeDefaultServiceVersion;
 73}
 74
 75#pragma mark -
 76
 77- (NSString *)channelType {
 78
 79  NSArray *subs;
 80
 81  subs = [self categoriesWithScheme:kGDataSchemeYouTubeChannelType];
 82
 83  if ([subs count] > 0) {
 84    GDataCategory *channel = [subs objectAtIndex:0];
 85    NSString *term = [channel term];
 86    return term;
 87  }
 88  return nil;
 89}
 90
 91#pragma mark -
 92
 93- (NSArray *)feedLinks {
 94  return [self objectsForExtensionClass:[GDataFeedLink class]]; 
 95}
 96
 97#pragma mark Convenience accessors
 98
 99- (GDataFeedLink *)feedLinkForRel:(NSString *)rel {
100  return [GDataUtilities firstObjectFromArray:[self feedLinks]
101                                    withValue:rel
102                                   forKeyPath:@"rel"];
103}
104
105- (GDataFeedLink *)uploadsFeedLink {
106  return [self feedLinkForRel:kGDataLinkYouTubeUploads];
107}
108
109- (GDataFeedLink *)featuredFeedLink {
110  return [self feedLinkForRel:kGDataLinkYouTubeFeatured];
111}
112
113@end
114
115#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE