PageRenderTime 59ms CodeModel.GetById 11ms app.highlight 45ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Docs/GDataEntryDocListMetadata.m

http://macfuse.googlecode.com/
Objective C | 195 lines | 136 code | 41 blank | 18 comment | 1 complexity | 4200462b469b9cfa0d1b62f1f40205b3 MD5 | raw file
  1/* Copyright (c) 2010 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//  GDataEntryDocListMetadata.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_DOCS_SERVICE
 21
 22#import "GDataEntryDocListMetadata.h"
 23
 24@interface GDataQuotaBytesUsedInTrash : GDataValueElementConstruct <GDataExtension>
 25@end
 26
 27@implementation GDataQuotaBytesUsedInTrash
 28+ (NSString *)extensionElementURI       { return kGDataNamespaceDocuments; }
 29+ (NSString *)extensionElementPrefix    { return kGDataNamespaceDocumentsPrefix; }
 30+ (NSString *)extensionElementLocalName { return @"quotaBytesUsedInTrash"; }
 31@end
 32
 33@implementation GDataEntryDocListMetadata : GDataEntryBase
 34
 35+ (NSString *)standardEntryKind {
 36  return kGDataCategoryDocListMetadata;
 37}
 38
 39+ (NSString *)coreProtocolVersionForServiceVersion:(NSString *)serviceVersion {
 40  return [GDataDocConstants coreProtocolVersionForServiceVersion:serviceVersion];
 41}
 42
 43+ (void)load {
 44  [self registerEntryClass];
 45}
 46
 47- (void)addExtensionDeclarations {
 48
 49  [super addExtensionDeclarations];
 50
 51  [self addExtensionDeclarationForParentClass:[self class]
 52                                 childClasses:
 53   [GDataDocExportFormat class],
 54   [GDataDocFeature class],
 55   [GDataDocImportFormat class],
 56   [GDataDocMaxUploadSize class],
 57   [GDataQuotaBytesTotal class],
 58   [GDataQuotaBytesUsed class],
 59   [GDataQuotaBytesUsedInTrash class],
 60   [GDataDocLargestChangestamp class],
 61   nil];
 62}
 63
 64#if !GDATA_SIMPLE_DESCRIPTIONS
 65- (NSMutableArray *)itemsForDescription {
 66
 67  static struct GDataDescriptionRecord descRecs[] = {
 68    { @"quotaTotal",         @"quotaBytesTotal",       kGDataDescValueLabeled },
 69    { @"quotaUsed",          @"quotaBytesUsed",        kGDataDescValueLabeled },
 70    { @"quotaInTrash",       @"quotaBytesUsedInTrash", kGDataDescValueLabeled },
 71    { @"features",           @"features",              kGDataDescArrayDescs   },
 72    { @"uploadSize",         @"maxUploadSizes",        kGDataDescValueLabeled },
 73    { @"export",             @"exportFormats",         kGDataDescArrayDescs   },
 74    { @"import",             @"importFormats",         kGDataDescArrayDescs   },
 75    { @"largestChangestamp", @"largestChangestamp",    kGDataDescValueLabeled },
 76    { nil, nil, (GDataDescRecTypes)0 }
 77  };
 78
 79  NSMutableArray *items = [super itemsForDescription];
 80  [self addDescriptionRecords:descRecs toItems:items];
 81  return items;
 82}
 83#endif
 84
 85+ (NSString *)defaultServiceVersion {
 86  return kGDataDocsDefaultServiceVersion;
 87}
 88
 89#pragma mark -
 90
 91// extensions
 92- (NSArray *)exportFormats {
 93  NSArray *array = [self objectsForExtensionClass:[GDataDocExportFormat class]];
 94  return array;
 95}
 96
 97- (void)setExportFormats:(NSArray *)array {
 98  [self setObjects:array forExtensionClass:[GDataDocExportFormat class]];
 99}
100
101- (NSArray *)features {
102  NSArray *array = [self objectsForExtensionClass:[GDataDocFeature class]];
103  return array;
104}
105
106- (void)setFeatures:(NSArray *)array {
107  [self setObjects:array forExtensionClass:[GDataDocFeature class]];
108}
109
110- (NSArray *)importFormats {
111  NSArray *array = [self objectsForExtensionClass:[GDataDocImportFormat class]];
112  return array;
113}
114
115- (void)setImportFormats:(NSArray *)array {
116  [self setObjects:array forExtensionClass:[GDataDocImportFormat class]];
117}
118
119- (NSArray *)maxUploadSizes {
120  NSArray *array = [self objectsForExtensionClass:[GDataDocMaxUploadSize class]];
121  return array;
122}
123
124- (void)setMaxUploadSizes:(NSArray *)array {
125  [self setObjects:array forExtensionClass:[GDataDocMaxUploadSize class]];
126}
127
128- (NSNumber *)quotaBytesTotal { // long long
129  GDataQuotaBytesTotal *obj;
130
131  obj = [self objectForExtensionClass:[GDataQuotaBytesTotal class]];
132  return [obj longLongNumberValue];
133}
134
135- (void)setQuotaBytesTotal:(NSNumber *)num {
136  GDataQuotaBytesTotal *obj = [GDataQuotaBytesTotal valueWithNumber:num];
137  [self setObject:obj forExtensionClass:[GDataQuotaBytesTotal class]];
138}
139
140- (NSNumber *)quotaBytesUsed { // long long
141  GDataQuotaBytesUsed *obj;
142
143  obj = [self objectForExtensionClass:[GDataQuotaBytesUsed class]];
144  return [obj longLongNumberValue];
145}
146
147- (void)setQuotaBytesUsed:(NSNumber *)num {
148  GDataQuotaBytesUsed *obj = [GDataQuotaBytesUsed valueWithNumber:num];
149  [self setObject:obj forExtensionClass:[GDataQuotaBytesUsed class]];
150}
151
152- (NSNumber *)quotaBytesUsedInTrash { // long long
153  GDataQuotaBytesUsedInTrash *obj;
154
155  obj = [self objectForExtensionClass:[GDataQuotaBytesUsedInTrash class]];
156  return [obj longLongNumberValue];
157}
158
159- (void)setQuotaBytesUsedInTrash:(NSNumber *)num {
160  GDataQuotaBytesUsedInTrash *obj = [GDataQuotaBytesUsedInTrash valueWithNumber:num];
161  [self setObject:obj forExtensionClass:[GDataQuotaBytesUsedInTrash class]];
162}
163
164- (NSNumber *)largestChangestamp {
165  GDataDocLargestChangestamp *obj;
166  obj = [self objectForExtensionClass:[GDataDocLargestChangestamp class]];
167  return [obj longLongNumberValue];
168}
169
170- (void)setLargestChangestamp:(NSNumber *)num {
171  GDataDocLargestChangestamp *obj;
172  obj = [GDataDocLargestChangestamp valueWithNumber:num];
173  [self setObject:obj forExtensionClass:[GDataDocLargestChangestamp class]];
174}
175
176#pragma mark -
177
178- (GDataDocMaxUploadSize *)maxUploadSizeForKind:(NSString *)uploadKind {
179  GDataDocMaxUploadSize *obj;
180
181  obj = [GDataUtilities firstObjectFromArray:[self maxUploadSizes]
182                                   withValue:uploadKind
183                                  forKeyPath:@"uploadKind"];
184  return obj;
185}
186
187- (GDataDocFeature *)featureForName:(NSString *)name {
188  GDataDocFeature *obj = [GDataUtilities firstObjectFromArray:[self features]
189                                                    withValue:name
190                                                   forKeyPath:@"featureName"];
191  return obj;
192}
193@end
194
195#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_DOCS_SERVICE