PageRenderTime 55ms CodeModel.GetById 24ms app.highlight 29ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Photos/GDataFeedPhoto.m

http://macfuse.googlecode.com/
Objective C | 231 lines | 155 code | 51 blank | 25 comment | 1 complexity | 6fcb4cce1b47c0efb077d48981558f32 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//  GDataFeedPhotoBase.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE
 21
 22#import "GDataFeedPhoto.h"
 23#import "GDataPhotoConstants.h"
 24
 25
 26@implementation GDataFeedPhoto
 27
 28+ (GDataFeedPhoto *)photoFeed {
 29  
 30  GDataFeedPhoto *feed = [self object];
 31  
 32  [feed setNamespaces:[GDataPhotoConstants photoNamespaces]];
 33  
 34  return feed;
 35}
 36
 37+ (NSString *)standardFeedKind {
 38  return kGDataCategoryPhotosPhoto;
 39}
 40
 41+ (void)load {
 42  [self registerFeedClass];
 43}
 44
 45- (void)addExtensionDeclarations {
 46
 47  [super addExtensionDeclarations];
 48
 49  Class feedClass = [self class];
 50
 51  // Photo extensions
 52  [self addExtensionDeclarationForParentClass:feedClass
 53                                 childClasses:
 54
 55   [GDataPhotoWidth class], [GDataPhotoHeight class],
 56   [GDataPhotoRotation class], [GDataPhotoSize class],
 57   [GDataPhotoAlbumID class], [GDataPhotoTimestamp class],
 58   [GDataPhotoCommentCount class], [GDataPhotoCommentingEnabled class],
 59   [GDataPhotoChecksum class],
 60   [GDataMediaGroup class], [GDataEXIFTags class],
 61   [GDataPhotoVideoStatus class],
 62
 63   nil];
 64
 65  [GDataGeo addGeoExtensionDeclarationsToObject:self
 66                                 forParentClass:feedClass];
 67}
 68
 69#if !GDATA_SIMPLE_DESCRIPTIONS
 70- (NSMutableArray *)itemsForDescription {
 71
 72  static struct GDataDescriptionRecord descRecs[] = {
 73    { @"albumID",          @"albumID",           kGDataDescValueLabeled },
 74    { @"checksum",         @"checksum",          kGDataDescValueLabeled },
 75    { @"commentCount",     @"commentCount",      kGDataDescValueLabeled },
 76    { @"commentsEnabled",  @"commentsEnabled",   kGDataDescValueLabeled },
 77    { @"height",           @"height",            kGDataDescValueLabeled },
 78    { @"width",            @"width",             kGDataDescValueLabeled },
 79    { @"status",           @"videoStatus",       kGDataDescValueLabeled },
 80    { @"rotation",         @"rotation",          kGDataDescValueLabeled },
 81    { @"size",             @"size",              kGDataDescValueLabeled },
 82    { @"timestamp",        @"timestamp",         kGDataDescValueLabeled },
 83    { @"mediaGroup",       @"mediaGroup",        kGDataDescValueLabeled },
 84    { @"exifTags",         @"EXIFTags",          kGDataDescValueLabeled },
 85    { @"geoLocation",      @"geoLocation",       kGDataDescValueLabeled },
 86    { nil, nil, (GDataDescRecTypes)0 }
 87  };
 88
 89  NSMutableArray *items = [super itemsForDescription];
 90  [self addDescriptionRecords:descRecs toItems:items];
 91  return items;
 92}
 93#endif
 94
 95#pragma mark -
 96
 97- (NSString *)albumID {
 98  GDataPhotoAlbumID *obj = [self objectForExtensionClass:[GDataPhotoAlbumID class]];
 99  return [obj stringValue];
100}
101
102- (void)setAlbumID:(NSString *)str {
103  GDataObject *obj = [GDataPhotoAlbumID valueWithString:str];
104  [self setObject:obj forExtensionClass:[obj class]];  
105}
106
107- (NSString *)checksum {
108  GDataPhotoChecksum *obj = [self objectForExtensionClass:[GDataPhotoChecksum class]];
109  return [obj stringValue];
110}
111
112- (void)setChecksum:(NSString *)str {
113  GDataObject *obj = [GDataPhotoChecksum valueWithString:str];
114  [self setObject:obj forExtensionClass:[obj class]];  
115}
116
117- (NSNumber *)commentCount {
118  // int
119  GDataPhotoCommentCount *obj = [self objectForExtensionClass:[GDataPhotoCommentCount class]];
120  return [obj intNumberValue];
121}
122
123- (void)setCommentCount:(NSNumber *)num {
124  GDataObject *obj = [GDataPhotoCommentCount valueWithNumber:num];
125  [self setObject:obj forExtensionClass:[obj class]];  
126}
127
128- (NSNumber *)commentsEnabled {
129  // BOOL
130  GDataPhotoCommentingEnabled *obj = [self objectForExtensionClass:[GDataPhotoCommentingEnabled class]];
131  return [obj boolNumberValue];
132}
133
134- (void)setCommentsEnabled:(NSNumber *)num {
135  GDataObject *obj = [GDataPhotoCommentingEnabled valueWithBool:[num boolValue]];
136  [self setObject:obj forExtensionClass:[obj class]];  
137}
138
139- (NSNumber *)height {
140  // long long
141  GDataPhotoHeight *obj = [self objectForExtensionClass:[GDataPhotoHeight class]];
142  return [obj longLongNumberValue];
143}
144
145- (void)setHeight:(NSNumber *)num {
146  GDataObject *obj = [GDataPhotoHeight valueWithNumber:num];
147  [self setObject:obj forExtensionClass:[obj class]];  
148}
149
150- (NSNumber *)rotation {
151  // int
152  GDataPhotoRotation *obj = [self objectForExtensionClass:[GDataPhotoRotation class]];
153  return [obj intNumberValue];
154}
155
156- (void)setRotation:(NSNumber *)num {
157  GDataObject *obj = [GDataPhotoRotation valueWithNumber:num];
158  [self setObject:obj forExtensionClass:[obj class]];  
159}
160
161- (NSNumber *)size {
162  // long long
163  GDataPhotoSize *obj = [self objectForExtensionClass:[GDataPhotoSize class]];
164  return [obj longLongNumberValue];
165}
166
167- (void)setSize:(NSNumber *)num {
168  GDataObject *obj = [GDataPhotoSize valueWithNumber:num];
169  [self setObject:obj forExtensionClass:[obj class]];  
170}
171
172- (GDataPhotoTimestamp *)timestamp {
173  GDataPhotoTimestamp *obj = [self objectForExtensionClass:[GDataPhotoTimestamp class]];
174  return obj ;
175}
176
177- (void)setTimestamp:(GDataPhotoTimestamp *)obj {
178  [self setObject:obj forExtensionClass:[GDataPhotoTimestamp class]];  
179}
180
181- (NSNumber *)width {
182  // long long
183  GDataPhotoWidth *obj = [self objectForExtensionClass:[GDataPhotoWidth class]];
184  return [obj longLongNumberValue];
185}
186
187- (NSString *)videoStatus {
188  GDataPhotoVideoStatus *obj = [self objectForExtensionClass:[GDataPhotoVideoStatus class]];
189  return [obj stringValue];
190}
191
192- (void)setVideoStatus:(NSString *)str {
193  GDataPhotoVideoStatus *obj = [GDataPhotoVideoStatus valueWithString:str];
194  [self setObject:obj forExtensionClass:[obj class]];  
195}
196
197- (void)setWidth:(NSNumber *)num {
198  GDataObject *obj = [GDataPhotoWidth valueWithNumber:num];
199  [self setObject:obj forExtensionClass:[obj class]];  
200}
201
202- (GDataMediaGroup *)mediaGroup {
203  return (GDataMediaGroup *) [self objectForExtensionClass:[GDataMediaGroup class]];
204}
205
206- (void)setMediaGroup:(GDataMediaGroup *)obj {
207  [self setObject:obj forExtensionClass:[GDataMediaGroup class]];
208}
209
210#pragma mark -
211
212- (GDataGeo *)geoLocation {
213  return [GDataGeo geoLocationForObject:self];
214}
215
216- (void)setGeoLocation:(GDataGeo *)geo {
217  [GDataGeo setGeoLocation:geo forObject:self];
218}
219
220// EXIF tag support
221- (GDataEXIFTags *)EXIFTags {
222  return (GDataEXIFTags *) [self objectForExtensionClass:[GDataEXIFTags class]];
223}
224
225- (void)setEXIFTags:(GDataEXIFTags *)tags {
226  [self setObject:tags forExtensionClass:[GDataEXIFTags class]];   
227}
228
229@end
230
231#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE