/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Spreadsheets/GDataFeedSpreadsheetCell.m
Objective C | 125 lines | 73 code | 30 blank | 22 comment | 2 complexity | 604bd9873dad85a504a05b9e0db86c3b 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// GDataFeedSpreadsheetCell.m 18// 19 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SPREADSHEET_SERVICE 21 22#import "GDataEntrySpreadsheetCell.h" 23#import "GDataSpreadsheetConstants.h" 24#import "GDataFeedSpreadsheetCell.h" 25#import "GDataCategory.h" 26#import "GDataRowColumnCount.h" 27 28@implementation GDataFeedSpreadsheetCell 29 30+ (NSString *)coreProtocolVersionForServiceVersion:(NSString *)serviceVersion { 31 return [GDataSpreadsheetConstants coreProtocolVersionForServiceVersion:serviceVersion]; 32} 33 34+ (GDataFeedSpreadsheetCell *)spreadsheetCellFeedWithXMLData:(NSData *)data { 35 return [self feedWithXMLData:data]; 36} 37 38+ (GDataFeedSpreadsheetCell *)spreadsheetCellFeed { 39 GDataFeedSpreadsheetCell *feed = [self object]; 40 [feed setNamespaces:[GDataSpreadsheetConstants spreadsheetNamespaces]]; 41 return feed; 42} 43 44#pragma mark - 45 46+ (NSString *)standardEntryKind { 47 // spreadsheet categories do not use the standard Kind scheme 48 // (kGDataCategoryScheme) so cannot be init'd by GDataEntryBase 49 return nil; 50} 51 52+ (void)load { 53 // spreadsheet categories do not use the standard Kind scheme 54 // (kGDataCategoryScheme) so cannot be registered with +registerEntryClass 55 [GDataFeedBase registerFeedClass:[self class] 56 forCategoryWithScheme:nil 57 term:kGDataCategorySpreadsheetCell]; 58} 59 60- (void)addExtensionDeclarations { 61 62 [super addExtensionDeclarations]; 63 64 Class entryClass = [self class]; 65 66 67 // Worksheet extensions 68 [self addExtensionDeclarationForParentClass:entryClass 69 childClasses: 70 [GDataColumnCount class], 71 [GDataRowCount class], 72 nil]; 73} 74 75- (id)init { 76 self = [super init]; 77 if (self) { 78 [self addCategory:[GDataCategory categoryWithScheme:kGDataCategorySchemeSpreadsheet 79 term:kGDataCategorySpreadsheetCell]]; 80 } 81 return self; 82} 83 84#if !GDATA_SIMPLE_DESCRIPTIONS 85- (NSMutableArray *)itemsForDescription { 86 87 NSMutableArray *items = [super itemsForDescription]; 88 89 NSString *colStr = [NSString stringWithFormat:@"%d", (int) [self columnCount]]; 90 NSString *rowStr = [NSString stringWithFormat:@"%d", (int) [self rowCount]]; 91 92 [self addToArray:items objectDescriptionIfNonNil:colStr withName:@"cols"]; 93 [self addToArray:items objectDescriptionIfNonNil:rowStr withName:@"rows"]; 94 95 return items; 96} 97#endif 98 99- (Class)classForEntries { 100 return [GDataEntrySpreadsheetCell class]; 101} 102 103+ (NSString *)defaultServiceVersion { 104 return kGDataSpreadsheetDefaultServiceVersion; 105} 106 107#pragma mark - 108 109- (NSInteger)rowCount { 110 GDataRowCount *rowCount = 111 (GDataRowCount *) [self objectForExtensionClass:[GDataRowCount class]]; 112 113 return [rowCount count]; 114} 115 116- (NSInteger)columnCount { 117 GDataColumnCount *columnCount = 118 (GDataColumnCount *) [self objectForExtensionClass:[GDataColumnCount class]]; 119 120 return [columnCount count]; 121} 122 123@end 124 125#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SPREADSHEET_SERVICE