PageRenderTime 33ms CodeModel.GetById 14ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 1ms

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

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