/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Analytics/GDataAnalyticsDestination.m
Objective C | 122 lines | 72 code | 31 blank | 19 comment | 1 complexity | 9818015f361133d02f5e8aec0755afe9 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// GDataAnalyticsDestination.m 18// 19 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE 21 22#import "GDataAnalyticsDestination.h" 23#import "GDataAnalyticsConstants.h" 24 25static NSString *const kCaseSensitiveAttr = @"caseSensitive"; 26static NSString *const kExpressionAttr = @"expression"; 27static NSString *const kMatchTypeAttr = @"matchType"; 28static NSString *const kStep1RequiredAttr = @"step1Required"; 29 30@implementation GDataAnalyticsDestination 31 32+ (NSString *)extensionElementURI { return kGDataNamespaceAnalyticsGA; } 33+ (NSString *)extensionElementPrefix { return kGDataNamespaceAnalyticsGAPrefix; } 34+ (NSString *)extensionElementLocalName { return @"destination"; } 35 36- (void)addParseDeclarations { 37 38 NSArray *attrs = [NSArray arrayWithObjects: 39 kCaseSensitiveAttr, kExpressionAttr, 40 kMatchTypeAttr, kStep1RequiredAttr, nil]; 41 42 [self addLocalAttributeDeclarations:attrs]; 43} 44 45- (void)addExtensionDeclarations { 46 [super addExtensionDeclarations]; 47 48 [self addExtensionDeclarationForParentClass:[self class] 49 childClass:[GDataAnalyticsStep class]]; 50} 51 52#if !GDATA_SIMPLE_DESCRIPTIONS 53- (NSMutableArray *)itemsForDescription { 54 55 static struct GDataDescriptionRecord descRecs[] = { 56 { @"steps", @"steps", kGDataDescArrayDescs }, 57 { nil, nil, (GDataDescRecTypes)0 } 58 }; 59 60 NSMutableArray *items = [super itemsForDescription]; 61 [self addDescriptionRecords:descRecs toItems:items]; 62 return items; 63} 64#endif 65 66#pragma mark - 67 68// Attributes 69 70- (BOOL)isCaseSensitive { 71 return [self boolValueForAttribute:kCaseSensitiveAttr 72 defaultValue:NO]; 73} 74 75- (void)setIsCaseSensitive:(BOOL)flag { 76 [self setExplicitBoolValue:flag forAttribute:kCaseSensitiveAttr]; 77} 78 79- (NSString *)expression { 80 return [self stringValueForAttribute:kExpressionAttr]; 81} 82 83- (void)setExpression:(NSString *)str { 84 [self setStringValue:str forAttribute:kExpressionAttr]; 85} 86 87- (NSString *)matchType { 88 return [self stringValueForAttribute:kMatchTypeAttr]; 89} 90 91- (void)setMatchType:(NSString *)str { 92 [self setStringValue:str forAttribute:kMatchTypeAttr]; 93} 94 95- (BOOL)isStep1Required { 96 return [self boolValueForAttribute:kStep1RequiredAttr 97 defaultValue:NO]; 98} 99 100- (void)setIsStep1Required:(BOOL)flag { 101 [self setExplicitBoolValue:flag forAttribute:kStep1RequiredAttr]; 102} 103 104#pragma mark - 105 106// Extensions 107 108- (NSArray *)steps { 109 return [self objectsForExtensionClass:[GDataAnalyticsStep class]]; 110} 111 112- (void)setSteps:(NSArray *)array { 113 [self setObjects:array forExtensionClass:[GDataAnalyticsStep class]]; 114} 115 116- (void)addStep:(GDataAnalyticsStep *)obj { 117 [self addObject:obj forExtensionClass:[GDataAnalyticsStep class]]; 118} 119 120@end 121 122#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE