PageRenderTime 65ms CodeModel.GetById 13ms app.highlight 49ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://google-email-uploader-mac.googlecode.com/
Objective C | 145 lines | 95 code | 32 blank | 18 comment | 1 complexity | fa96299ce88a4c288e37815d4db07afd 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 "GDataFeedPhotoUser.h"
 23#import "GDataPhotoConstants.h"
 24
 25@implementation GDataFeedPhotoUser
 26
 27+ (GDataFeedPhotoUser *)userFeed {
 28  
 29  GDataFeedPhotoUser *feed = [self object];
 30  
 31  [feed setNamespaces:[GDataPhotoConstants photoNamespaces]];
 32  
 33  return feed;
 34}
 35
 36+ (NSString *)standardFeedKind {
 37  return kGDataCategoryPhotosUser;
 38}
 39
 40+ (void)load {
 41  [self registerFeedClass];
 42}
 43
 44- (void)addExtensionDeclarations {
 45  
 46  [super addExtensionDeclarations];
 47  
 48  // common photo extensions
 49  Class feedClass = [self class];
 50
 51  [self addExtensionDeclarationForParentClass:feedClass
 52                                 childClasses:
 53   [GDataPhotoMaxPhotosPerAlbum class],
 54   [GDataPhotoNickname class],
 55   [GDataPhotoQuotaLimit class],
 56   [GDataPhotoQuotaUsed class],
 57   [GDataPhotoThumbnail class],
 58   [GDataPhotoUser class],
 59   nil];
 60}
 61
 62#if !GDATA_SIMPLE_DESCRIPTIONS
 63- (NSMutableArray *)itemsForDescription {
 64  
 65  static struct GDataDescriptionRecord descRecs[] = {
 66    { @"maxPhotosPerAlbum", @"maxPhotosPerAlbum", kGDataDescValueLabeled },
 67    { @"nickname",          @"nickname",          kGDataDescValueLabeled },
 68    { @"quotaLimit",        @"quotaLimit",        kGDataDescValueLabeled },
 69    { @"quotaUsed",         @"quotaUsed",         kGDataDescValueLabeled },
 70    { @"thumbnail",         @"thumbnail",         kGDataDescValueLabeled },
 71    { @"username",          @"username",          kGDataDescValueLabeled },
 72    { nil, nil, (GDataDescRecTypes)0 }
 73  };
 74  
 75  NSMutableArray *items = [super itemsForDescription];
 76  [self addDescriptionRecords:descRecs toItems:items];
 77  return items;
 78}
 79#endif
 80
 81#pragma mark -
 82
 83- (NSNumber *)maxPhotosPerAlbum { // long long
 84  GDataPhotoMaxPhotosPerAlbum *obj = [self objectForExtensionClass:[GDataPhotoMaxPhotosPerAlbum class]];
 85  return [obj longLongNumberValue];
 86}
 87
 88- (void)setMaxPhotosPerAlbum:(NSNumber *)num {
 89  GDataPhotoMaxPhotosPerAlbum *obj = [GDataPhotoMaxPhotosPerAlbum valueWithNumber:num];
 90  [self setObject:obj forExtensionClass:[GDataPhotoMaxPhotosPerAlbum class]];  
 91}
 92
 93- (NSString *)nickname {
 94  GDataPhotoNickname *obj = [self objectForExtensionClass:[GDataPhotoNickname class]];
 95  return [obj stringValue];
 96}
 97
 98- (void)setNickname:(NSString *)str {
 99  GDataPhotoNickname *obj = [GDataPhotoNickname valueWithString:str];
100  [self setObject:obj forExtensionClass:[GDataPhotoNickname class]];  
101}
102
103- (NSString *)thumbnail {
104  GDataPhotoThumbnail *obj = [self objectForExtensionClass:[GDataPhotoThumbnail class]];
105  return [obj stringValue];
106}
107
108- (void)setThumbnail:(NSString *)str {
109  GDataPhotoThumbnail *obj = [GDataPhotoThumbnail valueWithString:str];
110  [self setObject:obj forExtensionClass:[GDataPhotoThumbnail class]];  
111}
112
113- (NSNumber *)quotaLimit { // long long
114  GDataPhotoQuotaLimit *obj = [self objectForExtensionClass:[GDataPhotoQuotaLimit class]];
115  return [obj longLongNumberValue];
116}
117
118- (void)setQuotaLimit:(NSNumber *)num {
119  GDataPhotoQuotaLimit *obj = [GDataPhotoQuotaLimit valueWithNumber:num];
120  [self setObject:obj forExtensionClass:[GDataPhotoQuotaLimit class]];  
121}
122
123- (NSNumber *)quotaUsed { // long long
124  GDataPhotoQuotaUsed *obj = [self objectForExtensionClass:[GDataPhotoQuotaUsed class]];
125  return [obj longLongNumberValue];
126}
127
128- (void)setQuotaUsed:(NSNumber *)num {
129  GDataPhotoQuotaUsed *obj = [GDataPhotoQuotaUsed valueWithNumber:num];
130  [self setObject:obj forExtensionClass:[GDataPhotoQuotaUsed class]];  
131}
132
133- (NSString *)username {
134  GDataPhotoUser *obj = [self objectForExtensionClass:[GDataPhotoUser class]];
135  return [obj stringValue];
136}
137
138- (void)setUsername:(NSString *)str {
139  GDataPhotoUser *obj = [GDataPhotoUser valueWithString:str];
140  [self setObject:obj forExtensionClass:[obj class]];  
141}
142
143@end
144
145#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE