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

http://macfuse.googlecode.com/ · Objective C · 83 lines · 45 code · 18 blank · 20 comment · 2 complexity · 399d30879ac34c266f9ed467d45f9442 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. // GDataMediaRestriction.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE \
  19. || GDATA_INCLUDE_YOUTUBE_SERVICE
  20. #import "GDataMediaRestriction.h"
  21. #import "GDataMediaGroup.h"
  22. static NSString* const kRelationshipAttr = @"relationship";
  23. static NSString* const kTypeAttr = @"type";
  24. @implementation GDataMediaRestriction
  25. // like <media:restriction relationship="allow" type="country">au us</media:restriction>
  26. //
  27. // http://search.yahoo.com/mrss
  28. + (NSString *)extensionElementURI { return kGDataNamespaceMedia; }
  29. + (NSString *)extensionElementPrefix { return kGDataNamespaceMediaPrefix; }
  30. + (NSString *)extensionElementLocalName { return @"restriction"; }
  31. + (GDataMediaRestriction *)mediaRestrictionWithString:(NSString *)str
  32. relationship:(NSString *)rel
  33. type:(NSString *)type {
  34. GDataMediaRestriction* obj = [self object];
  35. [obj setStringValue:str];
  36. [obj setRelationship:rel];
  37. [obj setType:type];
  38. return obj;
  39. }
  40. - (void)addParseDeclarations {
  41. NSArray *attrs = [NSArray arrayWithObjects:
  42. kRelationshipAttr, kTypeAttr, nil];
  43. [self addLocalAttributeDeclarations:attrs];
  44. [self addContentValueDeclaration];
  45. }
  46. - (NSString *)relationship {
  47. return [self stringValueForAttribute:kRelationshipAttr];
  48. }
  49. - (void)setRelationship:(NSString *)str {
  50. [self setStringValue:str forAttribute:kRelationshipAttr];
  51. }
  52. - (NSString *)type {
  53. return [self stringValueForAttribute:kTypeAttr];
  54. }
  55. - (void)setType:(NSString *)str {
  56. [self setStringValue:str forAttribute:kTypeAttr];
  57. }
  58. - (NSString *)stringValue {
  59. return [self contentStringValue];
  60. }
  61. - (void)setStringValue:(NSString *)str {
  62. [self setContentStringValue:str];
  63. }
  64. @end
  65. #endif // #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_*_SERVICE