PageRenderTime 19ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 86 lines | 42 code | 25 blank | 19 comment | 1 complexity | bf9b2d0f352af7acc650f77360007558 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. // GDataEntryPhotoTag.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE
  19. #import "GDataEntryPhotoTag.h"
  20. #import "GDataPhotoElements.h"
  21. #import "GDataPhotoConstants.h"
  22. @implementation GDataEntryPhotoTag
  23. + (GDataEntryPhotoTag *)tagEntryWithString:(NSString *)tagStr {
  24. GDataEntryPhotoTag *entry = [self object];
  25. [entry setNamespaces:[GDataPhotoConstants photoNamespaces]];
  26. [entry setTitle:[GDataTextConstruct textConstructWithString:tagStr]];
  27. return entry;
  28. }
  29. #pragma mark -
  30. + (NSString *)standardEntryKind {
  31. return kGDataCategoryPhotosTag;
  32. }
  33. + (void)load {
  34. [self registerEntryClass];
  35. }
  36. - (void)addExtensionDeclarations {
  37. [super addExtensionDeclarations];
  38. // common photo extensions
  39. Class entryClass = [self class];
  40. [self addExtensionDeclarationForParentClass:entryClass
  41. childClass:[GDataPhotoWeight class]];
  42. }
  43. #if !GDATA_SIMPLE_DESCRIPTIONS
  44. - (NSMutableArray *)itemsForDescription {
  45. NSMutableArray *items = [super itemsForDescription];
  46. [self addToArray:items objectDescriptionIfNonNil:[self weight] withName:@"weight"];
  47. return items;
  48. }
  49. #endif
  50. #pragma mark -
  51. - (NSNumber *)weight {
  52. // int
  53. GDataPhotoWeight *obj = [self objectForExtensionClass:[GDataPhotoWeight class]];
  54. return [obj intNumberValue];
  55. }
  56. - (void)setWeight:(NSNumber *)num {
  57. GDataPhotoWeight *obj = [GDataPhotoWeight valueWithNumber:num];
  58. [self setObject:obj forExtensionClass:[obj class]];
  59. }
  60. @end
  61. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE