/core/externals/update-engine/externals/gdata-objectivec-client/Source/ACL/GDataACLScope.m
Objective C | 82 lines | 43 code | 18 blank | 21 comment | 3 complexity | 2d7aad9df078d62c0c6909fefbff8c39 MD5 | raw file
1/* Copyright (c) 2007 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// GDataACLScope.m 18// 19 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ACLS \ 21 || GDATA_INCLUDE_CALENDAR_SERVICE || GDATA_INCLUDE_DOCS_SERVICE 22 23#define GDATAACLSCOPE_DEFINE_GLOBALS 1 24#import "GDataACLScope.h" 25 26#import "GDataEntryACL.h" 27 28static NSString* const kNameAttr = @"name"; 29static NSString* const kTypeAttr = @"type"; 30static NSString* const kValueAttr = @"value"; 31 32@implementation GDataACLScope 33// an element with type and value attributes, as in 34// <gAcl:scope type='user' value='user@gmail.com'></gAcl:scope> 35// 36// http://code.google.com/apis/calendar/reference.html#gacl_reference 37 38+ (NSString *)extensionElementURI { return kGDataNamespaceACL; } 39+ (NSString *)extensionElementPrefix { return kGDataNamespaceACLPrefix; } 40+ (NSString *)extensionElementLocalName { return @"scope"; } 41 42+ (GDataACLScope *)scopeWithType:(NSString *)type value:(NSString *)value { 43 GDataACLScope *obj = [self object]; 44 [obj setType:type]; 45 [obj setValue:value]; 46 return obj; 47} 48 49- (void)addParseDeclarations { 50 51 NSArray *attrs = [NSArray arrayWithObjects: 52 kTypeAttr, kValueAttr, kNameAttr, nil]; 53 [self addLocalAttributeDeclarations:attrs]; 54} 55 56- (NSString *)value { 57 return [self stringValueForAttribute:kValueAttr]; 58} 59 60- (void)setValue:(NSString *)str { 61 [self setStringValue:str forAttribute:kValueAttr]; 62} 63 64- (NSString *)type { 65 return [self stringValueForAttribute:kTypeAttr]; 66} 67 68- (void)setType:(NSString *)str { 69 [self setStringValue:str forAttribute:kTypeAttr]; 70} 71 72- (NSString *)name { 73 return [self stringValueForAttribute:kNameAttr]; 74} 75 76- (void)setName:(NSString *)str { 77 [self setStringValue:str forAttribute:kNameAttr]; 78} 79 80@end 81 82#endif // !GDATA_REQUIRE_SERVICE_INCLUDE || GDATA_INCLUDE_*