/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Analytics/GDataAnalyticsCustomVariable.m
Objective C | 73 lines | 39 code | 17 blank | 17 comment | 1 complexity | 64ccce17aa9f531a26b12d08872c645f MD5 | raw file
1/* Copyright (c) 2009 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// GDataAnalyticsCustomVariable.m 18// 19 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE 21 22#import "GDataAnalyticsCustomVariable.h" 23#import "GDataAnalyticsConstants.h" 24 25static NSString *const kIndexAttr = @"index"; 26static NSString *const kNameAttr = @"name"; 27static NSString *const kScopeAttr = @"scope"; 28 29@implementation GDataAnalyticsCustomVariable 30 31+ (NSString *)extensionElementURI { return kGDataNamespaceAnalyticsGA; } 32+ (NSString *)extensionElementPrefix { return kGDataNamespaceAnalyticsGAPrefix; } 33+ (NSString *)extensionElementLocalName { return @"customVariable"; } 34 35- (void)addParseDeclarations { 36 37 NSArray *attrs = [NSArray arrayWithObjects: 38 kIndexAttr, kNameAttr, kScopeAttr, nil]; 39 40 [self addLocalAttributeDeclarations:attrs]; 41} 42 43#pragma mark - 44 45- (NSNumber *)index { 46 NSNumber *num = [self intNumberForAttribute:kIndexAttr]; 47 return num; 48} 49 50- (void)setIndex:(NSNumber *)num { 51 [self setStringValue:[num stringValue] forAttribute:kIndexAttr]; 52} 53 54- (NSString *)name { 55 NSString *str = [self stringValueForAttribute:kNameAttr]; 56 return str; 57} 58 59- (void)setName:(NSString *)str { 60 [self setStringValue:str forAttribute:kNameAttr]; 61} 62 63- (NSString *)scope { 64 NSString *str = [self stringValueForAttribute:kScopeAttr]; 65 return str; 66} 67 68- (void)setScope:(NSString *)str { 69 [self setStringValue:str forAttribute:kScopeAttr]; 70} 71@end 72 73#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE