/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. // GDataFeedPhotoBase.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE
  19. #import "GDataFeedPhotoUser.h"
  20. #import "GDataPhotoConstants.h"
  21. @implementation GDataFeedPhotoUser
  22. + (GDataFeedPhotoUser *)userFeed {
  23. GDataFeedPhotoUser *feed = [self object];
  24. [feed setNamespaces:[GDataPhotoConstants photoNamespaces]];
  25. return feed;
  26. }
  27. + (NSString *)standardFeedKind {
  28. return kGDataCategoryPhotosUser;
  29. }
  30. + (void)load {
  31. [self registerFeedClass];
  32. }
  33. - (void)addExtensionDeclarations {
  34. [super addExtensionDeclarations];
  35. // common photo extensions
  36. Class feedClass = [self class];
  37. [self addExtensionDeclarationForParentClass:feedClass
  38. childClasses:
  39. [GDataPhotoMaxPhotosPerAlbum class],
  40. [GDataPhotoNickname class],
  41. [GDataPhotoQuotaLimit class],
  42. [GDataPhotoQuotaUsed class],
  43. [GDataPhotoThumbnail class],
  44. [GDataPhotoUser class],
  45. nil];
  46. }
  47. #if !GDATA_SIMPLE_DESCRIPTIONS
  48. - (NSMutableArray *)itemsForDescription {
  49. static struct GDataDescriptionRecord descRecs[] = {
  50. { @"maxPhotosPerAlbum", @"maxPhotosPerAlbum", kGDataDescValueLabeled },
  51. { @"nickname", @"nickname", kGDataDescValueLabeled },
  52. { @"quotaLimit", @"quotaLimit", kGDataDescValueLabeled },
  53. { @"quotaUsed", @"quotaUsed", kGDataDescValueLabeled },
  54. { @"thumbnail", @"thumbnail", kGDataDescValueLabeled },
  55. { @"username", @"username", kGDataDescValueLabeled },
  56. { nil, nil, (GDataDescRecTypes)0 }
  57. };
  58. NSMutableArray *items = [super itemsForDescription];
  59. [self addDescriptionRecords:descRecs toItems:items];
  60. return items;
  61. }
  62. #endif
  63. #pragma mark -
  64. - (NSNumber *)maxPhotosPerAlbum { // long long
  65. GDataPhotoMaxPhotosPerAlbum *obj = [self objectForExtensionClass:[GDataPhotoMaxPhotosPerAlbum class]];
  66. return [obj longLongNumberValue];
  67. }
  68. - (void)setMaxPhotosPerAlbum:(NSNumber *)num {
  69. GDataPhotoMaxPhotosPerAlbum *obj = [GDataPhotoMaxPhotosPerAlbum valueWithNumber:num];
  70. [self setObject:obj forExtensionClass:[GDataPhotoMaxPhotosPerAlbum class]];
  71. }
  72. - (NSString *)nickname {
  73. GDataPhotoNickname *obj = [self objectForExtensionClass:[GDataPhotoNickname class]];
  74. return [obj stringValue];
  75. }
  76. - (void)setNickname:(NSString *)str {
  77. GDataPhotoNickname *obj = [GDataPhotoNickname valueWithString:str];
  78. [self setObject:obj forExtensionClass:[GDataPhotoNickname class]];
  79. }
  80. - (NSString *)thumbnail {
  81. GDataPhotoThumbnail *obj = [self objectForExtensionClass:[GDataPhotoThumbnail class]];
  82. return [obj stringValue];
  83. }
  84. - (void)setThumbnail:(NSString *)str {
  85. GDataPhotoThumbnail *obj = [GDataPhotoThumbnail valueWithString:str];
  86. [self setObject:obj forExtensionClass:[GDataPhotoThumbnail class]];
  87. }
  88. - (NSNumber *)quotaLimit { // long long
  89. GDataPhotoQuotaLimit *obj = [self objectForExtensionClass:[GDataPhotoQuotaLimit class]];
  90. return [obj longLongNumberValue];
  91. }
  92. - (void)setQuotaLimit:(NSNumber *)num {
  93. GDataPhotoQuotaLimit *obj = [GDataPhotoQuotaLimit valueWithNumber:num];
  94. [self setObject:obj forExtensionClass:[GDataPhotoQuotaLimit class]];
  95. }
  96. - (NSNumber *)quotaUsed { // long long
  97. GDataPhotoQuotaUsed *obj = [self objectForExtensionClass:[GDataPhotoQuotaUsed class]];
  98. return [obj longLongNumberValue];
  99. }
  100. - (void)setQuotaUsed:(NSNumber *)num {
  101. GDataPhotoQuotaUsed *obj = [GDataPhotoQuotaUsed valueWithNumber:num];
  102. [self setObject:obj forExtensionClass:[GDataPhotoQuotaUsed class]];
  103. }
  104. - (NSString *)username {
  105. GDataPhotoUser *obj = [self objectForExtensionClass:[GDataPhotoUser class]];
  106. return [obj stringValue];
  107. }
  108. - (void)setUsername:(NSString *)str {
  109. GDataPhotoUser *obj = [GDataPhotoUser valueWithString:str];
  110. [self setObject:obj forExtensionClass:[obj class]];
  111. }
  112. @end
  113. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE