PageRenderTime 64ms CodeModel.GetById 13ms app.highlight 48ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/externals/GData/Source/Clients/Photos/GDataEntryPhotoAlbum.m

http://google-email-uploader-mac.googlecode.com/
Objective C | 215 lines | 146 code | 46 blank | 23 comment | 1 complexity | f4c9bf04059c65b90b8cd3407cd7f992 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//  GDataEntryPhotoAlbum.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE
 21
 22#import "GDataEntryPhotoAlbum.h"
 23#import "GDataPhotoElements.h"
 24#import "GDataPhotoConstants.h"
 25
 26@implementation GDataEntryPhotoAlbum
 27
 28+ (GDataEntryPhotoAlbum *)albumEntry {
 29  
 30  GDataEntryPhotoAlbum *entry = [self object];
 31
 32  [entry setNamespaces:[GDataPhotoConstants photoNamespaces]];
 33  
 34  return entry;
 35}
 36
 37#pragma mark -
 38
 39+ (NSString *)standardEntryKind {
 40  return kGDataCategoryPhotosAlbum;
 41}
 42
 43+ (void)load {
 44  [self registerEntryClass];
 45}
 46
 47- (void)addExtensionDeclarations {
 48
 49  [super addExtensionDeclarations];
 50
 51  // common photo extensions
 52  Class entryClass = [self class];
 53
 54  [self addExtensionDeclarationForParentClass:entryClass
 55                                 childClasses:
 56   [GDataPhotoAccess class], [GDataPhotoBytesUsed class],
 57   [GDataPhotoCommentCount class], [GDataPhotoCommentingEnabled class],
 58   [GDataPhotoTimestamp class], [GDataPhotoNumberUsed class],
 59   [GDataPhotoNumberLeft class], [GDataPhotoBytesUsed class],
 60   [GDataPhotoUser class], [GDataPhotoNickname class],
 61   [GDataPhotoLocation class], [GDataMediaGroup class], nil];
 62
 63  [GDataGeo addGeoExtensionDeclarationsToObject:self
 64                                 forParentClass:entryClass];
 65}
 66
 67#if !GDATA_SIMPLE_DESCRIPTIONS
 68- (NSMutableArray *)itemsForDescription {
 69  
 70  static struct GDataDescriptionRecord descRecs[] = {
 71    { @"access",          @"access",          kGDataDescValueLabeled },
 72    { @"bytesUsed",       @"bytesUsed",       kGDataDescValueLabeled },
 73    { @"commentCount",    @"commentCount",    kGDataDescValueLabeled },
 74    { @"commentsEnabled", @"commentsEnabled", kGDataDescValueLabeled },
 75    { @"date",            @"timestamp",       kGDataDescValueLabeled },
 76    { @"location",        @"location",        kGDataDescValueLabeled },
 77    { @"nickname",        @"nickname",        kGDataDescValueLabeled },
 78    { @"photosLeft",      @"photosLeft",      kGDataDescValueLabeled },
 79    { @"photosUsed",      @"photosUsed",      kGDataDescValueLabeled },
 80    { @"username",        @"username",        kGDataDescValueLabeled },
 81    { @"mediaGroup",      @"mediaGroup",      kGDataDescValueLabeled },
 82    { @"geoLocation",     @"geoLocation",     kGDataDescValueLabeled },
 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