/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/YouTube/GDataYouTubeAccessControl.m
Objective C | 96 lines | 51 code | 24 blank | 21 comment | 1 complexity | d8b42761974c06c7ccde7ee27a372d75 MD5 | raw file
1/* Copyright (c) 2010 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// GDataYouTubeAccessControl.m 18// 19 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE 21 22// access control element, such as 23// <yt:accessControl action='comment' permission='allowed' type='group'> 24// friends 25// </yt:accessControl> 26 27#define GDATAYOUTUBEACCESSCONTROL_DEFINE_GLOBALS 1 28#import "GDataYouTubeAccessControl.h" 29 30#import "GDataYouTubeConstants.h" 31 32static NSString *const kActionAttr = @"action"; 33static NSString *const kPermissionAttr = @"permission"; 34static NSString *const kTypeAttr = @"type"; 35 36@implementation GDataYouTubeAccessControl 37 38+ (NSString *)extensionElementURI { return kGDataNamespaceYouTube; } 39+ (NSString *)extensionElementPrefix { return kGDataNamespaceYouTubePrefix; } 40+ (NSString *)extensionElementLocalName { return @"accessControl"; } 41 42+ (GDataYouTubeAccessControl *)accessControlWithAction:(NSString *)action 43 permission:(NSString *)permission { 44 GDataYouTubeAccessControl *obj = [self object]; 45 [obj setAction:action]; 46 [obj setPermission:permission]; 47 return obj; 48} 49 50- (void)addParseDeclarations { 51 52 NSArray *attrs = [NSArray arrayWithObjects: 53 kActionAttr, kPermissionAttr, kTypeAttr, nil]; 54 55 [self addLocalAttributeDeclarations:attrs]; 56 57 [self addContentValueDeclaration]; 58} 59 60#pragma mark - 61 62- (NSString *)action { 63 return [self stringValueForAttribute:kActionAttr]; 64} 65 66- (void)setAction:(NSString *)str { 67 [self setStringValue:str forAttribute:kActionAttr]; 68} 69 70- (NSString *)permission { 71 return [self stringValueForAttribute:kPermissionAttr]; 72} 73 74- (void)setPermission:(NSString *)str { 75 [self setStringValue:str forAttribute:kPermissionAttr]; 76} 77 78- (NSString *)type { 79 return [self stringValueForAttribute:kTypeAttr]; 80} 81 82- (void)setType:(NSString *)str { 83 [self setStringValue:str forAttribute:kTypeAttr]; 84} 85 86- (NSString *)value { 87 return [self contentStringValue]; 88} 89 90- (void)setValue:(NSString *)str { 91 [self setContentStringValue:str]; 92} 93 94@end 95 96#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE