/core/externals/update-engine/externals/gdata-objectivec-client/Source/Media/GDataMediaCategory.m

http://macfuse.googlecode.com/ · Objective C · 80 lines · 41 code · 19 blank · 20 comment · 2 complexity · 9e8dcb5ddca565253657900648f3d7fa MD5 · raw file

  1. /* Copyright (c) 2008 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. // GDataMediaCategory.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE \
  19. || GDATA_INCLUDE_YOUTUBE_SERVICE
  20. #import "GDataMediaCategory.h"
  21. #import "GDataMediaGroup.h"
  22. static NSString* const kSchemeAttr = @"scheme";
  23. static NSString* const kLabelAttr = @"label";
  24. @implementation GDataMediaCategory
  25. // like <media:category scheme="http://search.yahoo.com/mrss/category_schema" label="foo">
  26. // music/artist/album/song</media:category>
  27. // http://search.yahoo.com/mrss
  28. + (NSString *)extensionElementURI { return kGDataNamespaceMedia; }
  29. + (NSString *)extensionElementPrefix { return kGDataNamespaceMediaPrefix; }
  30. + (NSString *)extensionElementLocalName { return @"category"; }
  31. + (GDataMediaCategory *)mediaCategoryWithString:(NSString *)str {
  32. GDataMediaCategory* obj = [self object];
  33. [obj setStringValue:str];
  34. return obj;
  35. }
  36. - (void)addParseDeclarations {
  37. NSArray *attrs = [NSArray arrayWithObjects:
  38. kLabelAttr, kSchemeAttr, nil];
  39. [self addLocalAttributeDeclarations:attrs];
  40. [self addContentValueDeclaration];
  41. }
  42. - (NSString *)label {
  43. return [self stringValueForAttribute:kLabelAttr];
  44. }
  45. - (void)setLabel:(NSString *)str {
  46. [self setStringValue:str forAttribute:kLabelAttr];
  47. }
  48. - (NSString *)scheme {
  49. return [self stringValueForAttribute:kSchemeAttr];
  50. }
  51. - (void)setScheme:(NSString *)str {
  52. [self setStringValue:str forAttribute:kSchemeAttr];
  53. }
  54. - (NSString *)stringValue {
  55. return [self contentStringValue];
  56. }
  57. - (void)setStringValue:(NSString *)str {
  58. [self setContentStringValue:str];
  59. }
  60. @end
  61. #endif // #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_*_SERVICE