PageRenderTime 28ms CodeModel.GetById 9ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 1ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Spreadsheets/GDataEntrySpreadsheetTable.m

http://macfuse.googlecode.com/
Objective C | 143 lines | 90 code | 36 blank | 17 comment | 1 complexity | ef019f54565d87f745736e43da86bf6d 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//  GDataEntrySpreadsheetTable.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SPREADSHEET_SERVICE
 21
 22#define GDATAENTRYSPREADSHEETTABLE_DEFINE_GLOBALS 1
 23#import "GDataEntrySpreadsheetTable.h"
 24
 25#import "GDataSpreadsheetConstants.h"
 26#import "GDataSpreadsheetData.h"
 27#import "GDataSpreadsheetHeader.h"
 28
 29@implementation GDataWorksheetName
 30
 31+ (NSString *)extensionElementURI       { return kGDataNamespaceGSpread; }
 32+ (NSString *)extensionElementPrefix    { return kGDataNamespaceGSpreadPrefix; }
 33+ (NSString *)extensionElementLocalName { return @"worksheet"; }
 34
 35- (NSString *)attributeName {
 36  return @"name";
 37}
 38
 39+ (GDataWorksheetName *)worksheetNameWithString:(NSString *)str {
 40  return [self valueWithString:str];
 41}
 42
 43@end
 44
 45@implementation GDataEntrySpreadsheetTable
 46
 47+ (GDataEntrySpreadsheetTable *)tableEntry {
 48
 49  GDataEntrySpreadsheetTable *entry = [self object];
 50
 51  [entry setNamespaces:[GDataSpreadsheetConstants spreadsheetNamespaces]];
 52  return entry;
 53}
 54
 55#pragma mark -
 56
 57+ (NSString *)standardEntryKind {
 58  return kGDataCategorySpreadsheetTable;
 59}
 60
 61+ (void)load {
 62  [self registerEntryClass];
 63}
 64
 65- (void)addExtensionDeclarations {
 66
 67  [super addExtensionDeclarations];
 68
 69  Class entryClass = [self class];
 70
 71  [self addExtensionDeclarationForParentClass:entryClass
 72                                 childClasses:
 73   [GDataSpreadsheetData class],
 74   [GDataSpreadsheetHeader class],
 75   [GDataWorksheetName class],
 76   nil];
 77}
 78
 79#if !GDATA_SIMPLE_DESCRIPTIONS
 80- (NSMutableArray *)itemsForDescription {
 81  static struct GDataDescriptionRecord descRecs[] = {
 82    { @"header",    @"spreadsheetHeader",         kGDataDescValueLabeled },
 83    { @"data",      @"spreadsheetData",           kGDataDescValueLabeled },
 84    { @"worksheet", @"worksheetName.stringValue", kGDataDescValueLabeled },
 85    { nil, nil,(GDataDescRecTypes) 0 }
 86  };
 87
 88  NSMutableArray *items = [super itemsForDescription];
 89  [self addDescriptionRecords:descRecs toItems:items];
 90  return items;
 91}
 92#endif
 93
 94+ (NSString *)defaultServiceVersion {
 95  return kGDataSpreadsheetDefaultServiceVersion;
 96}
 97
 98#pragma mark -
 99
100- (GDataSpreadsheetData *)spreadsheetData {
101  return [self objectForExtensionClass:[GDataSpreadsheetData class]];
102}
103
104- (void)setSpreadsheetData:(GDataSpreadsheetData *)obj {
105  [self setObject:obj forExtensionClass:[GDataSpreadsheetData class]];
106}
107
108- (GDataSpreadsheetHeader *)spreadsheetHeader {
109  return [self objectForExtensionClass:[GDataSpreadsheetHeader class]];
110}
111
112- (void)setSpreadsheetHeader:(GDataSpreadsheetHeader *)obj {
113  [self setObject:obj forExtensionClass:[GDataSpreadsheetHeader class]];
114}
115
116- (void)setSpreadsheetHeaderWithRow:(int)row {
117  GDataSpreadsheetHeader *header = [GDataSpreadsheetHeader headerWithRow:row];
118  [self setSpreadsheetHeader:header];
119}
120
121- (GDataWorksheetName *)worksheetName {
122  return [self objectForExtensionClass:[GDataWorksheetName class]];
123}
124
125- (void)setWorksheetName:(GDataWorksheetName *)obj {
126  [self setObject:obj forExtensionClass:[GDataWorksheetName class]];
127}
128
129- (void)setWorksheetNameWithString:(NSString *)str {
130  [self setWorksheetName:[GDataWorksheetName worksheetNameWithString:str]];
131}
132
133#pragma mark -
134
135- (NSURL *)recordFeedURL {
136  GDataEntryContent *content = [self content];
137  NSURL *sourceURL = [content sourceURL];
138  return sourceURL;
139}
140
141@end
142
143#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SPREADSHEET_SERVICE