PageRenderTime 29ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

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