PageRenderTime 91ms CodeModel.GetById 71ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 135 lines | 81 code | 36 blank | 18 comment | 2 complexity | 86de89960aee7dcb55c3e8daf4f6e4f6 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//  GDataEntryYouTubeSubscription.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
 21
 22#import "GDataEntryYouTubeSubscription.h"
 23#import "GDataYouTubeConstants.h"
 24#import "GDataYouTubeElements.h"
 25
 26@implementation GDataEntryYouTubeSubscription
 27
 28+ (GDataEntryYouTubeSubscription *)subscriptionEntry {
 29  
 30  GDataEntryYouTubeSubscription *entry = [self object];
 31
 32  [entry setNamespaces:[GDataYouTubeConstants youTubeNamespaces]];
 33  
 34  return entry;
 35}
 36
 37#pragma mark -
 38
 39+ (NSString *)standardEntryKind {
 40  return kGDataCategoryYouTubeSubscription;
 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  // YouTube element extensions
 54  [self addExtensionDeclarationForParentClass:entryClass
 55                                 childClasses:
 56   [GDataYouTubeUsername class],
 57   [GDataYouTubeQueryString class],
 58   [GDataYouTubePlaylistTitle class],
 59   nil];
 60  
 61}
 62
 63#if !GDATA_SIMPLE_DESCRIPTIONS
 64- (NSMutableArray *)itemsForDescription {
 65
 66  static struct GDataDescriptionRecord descRecs[] = {
 67    { @"username",      @"username",           kGDataDescValueLabeled },
 68    { @"query",         @"youTubeQueryString", kGDataDescValueLabeled },
 69    { @"playlistID",    @"playlistID",         kGDataDescValueLabeled },
 70    { @"playlistTitle", @"playlistTitle",      kGDataDescValueLabeled },
 71    { nil, nil, (GDataDescRecTypes)0 }
 72  };
 73
 74  NSMutableArray *items = [super itemsForDescription];
 75  [self addDescriptionRecords:descRecs toItems:items];
 76  return items;
 77}
 78#endif
 79
 80#pragma mark -
 81
 82- (NSString *)subscriptionType {
 83  
 84  NSArray *subs;
 85  
 86  subs = [self categoriesWithScheme:kGDataSchemeYouTubeSubscription];
 87  
 88  if ([subs count] > 0) {
 89    GDataCategory *subscription = [subs objectAtIndex:0];
 90    NSString *term = [subscription term];
 91    return term;
 92  }
 93  return nil;
 94}
 95
 96#pragma mark -
 97
 98- (NSString *)username {
 99  GDataYouTubeUsername *obj = [self objectForExtensionClass:[GDataYouTubeUsername class]];
100  return [obj stringValue];
101}
102
103- (void)setUsername:(NSString *)str {
104  GDataYouTubeUsername *obj = [GDataYouTubeUsername valueWithString:str];
105  [self setObject:obj forExtensionClass:[GDataYouTubeUsername class]];
106}
107
108- (NSString *)youTubeQueryString {
109  GDataYouTubeQueryString *obj = [self objectForExtensionClass:[GDataYouTubeQueryString class]];
110  return [obj stringValue];
111}
112
113- (void)setYouTubeQueryString:(NSString *)str {
114  GDataYouTubeQueryString *obj = [GDataYouTubeQueryString valueWithString:str];
115  [self setObject:obj forExtensionClass:[GDataYouTubeQueryString class]];
116}
117
118- (NSString *)playlistTitle {
119  GDataYouTubePlaylistTitle *obj;
120
121  obj = [self objectForExtensionClass:[GDataYouTubePlaylistTitle class]];
122  return [obj stringValue];
123}
124
125- (void)setPlaylistTitle:(NSString *)str {
126  GDataYouTubePlaylistTitle *obj;
127
128  obj = [GDataYouTubePlaylistTitle valueWithString:str];
129  [self setObject:obj forExtensionClass:[GDataYouTubePlaylistTitle class]];
130}
131
132
133@end
134
135#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE