PageRenderTime 62ms CodeModel.GetById 10ms app.highlight 49ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 215 lines | 145 code | 47 blank | 23 comment | 1 complexity | 4bd6799b3c2e8166ba4e82de216e47e4 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 "GDataFeedPhotoAlbum.h"
 23#import "GDataPhotoConstants.h"
 24
 25
 26@implementation GDataFeedPhotoAlbum
 27
 28+ (GDataFeedPhotoAlbum *)albumFeed {
 29  
 30  GDataFeedPhotoAlbum *entry = [self object];
 31  
 32  [entry setNamespaces:[GDataPhotoConstants photoNamespaces]];
 33  
 34  return entry;
 35}
 36
 37+ (NSString *)standardFeedKind {
 38  return kGDataCategoryPhotosAlbum;
 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  // common photo extensions
 52  [self addExtensionDeclarationForParentClass:feedClass
 53                                 childClasses:
 54   [GDataPhotoAccess class], [GDataPhotoBytesUsed class],
 55   [GDataPhotoCommentCount class], [GDataPhotoCommentingEnabled class],
 56   [GDataPhotoTimestamp class], [GDataPhotoNumberUsed class],
 57   [GDataPhotoNumberLeft class], [GDataPhotoBytesUsed class],
 58   [GDataPhotoUser class], [GDataPhotoNickname class],
 59   [GDataPhotoLocation class], [GDataMediaGroup class],
 60   nil];
 61
 62  [GDataGeo addGeoExtensionDeclarationsToObject:self
 63                                 forParentClass:feedClass];
 64}
 65
 66#if !GDATA_SIMPLE_DESCRIPTIONS
 67- (NSMutableArray *)itemsForDescription {
 68  
 69  static struct GDataDescriptionRecord descRecs[] = {
 70    { @"access",          @"access",          kGDataDescValueLabeled },
 71    { @"bytesUsed",       @"bytesUsed",       kGDataDescValueLabeled },
 72    { @"commentCount",    @"commentCount",    kGDataDescValueLabeled },
 73    { @"commentsEnabled", @"commentsEnabled", kGDataDescValueLabeled },
 74    { @"date",            @"timestamp",       kGDataDescValueLabeled },
 75    { @"location",        @"location",        kGDataDescValueLabeled },
 76    { @"nickname",        @"nickname",        kGDataDescValueLabeled },
 77    { @"photosLeft",      @"photosLeft",      kGDataDescValueLabeled },
 78    { @"photosUsed",      @"photosUsed",      kGDataDescValueLabeled },
 79    { @"username",        @"username",        kGDataDescValueLabeled },
 80    { @"mediaGroup",      @"mediaGroup",      kGDataDescValueLabeled },
 81    { @"geoLocation",     @"geoLocation",     kGDataDescValueLabeled },
 82
 83    { nil, nil, (GDataDescRecTypes)0 }
 84  };
 85  
 86  NSMutableArray *items = [super itemsForDescription];
 87  [self addDescriptionRecords:descRecs toItems:items];
 88  return items;
 89}
 90#endif
 91
 92#pragma mark -
 93
 94- (NSString *)access {
 95  GDataPhotoAccess *obj = [self objectForExtensionClass:[GDataPhotoAccess class]];
 96  return [obj stringValue];
 97}
 98
 99- (void)setAccess:(NSString *)str {
100  GDataPhotoAccess *obj = [GDataPhotoAccess valueWithString:str];
101  [self setObject:obj forExtensionClass:[GDataPhotoAccess class]];  
102}
103
104- (NSNumber *)bytesUsed {
105  // long long
106  GDataPhotoBytesUsed *obj = [self objectForExtensionClass:[GDataPhotoBytesUsed class]];
107  return [obj longLongNumberValue];
108}
109
110- (void)setBytesUsed:(NSNumber *)num {
111  GDataPhotoBytesUsed *obj = [GDataPhotoBytesUsed valueWithNumber:num];
112  [self setObject:obj forExtensionClass:[obj class]];  
113}
114
115- (NSNumber *)commentCount {
116  // int
117  GDataPhotoCommentCount *obj = [self objectForExtensionClass:[GDataPhotoCommentCount class]];
118  return [obj intNumberValue];
119}
120
121- (void)setCommentCount:(NSNumber *)num {
122  GDataPhotoCommentCount *obj = [GDataPhotoCommentCount valueWithNumber:num];
123  [self setObject:obj forExtensionClass:[obj class]];  
124}
125
126- (NSNumber *)commentsEnabled {
127  // BOOL
128  GDataPhotoCommentingEnabled *obj = [self objectForExtensionClass:[GDataPhotoCommentingEnabled class]];
129  return [obj boolNumberValue];
130}
131
132- (void)setCommentsEnabled:(NSNumber *)num {
133  GDataPhotoCommentingEnabled *obj = [GDataPhotoCommentingEnabled valueWithBool:[num boolValue]];
134  [self setObject:obj forExtensionClass:[obj class]];  
135}
136
137- (GDataPhotoTimestamp *)timestamp {
138  return [self objectForExtensionClass:[GDataPhotoTimestamp class]];
139}
140
141- (void)setTimestamp:(GDataPhotoTimestamp *)obj {
142  [self setObject:obj forExtensionClass:[GDataPhotoTimestamp class]];
143}
144
145- (NSString *)location {
146  GDataPhotoLocation *obj = [self objectForExtensionClass:[GDataPhotoLocation class]];
147  return [obj stringValue];
148}
149
150- (void)setLocation:(NSString *)str {
151  GDataPhotoLocation *obj = [GDataPhotoLocation valueWithString:str];
152  [self setObject:obj forExtensionClass:[GDataPhotoLocation class]];  
153}
154
155- (NSString *)nickname {
156  GDataPhotoNickname *obj = [self objectForExtensionClass:[GDataPhotoNickname class]];
157  return [obj stringValue];
158}
159
160- (void)setNickname:(NSString *)str {
161  GDataPhotoNickname *obj = [GDataPhotoNickname valueWithString:str];
162  [self setObject:obj forExtensionClass:[GDataPhotoNickname class]];  
163}
164
165- (NSNumber *)photosLeft {
166  // int
167  GDataPhotoNumberLeft *obj = [self objectForExtensionClass:[GDataPhotoNumberLeft class]];
168  return [obj intNumberValue];
169}
170
171- (void)setPhotosLeft:(NSNumber *)num {
172  GDataPhotoNumberLeft *obj = [GDataPhotoNumberLeft valueWithNumber:num];
173  [self setObject:obj forExtensionClass:[obj class]];  
174}
175
176- (NSNumber *)photosUsed {
177  // int
178  GDataPhotoNumberUsed *obj = [self objectForExtensionClass:[GDataPhotoNumberUsed class]];
179  return [obj intNumberValue];
180}
181
182- (void)setPhotosUsed:(NSNumber *)num {
183  GDataPhotoNumberUsed *obj = [GDataPhotoNumberUsed valueWithNumber:num];
184  [self setObject:obj forExtensionClass:[obj class]];  
185}
186
187- (NSString *)username {
188  GDataPhotoUser *obj = [self objectForExtensionClass:[GDataPhotoUser class]];
189  return [obj stringValue];
190}
191
192- (void)setUsername:(NSString *)str {
193  GDataPhotoUser *obj = [GDataPhotoUser valueWithString:str];
194  [self setObject:obj forExtensionClass:[obj class]];  
195}
196
197- (GDataGeo *)geoLocation {
198  return [GDataGeo geoLocationForObject:self];
199}
200
201- (void)setGeoLocation:(GDataGeo *)geo {
202  [GDataGeo setGeoLocation:geo forObject:self];
203}
204
205- (GDataMediaGroup *)mediaGroup {
206  return (GDataMediaGroup *) [self objectForExtensionClass:[GDataMediaGroup class]];
207}
208
209- (void)setMediaGroup:(GDataMediaGroup *)obj {
210  [self setObject:obj forExtensionClass:[GDataMediaGroup class]];
211}
212
213@end
214
215#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE