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

http://macfuse.googlecode.com/ · Objective C · 86 lines · 44 code · 23 blank · 19 comment · 3 complexity · d81e342c185c6e29447c3b00ba4169db 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. // GDataEntryPhotoBase.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE
  19. #define GDATAPHOTOBASE_DEFINE_GLOBALS 1
  20. #import "GDataEntryPhotoBase.h"
  21. #import "GDataPhotoConstants.h"
  22. @implementation GDataEntryPhotoBase
  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. + (NSString *)defaultServiceVersion {
  37. return kGDataPhotosDefaultServiceVersion;
  38. }
  39. #pragma mark -
  40. - (NSString *)GPhotoID {
  41. GDataPhotoGPhotoID *obj = [self objectForExtensionClass:[GDataPhotoGPhotoID class]];
  42. return [obj stringValue];
  43. }
  44. - (void)setGPhotoID:(NSString *)str {
  45. if (str) {
  46. GDataPhotoGPhotoID *obj = [GDataPhotoGPhotoID valueWithString:str];
  47. [self setObject:obj forExtensionClass:[GDataPhotoGPhotoID class]];
  48. } else {
  49. [self setObject:nil forExtensionClass:[GDataPhotoGPhotoID class]];
  50. }
  51. }
  52. // like in the Java library, we'll rename summary as description
  53. - (GDataTextConstruct *)photoDescription {
  54. return [self summary];
  55. }
  56. - (void)setPhotoDescription:(GDataTextConstruct *)obj {
  57. [self setSummary:obj];
  58. }
  59. - (void)setPhotoDescriptionWithString:(NSString *)str {
  60. [self setSummary:[GDataTextConstruct textConstructWithString:str]];
  61. }
  62. @end
  63. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE