/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Contacts/GDataContactRelation.m

http://macfuse.googlecode.com/ · Objective C · 83 lines · 46 code · 20 blank · 17 comment · 1 complexity · 868065040bddb450154393bd80ff6bc7 MD5 · raw file

  1. /* Copyright (c) 2009 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. // GDataContactRelation.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE
  19. #define GDATACONTACTRELATION_DEFINE_GLOBALS 1
  20. #import "GDataContactRelation.h"
  21. #import "GDataContactConstants.h"
  22. static NSString* const kRelAttr = @"rel";
  23. static NSString* const kLabelAttr = @"label";
  24. @implementation GDataContactRelation
  25. + (NSString *)extensionElementURI { return kGDataNamespaceContact; }
  26. + (NSString *)extensionElementPrefix { return kGDataNamespaceContactPrefix; }
  27. + (NSString *)extensionElementLocalName { return @"relation"; }
  28. + (id)relationWithRel:(NSString *)rel
  29. label:(NSString *)label
  30. value:(NSString *)value {
  31. GDataContactRelation *obj = [self object];
  32. [obj setRel:rel];
  33. [obj setLabel:label];
  34. [obj setStringValue:value];
  35. return obj;
  36. }
  37. - (void)addParseDeclarations {
  38. NSArray *attrs = [NSArray arrayWithObjects:
  39. kRelAttr, kLabelAttr, nil];
  40. [self addLocalAttributeDeclarations:attrs];
  41. [self addContentValueDeclaration];
  42. }
  43. #pragma mark -
  44. - (NSString *)rel {
  45. return [self stringValueForAttribute:kRelAttr];
  46. }
  47. - (void)setRel:(NSString *)str {
  48. [self setStringValue:str forAttribute:kRelAttr];
  49. }
  50. - (NSString *)label {
  51. return [self stringValueForAttribute:kLabelAttr];
  52. }
  53. - (void)setLabel:(NSString *)str {
  54. [self setStringValue:str forAttribute:kLabelAttr];
  55. }
  56. - (NSString *)stringValue {
  57. return [self contentStringValue];
  58. }
  59. - (void)setStringValue:(NSString *)str {
  60. [self setContentStringValue:str];
  61. }
  62. @end
  63. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE