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

http://macfuse.googlecode.com/ · Objective C · 100 lines · 55 code · 26 blank · 19 comment · 3 complexity · 76a04ec0166ef380b9d2ea88bce020e6 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 "GDataFeedPhotoBase.h"
  20. #import "GDataPhotoConstants.h"
  21. #import "GDataPhotoElements.h"
  22. @implementation GDataFeedPhotoBase
  23. - (void)addExtensionDeclarations {
  24. [super addExtensionDeclarations];
  25. // common photo extensions
  26. [self addExtensionDeclarationForParentClass:[self class]
  27. childClass:[GDataPhotoGPhotoID class]];
  28. }
  29. #if !GDATA_SIMPLE_DESCRIPTIONS
  30. - (NSMutableArray *)itemsForDescription {
  31. NSMutableArray *items = [super itemsForDescription];
  32. [self addToArray:items objectDescriptionIfNonNil:[self GPhotoID] withName:@"gphotoID"];
  33. return items;
  34. }
  35. #endif
  36. - (Class)classForEntries {
  37. return kUseRegisteredEntryClass;
  38. }
  39. + (NSString *)defaultServiceVersion {
  40. return kGDataPhotosDefaultServiceVersion;
  41. }
  42. #pragma mark -
  43. - (NSString *)GPhotoID {
  44. GDataPhotoGPhotoID *obj = [self objectForExtensionClass:[GDataPhotoGPhotoID class]];
  45. return [obj stringValue];
  46. }
  47. - (void)setGPhotoID:(NSString *)str {
  48. if (str) {
  49. GDataPhotoGPhotoID *obj = [GDataPhotoGPhotoID valueWithString:str];
  50. [self setObject:obj forExtensionClass:[GDataPhotoGPhotoID class]];
  51. } else {
  52. [self setObject:nil forExtensionClass:[GDataPhotoGPhotoID class]];
  53. }
  54. }
  55. // like in the Java library, we'll rename subtitle as description
  56. - (GDataTextConstruct *)photoDescription {
  57. return [self subtitle];
  58. }
  59. - (void)setPhotoDescription:(GDataTextConstruct *)obj {
  60. [self setSubtitle:obj];
  61. }
  62. - (void)setPhotoDescriptionWithString:(NSString *)str {
  63. [self setSubtitle:[GDataTextConstruct textConstructWithString:str]];
  64. }
  65. #pragma mark -
  66. - (id)entryForGPhotoID:(NSString *)str {
  67. GDataEntryPhotoBase *obj;
  68. obj = [GDataUtilities firstObjectFromArray:[self entries]
  69. withValue:str
  70. forKeyPath:@"GPhotoID"];
  71. return obj;
  72. }
  73. @end
  74. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE