/Source/externals/GData/Source/Clients/Contacts/GDataContactLanguage.m

http://google-email-uploader-mac.googlecode.com/ · Objective C · 70 lines · 35 code · 18 blank · 17 comment · 1 complexity · 1b8eb575d6a646f0f5345ab48076aaba 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. // GDataContactLanguage.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE
  19. #import "GDataContactLanguage.h"
  20. #import "GDataContactConstants.h"
  21. static NSString* const kLabelAttr = @"label";
  22. static NSString *const kCodeAttr = @"code";
  23. @implementation GDataContactLanguage
  24. + (NSString *)extensionElementURI { return kGDataNamespaceContact; }
  25. + (NSString *)extensionElementPrefix { return kGDataNamespaceContactPrefix; }
  26. + (NSString *)extensionElementLocalName { return @"language"; }
  27. + (id)languageWithCode:(NSString *)code
  28. label:(NSString *)label {
  29. GDataContactLanguage *obj = [self object];
  30. [obj setLabel:label];
  31. [obj setCode:code];
  32. return obj;
  33. }
  34. - (void)addParseDeclarations {
  35. NSArray *attrs = [NSArray arrayWithObjects:kLabelAttr, kCodeAttr, nil];
  36. [self addLocalAttributeDeclarations:attrs];
  37. }
  38. #pragma mark -
  39. - (NSString *)label {
  40. return [self stringValueForAttribute:kLabelAttr];
  41. }
  42. - (void)setLabel:(NSString *)str {
  43. [self setStringValue:str forAttribute:kLabelAttr];
  44. }
  45. - (NSString *)code {
  46. return [self stringValueForAttribute:kCodeAttr];
  47. }
  48. - (void)setCode:(NSString *)str {
  49. [self setStringValue:str forAttribute:kCodeAttr];
  50. }
  51. @end
  52. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE