PageRenderTime 42ms CodeModel.GetById 11ms app.highlight 28ms RepoModel.GetById 1ms app.codeStats 1ms

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

http://macfuse.googlecode.com/
Objective C | 88 lines | 47 code | 22 blank | 19 comment | 1 complexity | a20b6f0447c27b63cb548da9afd51313 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//  GDataSpreadsheetColumn.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SPREADSHEET_SERVICE
21
22#import "GDataSpreadsheetColumn.h"
23
24#import "GDataEntrySpreadsheet.h"
25
26// For table columns, like:
27//    <gs:column index="b" name="Birthday" />
28
29static NSString* const kNameAttr = @"name";
30static NSString* const kIndexAttr = @"index";
31
32@implementation GDataSpreadsheetColumn
33
34+ (NSString *)extensionElementURI       { return kGDataNamespaceGSpread; }
35+ (NSString *)extensionElementPrefix    { return kGDataNamespaceGSpreadPrefix; }
36+ (NSString *)extensionElementLocalName { return @"column"; }
37
38+ (GDataSpreadsheetColumn *)columnWithIndexString:(NSString *)indexStr
39                                             name:(NSString *)name {
40
41  GDataSpreadsheetColumn *obj = [self object];
42  [obj setIndexString:indexStr];
43  [obj setName:name];
44  return obj;
45}
46
47- (void)addParseDeclarations {
48  NSArray *attrs = [NSArray arrayWithObjects:
49                    kNameAttr, kIndexAttr, nil];
50
51  [self addLocalAttributeDeclarations:attrs];
52}
53
54
55#if !GDATA_SIMPLE_DESCRIPTIONS
56- (NSMutableArray *)itemsForDescription {
57
58  static struct GDataDescriptionRecord descRecs[] = {
59    { @"name",    @"name",        kGDataDescValueLabeled },
60    { @"index",   @"indexString", kGDataDescValueLabeled },
61    { nil, nil, (GDataDescRecTypes)0 }
62  };
63
64  NSMutableArray *items = [super itemsForDescription];
65  [self addDescriptionRecords:descRecs toItems:items];
66  return items;
67}
68#endif
69
70- (NSString *)name {
71  return [self stringValueForAttribute:kNameAttr];
72}
73
74- (void)setName:(NSString *)str {
75  [self setStringValue:str forAttribute:kNameAttr];
76}
77
78- (NSString *)indexString {
79  return [self stringValueForAttribute:kIndexAttr];
80}
81
82- (void)setIndexString:(NSString *)str {
83  [self setStringValue:str forAttribute:kIndexAttr];
84}
85
86@end
87
88#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SPREADSHEET_SERVICE